/* Theme variables (light + dark). Kept outside of any selector. */
:root{
    --bg: #f2f5f7;
    --container-bg: transparent;
    --controls-bg: #f8f9fa;
    --card-bg: #ffffff;
    --text: #222222;
    --muted: #666666;
    --header-text: #ffffff;
    --outline-gold: #d4af37;
    --accent: #007bff;
    --price-original: #c0392b;
    --price-discount: #0b6623;
}
:root.dark{
    --bg: #0f1620;
    --container-bg: transparent;
    --controls-bg: #0f1720;
    --card-bg: #0c1116;
    --text: #e7eef6;
    --muted: #bfc9d3;
    --header-text: #e7eef6; /* header text should be light in dark mode */
    --outline-gold: #ffd54a;
    --accent: #2aa0ff;
    --price-original: #ff8a8a;
    --price-discount: #7ad08a;
}

body {
    font-family: 'Georgia', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg);
    color: var(--text);
    -webkit-font-smoothing:antialiased;
}

.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 24px;
    background: var(--container-bg);
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--controls-bg);
    border-radius: 8px;
    justify-content: center; /* Center the sort options */
}

.lang-switch, .sort-options {
    display: flex;
    align-items: center;
    background: var(--card-bg);
}

.sort-options span {
    font-weight: 600;
    margin-right: 8px;
    color: var(--text);
}

