/* PREMIUM PRODUCT CARD STYLES - Scoped */
.pm-card{ width:100%; background:#fff; border-radius:28px; overflow:hidden; box-shadow:0 12px 32px rgba(12,12,20,0.08); display:flex; flex-direction:column; transition:transform .22s cubic-bezier(.2,.9,.2,1),box-shadow .22s; margin:8px 0; font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial; }
.pm-image{ width:100%; background:linear-gradient(180deg,#fff,#f6f6f6); cursor: pointer; }
.pm-image img{width:100%;aspect-ratio:1/1;object-fit:contain;border-radius:18px;}
.pm-body{ padding:14px; display:flex; flex-direction:column; gap:8px; flex:1; justify-content:center; }
.pm-title{ font-size:1.2rem; margin:0; color:#0f2b54; font-weight:800; letter-spacing:-0.01em; text-align:center; line-height:1.3; }
.pm-desc{ margin:0; color:#7b4b3a; font-weight:600; opacity:.95; font-size:.95rem; line-height:1.25; text-align:center; }
.pm-meta{ display:flex; gap:18px; align-items:center; justify-content:space-between; flex-wrap:wrap; }
.pm-meta label{ display:block; font-weight:800; color:#ef4444; font-size:.9rem; margin-bottom:6px; text-align:center; }
.size-picker{ display:flex; gap:10px; align-items:center; background:transparent; justify-content:center; }
.size-picker .qty-btn{ width:44px; height:44px; border-radius:50%; border:none; background:#fff; box-shadow:0 10px 22px rgba(12,12,20,.06); font-size:1.4rem; font-weight:800; color:#111; display:grid; place-items:center; cursor:pointer; transition:transform .12s; }
.size-picker .qty-btn:active{ transform:translateY(1px) scale(.98); }
.size-picker .size-value{ width:50px; text-align:center; font-weight:800; font-size:1.1rem; border:none; background:transparent; }

/* FIXED COLOR SELECTOR */
.color-select{ 
    min-width:160px; 
    padding:12px 45px 12px 15px;
    border-radius:22px; 
    border:2px solid rgba(11,11,11,.15); 
    background:linear-gradient(180deg,#0b2b46,#1a2f5a); 
    color:#fff; 
    font-weight:800; 
    box-shadow:0 4px 15px rgba(12,12,20,0.1);
    cursor: pointer;
    transition:all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 14px;
}

/* FIXED QUANTITY SECTION */
.pm-actions{ display:flex; gap:14px; align-items:center; justify-content:space-between; margin-top:4px; flex-wrap:wrap; }
.pm-qty{ 
    display:flex; 
    gap:10px; 
    align-items:center; 
    justify-content:center;
    position: relative;
}
/* Quantity label */
.pm-qty::before {
    content: "Qty:";
    font-weight: 800;
    color: #ef4444;
    font-size: 0.9rem;
    margin-right: 4px;
}
.qty-input{ width:60px; text-align:center; font-weight:800; font-size:1.05rem; border-radius:10px; border:1px solid rgba(0,0,0,.06); padding:8px; }
.pm-cta{ display:flex; gap:8px; align-items:center; justify-content:center; width:100%; }

/* Add to cart - green pill */
.add-cta{ display:inline-flex; gap:10px; align-items:center; justify-content:center; padding:12px 18px; border-radius:28px; font-weight:800; cursor:pointer; user-select:none; transition:transform .12s,box-shadow .16s,opacity .12s; border:none; box-shadow:0 8px 22px rgba(12,12,20,.08); background:linear-gradient(180deg,#33d08a,#16a34a); color:#fff; min-width:160px; }
.cta:active,.qty-btn:active{ transform:translateY(1px) scale(.985); opacity:.98; }

/* === PERFECTLY CENTERED GRID LAYOUT === */
.product-grid-section {
    width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.section-title {
    text-align: center;
    width: 100%;
    margin-bottom: 2rem;
}

.product-grid {
    width: 100%;
    display: flex;
    justify-content: center;
}

.premium-grid{ 
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 20px;
    width: 100%;
    margin: 0 auto;
}

/* Small screens - 1 row */
@media (max-width: 480px) {
    .premium-grid {
        grid-template-columns: repeat(1, 1fr);
        gap: 16px;
        max-width: 400px;
        margin: 0 auto;
        padding: 0 16px;
    }
    .pm-image.mode-contain {
        min-height: 260px;
    }
    .pm-image.mode-contain img {
        max-height: 240px;
    }
}

/* Medium phones - 2 rows */
@media (min-width: 481px) and (max-width: 767px) {
    .premium-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
        max-width: 500px;
        margin: 0 auto;
        padding: 0 20px;
    }
    .pm-image.mode-contain {
        min-height: 220px;
    }
    .pm-image.mode-contain img {
        max-height: 200px;
    }
}

/* Tablets & iPad Mini - 3 rows */
@media (min-width: 768px) and (max-width: 1023px) {
    .premium-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
        max-width: 800px;
        margin: 0 auto;
        padding: 0 24px;
    }
}

/* Large tablets & iPad Landscape - 4 rows */
@media (min-width: 1024px) and (max-width: 1279px) {
    .premium-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 18px;
        max-width: 1100px;
        margin: 0 auto;
        padding: 0 32px;
    }
}

/* Desktops - 4 rows */
@media (min-width: 1280px) and (max-width: 1439px) {
    .premium-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 22px;
        max-width: 1200px;
        margin: 0 auto;
        padding: 0 40px;
    }
}

/* Large desktops - 4 rows */
@media (min-width: 1440px) {
    .premium-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 24px;
        max-width: 1400px;
        margin: 0 auto;
        padding: 0 48px;
    }
}

/* Extra large screens - 5 rows */
@media (min-width: 1920px) {
    .premium-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 26px;
        max-width: 1800px;
        margin: 0 auto;
        padding: 0 60px;
    }
}

/* === INTERACTIVE ELEMENTS === */
.color-select:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(12, 12, 20, 0.15);
    border-color: rgba(11, 11, 11, 0.25);
}

.color-select:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.3);
}

.color-select:active {
    transform: translateY(1px);
}

/* Desktop alignment fix */
@media (min-width: 1024px) {
    .pm-actions {
        justify-content: center;
        gap: 20px;
    }
    .pm-qty {
        order: 1;
    }
    .pm-cta {
        order: 2;
    }
    .pm-meta {
        justify-content: center;
        gap: 30px;
    }
}

/* Mobile adjustments */
@media (max-width: 520px) {
    .pm-body{padding:10px;gap:6px;}
    .pm-title{font-size:1.1rem;}
    .pm-desc{font-size:.85rem;}
    .pm-actions{gap:10px; flex-direction:column; }
    .pm-qty .qty-btn{width:36px;height:36px;font-size:1.1rem;}
    .pm-qty input{width:50px;}
    .pm-cta{flex-direction:column; width:100%;}
    .add-cta{min-width:140px; width:100%;}
    .pm-qty::before { display: none; }
    .pm-qty { width: 100%; justify-content: space-between; }
    .color-select { min-width: 140px; font-size: 0.9rem; }
    .pm-meta{ flex-direction:column; gap:12px; }
}

/* === PREMIUM EFFECTS === */
.pm-card{
  transition:transform .25s cubic-bezier(.2,.9,.2,1), box-shadow .25s ease;
}
.pm-card:hover{
  transform:translateY(-6px) scale(1.015);
  box-shadow:0 16px 36px rgba(0,0,0,0.12);
}

.pm-cta button, .qty-btn {
  position:relative;
  overflow:hidden;
}

.pm-cta button:active::after, .qty-btn:active::after {
  content:"";
  position:absolute;
  width:120%;
  height:120%;
  top:50%;
  left:50%;
  background:rgba(255,255,255,0.25);
  border-radius:50%;
  transform:translate(-50%,-50%) scale(0);
  animation:ripple .45s ease-out forwards;
}

@keyframes ripple{
  to{transform:translate(-50%,-50%) scale(1);opacity:0;}
}

.pm-image img{
  opacity:0;
  animation:fadeIn .6s ease forwards;
}
@keyframes fadeIn{
  to{opacity:1;}
}

/* ULTRA-PREMIUM: Glassmorphism Card Edges */
.pm-card{
  backdrop-filter: blur(18px);
  background:rgba(255,255,255,0.82);
  border:1px solid rgba(255,255,255,0.35);
}

/* Parallax Zoom on Hover */
.pm-image{
  overflow:hidden;
}
.pm-image img{
  transition:transform .55s cubic-bezier(.22,.61,.36,1);
}
.pm-card:hover .pm-image img{
  transform:scale(1.08);
}

/* Add-to-cart Confirmation Pulse */
.add-cta:active{
  animation:addedPulse .45s ease-out forwards;
}
@keyframes addedPulse{
  0%{transform:scale(1);}
  50%{transform:scale(1.15);}
  100%{transform:scale(1);}
}

/* iOS Sliding Selector (Size & Qty) */
.size-picker button,
.pm-qty .qty-btn{
  transition:all .22s cubic-bezier(.2,.9,.2,1);
}
.size-picker button:hover,
.pm-qty .qty-btn:hover{
  transform:translateY(-2px);
}

/* Floating Add-to-Cart Glow */
.add-cta{
  box-shadow:0 0 0 rgba(52,211,153,0.0);
  transition:box-shadow .4s ease;
}
.add-cta:hover{
  box-shadow:0 0 22px rgba(52,211,153,0.55);
}

/* Ultra Smooth Fade-in for Entire Card */
.pm-card{
  opacity:0;
  animation:cardAppear .7s ease forwards;
}
@keyframes cardAppear{
  from{opacity:0; transform:translateY(22px);}
  to{opacity:1; transform:translateY(0);}
}

/* Image wrapper modes */
.pm-image{ position:relative; overflow:hidden; border-radius:16px; background:linear-gradient(180deg,#fafafa,#f3f3f3); padding:10px; }
.pm-image.mode-contain{ display:flex; align-items:center; justify-content:center; min-height:200px; }
.pm-image.mode-contain img{ width:auto; max-width:100%; max-height:220px; height:auto; object-fit:contain; display:block; }

/* === COLOR OPTIONS - UPDATED TO MATCH YOUR HTML === */
.color-select option[value="Black"] { background: #000; color: #fff; }
.color-select option[value="Brown"] { background: #8B4513; color: #fff; }
.color-select option[value="Grey"] { background: #6b7280; color: #fff; }
.color-select option[value="Blue"] { background: #2563eb; color: #fff; }
.color-select option[value="Wine"] { background: #991b1b; color: #fff; }

/* === DARK THEME SUPPORT === */
[data-theme="dark"] .pm-card,
.dark-mode .pm-card {
    background: rgba(30, 30, 40, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .pm-title,
.dark-mode .pm-title,
[data-theme="dark"] .pm-desc,
.dark-mode .pm-desc,
[data-theme="dark"] .pm-meta label,
.dark-mode .pm-meta label,
[data-theme="dark"] .size-picker .size-value,
.dark-mode .size-picker .size-value,
[data-theme="dark"] .qty-input,
.dark-mode .qty-input {
    color: #ffffff !important;
}

[data-theme="dark"] .pm-image,
.dark-mode .pm-image {
    background: linear-gradient(180deg, #2a2a3a, #1f1f2a);
}

[data-theme="dark"] .size-picker .qty-btn,
.dark-mode .size-picker .qty-btn {
    background: #3a3a4a;
    color: #ffffff;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .qty-input,
.dark-mode .qty-input {
    background: #3a3a4a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

[data-theme="dark"] .color-select,
.dark-mode .color-select {
    background: linear-gradient(180deg, #2a3a4a, #1a2a3a);
    border: 2px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

/* Remove go-cta button styles since we deleted it */
.go-cta { display: none !important; }

/* === IMAGE POPUP STYLES === */
.image-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(20px);
}

.image-popup-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.image-popup-content img {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: popupScale 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes popupScale {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.image-popup-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
}

.image-popup-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* --- UI improvements appended --- */

/* === UI Improvements: Header, Theme Toggle, Logo, Cards, Checkout Button === */

/* Header visible in dark mode */
body.dark-mode header,
body.dark-mode .header, body.dark-mode .site-header {
    background-color: rgba(17,17,17,0.98) !important;
    color: #ffffff !important;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    backdrop-filter: blur(6px);
}

/* Light mode header */
body:not(.dark-mode) header,
body:not(.dark-mode) .header, body:not(.dark-mode) .site-header {
    background-color: rgba(255,255,255,0.96) !important;
    color: #111827 !important;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

/* Theme toggle styles (supports id #theme-toggle and .theme-toggle) */
#theme-toggle, .theme-toggle {
    width: 52px;
    height: 30px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    padding: 4px;
    cursor: pointer;
    transition: background 240ms ease, box-shadow 240ms ease;
    background: var(--toggle-bg, #e6e6e6);
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
#theme-toggle .knob, .theme-toggle .knob {
    width: 22px;
    height: 22px;
    background: #fff;
    border-radius: 50%;
    transition: transform 200ms ease, box-shadow 200ms ease, background 200ms ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    transform: translateX(0);
}
body.dark-mode #theme-toggle, body.dark-mode .theme-toggle {
    --toggle-bg: #3b3b3b;
}
body.dark-mode #theme-toggle .knob, body.dark-mode .theme-toggle .knob {
    transform: translateX(22px);
    background: #fafafa;
}

/* Click/tap feedback */
#theme-toggle:active .knob, .theme-toggle:active .knob {
    transform: scale(0.92);
}

/* Desktop logo bump and consistent left */
@media (min-width: 1024px) {
    .site-logo img, .header-logo img, .nav-logo img {
        height: 60px !important;
        width: auto !important;
        display: block;
    }
    header .site-logo, header .header-logo, header .nav-logo {
        margin-left: 20px !important;
        display: flex;
        align-items: center;
    }
}

/* Product card hover (subtle lift and shadow) */
.pm-card, .product-card, .card {
    transition: transform 220ms cubic-bezier(.2,.9,.3,1), box-shadow 220ms cubic-bezier(.2,.9,.3,1);
    will-change: transform, box-shadow;
}
.pm-card:hover, .product-card:hover, .card:hover {
    transform: translateY(-8px);
    box-shadow: 0 18px 36px rgba(6,15,30,0.12);
}

/* Improve proceed to checkout button (reinforce) */
.checkout-btn {
    display: inline-block;
    padding: 12px 26px;
    background: linear-gradient(135deg,#ff7a00,#ff4d00);
    color: #fff;
    border-radius: 12px;
    font-weight: 700;
    letter-spacing: 0.2px;
    box-shadow: 0 8px 24px rgba(255,77,0,0.14);
    transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
    text-decoration: none;
}
.checkout-btn:hover {
    transform: translateY(-4px);
    filter: brightness(1.05);
    box-shadow: 0 18px 40px rgba(255,77,0,0.18);
}
.checkout-btn:active {
    transform: translateY(1px) scale(0.985);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

/* Ensure consistent left alignment of header elements */
.header-inner, .header-container, .site-header .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* small tweak to ensure header z-index over content */
header, .site-header {
    position: relative;
    z-index: 9999;
}

/* Accessible focus outlines for toggle and checkout button */
#theme-toggle:focus, .theme-toggle:focus, .checkout-btn:focus {
    outline: 3px solid rgba(255,124,0,0.18);
    outline-offset: 3px;
}

/* Slight text improvement for categories title */
.category-grid p, .category-card p {
    font-weight: 600;
    letter-spacing: -0.2px;
}

/* UI Enhancements */

.proceed-global-btn {
    background: linear-gradient(135deg,#ff7a00,#ff4d00);
    padding: 14px 26px;
    color:#fff;
    border-radius:12px;
    font-weight:600;
    text-decoration:none;
    box-shadow:0 8px 20px rgba(255,77,0,.2);
    transition:all .25s ease;
}
.proceed-global-btn:hover {
    transform:translateY(-3px);
    box-shadow:0 14px 32px rgba(255,77,0,.26);
}
.proceed-global-btn:active {
    transform:scale(.96);
}

/* Premium Back-to-top button */
#back-to-top {
    position: fixed;
    bottom: 70px;
    right: 22px;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg,#ff7a00,#ff4d00);
    border:none;
    border-radius:50%;
    color:#fff;
    font-size:18px;
    display:flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
    box-shadow:0 8px 18px rgba(0,0,0,.25);
    transition:all .25s ease;
    z-index:9999;
}
#back-to-top:hover {
    transform:translateY(-4px);
    box-shadow:0 14px 28px rgba(0,0,0,.3);
}
#back-to-top:active {
    transform:scale(.92);
}