.sort-options a {
    padding: 6px 10px;
    margin: 0 2px;
    background: var(--bg);
    border: 1px solid var(--outline-gold);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.sort-options a:hover {
    background: var(--outline-gold);
    color: var(--text);
}

.sort-options a.active {
    background: var(--outline-gold);
    color: var(--text);
    box-shadow: 0 2px 6px rgba(212,175,55,0.2);
}

:root.dark .sort-options a:hover,
:root.dark .sort-options a.active {
    color: #000000 !important;
}

.lang-switch a {
    padding: 5px 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: var(--text);
    font-size: 14px;
}

.lang-switch a:hover, .lang-switch a.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* Theme toggle button - moved to top-left and visually transparent */
.theme-toggle {
    position: absolute;
    left: 18px;
    top: 50%; /* vertically center relative to .title-wrap */
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    cursor: pointer;
    background: transparent;
    font-size: 18px;
    line-height: 1;
    z-index: 1400;
}
.theme-toggle:focus { outline: 2px solid rgba(0,0,0,0.12); }

.product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
}
/* Card */
.product-card {
    color: var(--header-text);
   position: relative;
    border-radius: 16px;
    box-shadow: 0 8px 18px rgba(18, 38, 63, 0.08);
    /* outer card will host the gradient background (acts like a border) */
    padding: 4px; /* thickness of the gradient "border" */
    transition: transform 0.22s, box-shadow 0.22s, background 260ms ease;
    display: flex;
    flex-direction: column;
    background: transparent;
}
.product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 14px 28px rgba(18, 38, 63, 0.12);
}
/* Gradient header like in the screenshot */
.card-header {
    padding: 14px 12px;
    text-align: center;
    color: var(--header-text);
    font-weight: 700;
    font-size: 18px;
    background: linear-gradient(90deg, #f8b8e6 0%, #bfe9ff 100%);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    box-shadow: inset 0 -6px 16px rgba(255,255,255,0.06);
}

/* Small accent box that matches the card header gradient */
.card-accent {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 18px;
    height: 18px;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.06);
    pointer-events: none;
    background: linear-gradient(90deg, #f8b8e6 0%, #bfe9ff 100%);
    transition: background 260ms ease;
}
/* inner container holds the actual card content and background */
.product-card .card-inner {
    border-radius: 12px;
    overflow: hidden;
    background: var(--card-bg);
    display: flex;
    flex-direction: column;
    color: inherit;
    /* Make the inner container stretch so its children (like .product-info)
       can use margin-top: auto to stick to the bottom of the card. */
    flex: 1 1 auto;
}
/* Main image area */
.product-media {
    padding: 18px 20px 6px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}
.product-image {
    width: 120px;
    height: 120px;
    object-fit: contain;
    cursor: pointer;
    background: #fff;
    border-radius: 12px;
}
/* Horizontal thumbnails under main image */
.image-gallery {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    overflow-x: auto;
    padding: 8px 20px 16px 20px;
}
.thumbnail {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    background: #fff;
    flex: 0 0 auto;
}
.thumbnail.active {
    border-color: rgba(0,123,255,0.9);
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
/* Card body with description */
.product-info {
    padding: 10px 18px 18px 18px;
    color: var(--text);
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}
/* Focus styles for keyboard navigation */
.product-card:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(255,213,74,0.12);
    transform: translateY(-4px);
}
.product-image:focus, .thumbnail:focus {
    outline: 3px solid rgba(42,160,255,0.9);
    border-radius: 6px;
}
.product-title {
    display: none; /* title now in header */
}
.product-description {
    color: var(--muted);
    margin-bottom: 12px;
    font-size: 13px;
    line-height: 1.45;
    flex: 1;
}
.product-bottom {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.product-brand {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
    font-size: 13px;
}
.product-rating {
    margin-bottom: 10px;
    font-size: 13px;
}
.stars {
    color: #ffd700;
    font-size: 14px;
    margin-right: 6px;
}
.product-price {
    font-size: 14px;
    /* keep price inside the bottom block, don't auto push itself
       because .product-bottom already anchors to card bottom */
    margin-top: 0;
}
.original-price {
    text-decoration: line-through;
    color: var(--price-original);
    margin-right: 10px;
    font-size: 13px;
}
.discounted-price {
    font-weight: 800;
    color: var(--price-discount);
    font-size: 15px;
}
.discount-barometer {
    height: 8px;
    width: 100%;
    margin-top: 4px;
    border-radius: 4px;
    border: 1px solid var(--outline-gold);
    transition: all 0.3s ease;
}
/* bottom decorative thumbnails removed (not functionally necessary) */
@media (max-width: 1100px) {
    .product-grid { grid-template-columns: repeat(2, 1fr); }
}
/* Default: compact controls hidden on desktop; mobile media query below will show them */
.compact-controls { display: none; }

@media (max-width: 760px) {
    .container { padding: 14px; }
    .product-grid { grid-template-columns: 1fr; gap: 18px; }
    .product-image { width: 140px; height: 140px; }
    .thumbnail { width: 60px; height: 60px; }
    .card-header { font-size: 20px; padding: 16px; }
    .controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        justify-content: center;
    }
    .lang-switch, .sort-options {
        justify-content: center;
    }
    /* Mobile: hide full sort links and lang select, show compact toggles */
    .sort-options { display: none; }
    .lang-select { display: none; }
    /* Show lang-toggle on mobile */
    #lang-toggle { display: inline-flex; }
    /* Make title-wrap stack vertically so the compact controls can flow under the title */
    .title-wrap { flex-direction: column; align-items: center; }

    /* On mobile show the compact controls (flowing under the title) */
    .compact-controls { display: flex; gap: 8px; align-items: center; margin-top: 8px; position: static; }
}

/* Title outline + confetti styles */
.title-wrap {
    position: relative;
    display: flex; /* use flex for robust vertical centering */
    align-items: center;
    justify-content: center;
    width: 520px;
    min-height: 48px; /* smaller header height */
    margin: 0;
    /* ensure title doesn't grow under the left/right controls */
    margin-left: 64px; /* reduced side gaps */
    margin-right: 64px; /* reduced side gaps */
    padding: 6px 12px;
    text-align: center;
    pointer-events: auto;
    flex: 0 0 auto;
}

@media (max-width: 640px) {
    .title-wrap {
        margin-left: 36px;
        margin-right: 36px;
        padding: 6px 12px;
        width: calc(100vw - 72px);
        height: 36px; /* Reduced for compact mobile header */
    }
    .title-text {
        font-size: 20px; /* smaller on mobile */
        padding: 4px 8px; /* smaller padding */
    }
    .theme-toggle {
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
    }
    .lang-select {
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
    }
}
.sticky-bar {
    position: sticky;
    top: 0;
    z-index: 1100;
    background: var(--bg);
    padding: 6px 0 8px 0;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.title-text {
    position: relative; /* flow within flex container */
    z-index: 3;
    margin: 0;
    display: inline-block;
    padding: 12px 24px;
    font-size: 36px;
    color: var(--text);
    font-weight: 800;
    letter-spacing: 1.2px;
    background: transparent;
    border-radius: 10px;
    text-shadow: 0 1px 0 rgba(255,255,255,0.75), 0 6px 18px rgba(18,38,63,0.08);
    font-weight: 700;
    letter-spacing: 0.6px;
    white-space: nowrap;
}

/* Sticky header containing title + controls so they stay on top */
.sticky-bar {
    position: sticky;
    top: 0;
    z-index: 100; /* Temporarily reduced to allow cookie manager to appear on top */
    background: var(--bg);
    padding: 8px 0 4px 0; /* Reduced padding */
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.lang-select {
    position: absolute;
    right: 18px;
    top: 50%; /* vertically center relative to .title-wrap */
    transform: translateY(-50%);
    padding: 4px 6px; /* Much smaller padding */
    border-radius: 4px;
    border: none;
    background: var(--outline-gold);
    color: var(--text);
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(212,175,55,0.15);
    cursor: pointer;
    font-size: 12px;
    -webkit-appearance: none;
    appearance: none;
    min-width: 45px;
    min-height: 28px;
    touch-action: manipulation; /* Prevent zoom on double-tap */
    text-align: center;
}

/* Lang toggle: show by default (mobile-first). Hide on wide screens via media query below */
#lang-toggle {
    display: inline-flex;
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    padding: 4px 6px;
    border-radius: 4px;
    border: none;
    background: var(--outline-gold);
    color: var(--text);
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(212,175,55,0.15);
    cursor: pointer;
    font-size: 12px;
    min-width: 45px;
    min-height: 28px;
    touch-action: manipulation;
    z-index: 1410; /* ensure it's above title-outline/confetti */
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Hide the compact lang toggle on desktop (non-mobile) */
@media (min-width: 761px) {
    #lang-toggle { display: none !important; }
}

/* Compact buttons used on mobile for quick toggles */
.compact-controls {
    /* Default: gap only; visibility controlled by default/mobile rules above */
    gap: 8px;
}

:root.dark .lang-select {
    color: #000 !important; /* compact/desktop language selector should also use black text in dark mode */
}
.compact-controls .lang-toggle,
.compact-controls .sort-toggle {
    background: var(--outline-gold);
    color: var(--text);
    border: none;
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 6px 14px rgba(212,175,55,0.12);
    cursor: pointer;
    min-width: 44px;
}
.compact-controls .lang-toggle[aria-pressed="true"],
.compact-controls .sort-toggle[aria-pressed="true"] {
    background: var(--accent);
    color: #fff;
}

:root.dark .lang-select {
    color: #1a1a1a !important; /* Dark text for contrast against gold background in dark mode */
}

:root.dark #lang-toggle {
    color: #000 !important;
}

/* Force dark text for compact sort buttons in dark mode for contrast */
:root.dark .compact-controls .sort-toggle,
:root.dark .compact-controls .sort-toggle[aria-pressed="true"] {
    color: #000 !important;
}

@media (max-width: 640px) {
    .lang-select {
        padding: 6px 8px; /* Smaller padding for mobile */
        min-height: 32px; /* Adequate touch target for mobile */
        font-size: 14px; /* Appropriate size for mobile readability */
    }
}
.title-outline {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    overflow: visible;
}
.title-outline rect {
    stroke: var(--outline-gold);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    width: 100%;
    height: 100%;
    x: 1;
    y: 3;
    rx: 6;
    ry: 6;
    filter: drop-shadow(0 6px 8px rgba(212,175,55,0.18));
    transition: stroke 220ms ease;
    animation: draw-outline 4s linear infinite;
}
@keyframes draw-outline {
    0% { stroke-dashoffset: 400; opacity: 0.0 }
    10% { opacity: 1 }
    50% { stroke-dashoffset: 0 }
    80% { opacity: 1 }
    100% { stroke-dashoffset: -400; opacity: 0 }
}

/* place confetti above the title so it's not visually occluded */
.confetti-container { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.confetti {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #fff4d6, var(--outline-gold) 40%, var(--outline-gold) 100%);
    box-shadow: 0 0 10px rgba(212,175,55,0.9);
    transform-origin: center;
    will-change: transform, opacity;
    animation: confetti-fall 1200ms cubic-bezier(.22,.9,.36,1) forwards;
    opacity: 0;
}
@keyframes confetti-fall {
    0% { transform: translateY(-6px) scale(0.6) rotate(0deg); opacity: 0 }
    10% { opacity: 1 }
    60% { transform: translateY(36px) scale(1) rotate(200deg); opacity: 1 }
    100% { transform: translateY(80px) scale(0.8) rotate(380deg); opacity: 0 }
}

/* Small sparkles */
.sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #fff8e6;
    box-shadow: 0 0 12px rgba(255,230,120,0.95);
    animation: sparkle-pop 900ms ease-out forwards;
    opacity: 0;
}
@keyframes sparkle-pop {
    0% { transform: scale(0.4); opacity: 0 }
    30% { opacity: 1; transform: scale(1.1) }
    100% { transform: scale(0.8); opacity: 0 }
}

/* Lightbox styles */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4,8,12,0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 24px;
}
.lightbox-content {
    max-width: 920px;
    width: 100%;
    background: transparent;
    position: relative;
    border-radius: 10px;
    outline: none;
}
.lightbox-body { text-align: center; }
.lightbox-img { max-width: 100%; max-height: 72vh; border-radius: 12px; box-shadow: 0 18px 50px rgba(0,0,0,0.5); }
.lightbox-close { position: absolute; right: -8px; top: -8px; background: rgba(255,255,255,0.08); border: none; color: #fff; font-size: 20px; padding: 8px 10px; border-radius: 999px; cursor: pointer; }
.lightbox-thumbs { margin-top: 12px; display:flex; gap:8px; justify-content:center; overflow:auto; }
.lightbox-thumb { width:56px; height:56px; object-fit:cover; border-radius:6px; cursor:pointer; opacity:0.85; border:2px solid transparent; }
.lightbox-thumb.active { border-color: rgba(255,255,255,0.9); opacity:1; }

/* Cookie consent manager style overrides to match page theme */
#silktide-wrapper {
    --fontFamily: 'Georgia', Arial, sans-serif;
    --primaryColor: var(--accent);
    --backgroundColor: var(--card-bg);
    --textColor: var(--text);
    --cookieIconColor: var(--accent);
    --cookieIconBackgroundColor: var(--card-bg);
}

/* Enhanced cookie banner styling for better visibility */
#silktide-banner {
    border: 3px solid var(--outline-gold) !important;
    box-shadow: 0 20px 60px rgba(212,175,55,0.3), 0 8px 32px rgba(0,0,0,0.2) !important;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95) !important;
}

:root.dark #silktide-banner {
    background: rgba(12, 17, 22, 0.95) !important;
}

/* Enhanced modal styling */
#silktide-modal {
    border: 3px solid var(--outline-gold) !important;
    box-shadow: 0 25px 80px rgba(212,175,55,0.4), 0 12px 40px rgba(0,0,0,0.3) !important;
    -webkit-backdrop-filter: blur(15px);
    backdrop-filter: blur(15px);
    background: rgba(255, 255, 255, 0.98) !important;
    max-height: 90vh !important; /* Ensure modal fits on mobile */
    overflow-y: auto !important;
}

:root.dark #silktide-modal {
    background: rgba(12, 17, 22, 0.98) !important;
}

/* Mobile modal adjustments */
@media (max-width: 640px) {
    #silktide-modal {
        margin: 10px !important;
        max-height: calc(100vh - 20px) !important;
        padding: 20px !important;
    }

    #silktide-modal header {
        margin-bottom: 15px !important;
    }

    #silktide-modal .modal-close {
        padding: 12px 18px !important; /* Larger touch target */
        font-size: 16px !important;
        min-height: 44px !important; /* iOS minimum touch target */
    }

    #silktide-modal footer {
        flex-direction: column !important;
        gap: 12px !important;
    }

    #silktide-modal footer .st-button {
        width: 100% !important; /* Full width buttons on mobile */
        min-height: 44px !important;
    }
}

/* Golden switch styling */
#silktide-modal .switch__pill {
    background: var(--muted) !important;
    border: 2px solid var(--outline-gold) !important;
}

#silktide-modal .switch input:checked + .switch__pill {
    background: var(--outline-gold) !important;
    border-color: var(--outline-gold) !important;
}

#silktide-modal .switch__dot {
    background: var(--card-bg) !important;
    border: 1px solid var(--outline-gold) !important;
}

#silktide-modal .switch__on,
#silktide-modal .switch__off {
    color: var(--text) !important;
    font-weight: 600 !important;
}

:root.dark #silktide-modal .switch input:checked ~ .switch__on {
    color: #000000 !important;
}

:root.dark #silktide-modal .switch__off {
    color: var(--text) !important;
}

/* Enhanced button styling */
#silktide-wrapper .st-button {
    border: 2px solid var(--outline-gold) !important;
    box-shadow: 0 4px 12px rgba(212,175,55,0.2) !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
}

#silktide-wrapper .st-button:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(212,175,55,0.3) !important;
}

#silktide-wrapper .st-button--primary {
    background: var(--outline-gold) !important;
    color: var(--text) !important;
}

:root.dark #silktide-wrapper .st-button--primary {
    color: #000000 !important;
}

#silktide-wrapper .st-button--primary:hover {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
}

#silktide-wrapper .st-button--secondary {
    background: transparent !important;
    color: var(--outline-gold) !important;
}

#silktide-wrapper .st-button--secondary:hover {
    background: var(--outline-gold) !important;
    color: var(--text) !important;
}

:root.dark #silktide-wrapper .st-button--secondary:hover {
    color: #000000 !important;
}

/* Enhanced cookie icon */
#silktide-cookie-icon {
    box-shadow: 0 8px 24px rgba(212,175,55,0.4), 0 4px 12px rgba(0,0,0,0.2) !important;
    border: 2px solid var(--outline-gold) !important;
    transition: all 0.3s ease !important;
    /* Position in bottom left corner */
    bottom: 10px !important;
    left: 10px !important;
    top: auto !important;
    right: auto !important;
    /* Ensure highest z-index */
    z-index: 100000 !important;
    /* Original size */
    width: 60px !important;
    height: 60px !important;
}

#silktide-cookie-icon:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 12px 32px rgba(212,175,55,0.5), 0 6px 16px rgba(0,0,0,0.3) !important;
}

/* Ensure cookie banner and modal are immediately visible (override animation delays) */
#silktide-banner {
    opacity: 1 !important;
    transform: translate(0, 0) !important;
    animation: none !important;
}

#silktide-modal {
    opacity: 1 !important;
    transform: translate(0px, 0px) !important;
    animation: none !important;
}