/* ==========================================================================
   Sharp Vision Export - Responsive & Device Optimization Stylesheet
   Mobile-First Architecture for Mobile, Tablet, iPad, Laptop, & Large Screens
   ========================================================================== */

/* 1. Viewport & Universal Box-Sizing (Guarantees No Horizontal Scroll) */
html {
    box-sizing: border-box;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    overflow-x: hidden;
    scroll-behavior: smooth;
    max-width: 100vw;
}

*, *::before, *::after {
    box-sizing: inherit;
}

body {
    overflow-x: hidden;
    max-width: 100vw;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 2. Fluid, Flexible Images & Media (Sharpness & Anti-Blur Optimization) */
img, picture, video, canvas, svg {
    max-width: 100%;
    height: auto;
    display: block;
    image-rendering: auto;
    image-rendering: -webkit-optimize-contrast;
    -ms-interpolation-mode: bicubic;
}

.img-zoom-container {
    overflow: hidden;
    position: relative;
    width: 100%;
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.img-zoom-container img,
.product-card img,
.product-item img,
.lookbook-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    image-rendering: auto;
    image-rendering: -webkit-optimize-contrast;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translate3d(0, 0, 0);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), filter 0.3s ease;
}

@media (hover: hover) and (pointer: fine) {
    .img-zoom-container:hover img {
        transform: scale(1.04) translate3d(0, 0, 0);
    }
}

/* 3. Touch Targets & Mobile UI Enhancements */
button, 
a, 
input, 
select, 
textarea, 
.nav-box, 
.category-filter {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Ensure inputs are >= 16px on mobile to prevent iOS Safari auto-zoom */
@media (max-width: 767px) {
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* Accessible Tap Targets */
.tap-target, 
.btn-primary, 
.btn-outline,
.category-filter,
.nav-box {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* 4. Scrollbar Refinements */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #faf9f6;
}
::-webkit-scrollbar-thumb {
    background: #8c857b;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #2d2a26;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

/* 5. Fluid Responsive Typography */
.hero-title {
    font-size: clamp(2.1rem, 5.5vw + 1rem, 4.25rem);
    line-height: 1.12;
}

.section-title {
    font-size: clamp(1.75rem, 3.5vw + 0.5rem, 3rem);
    line-height: 1.2;
}

.section-subtitle {
    font-size: clamp(0.95rem, 1.2vw + 0.5rem, 1.15rem);
}

/* 6. Responsive Breakpoint Media Queries */

/* --- MOBILE PHONES (< 480px, Portrait) --- */
@media (max-width: 479px) {
    /* Container paddings */
    .responsive-container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    /* Hero section visual positioning */
    .hero-showcase-wrapper {
        padding: 0 0.5rem;
    }
    .hero-floating-card {
        width: 140px !important;
        left: 0.5rem !important;
        bottom: -1rem !important;
    }
    .hero-badge-circle {
        width: 75px !important;
        height: 75px !important;
        top: 0.5rem !important;
        right: 0.5rem !important;
    }

    /* Product and Category Grids convert into clean 1 or 2 columns */
    .mobile-single-col {
        grid-template-columns: 1fr !important;
    }
    .mobile-double-col {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 0.75rem !important;
    }

    /* Touch Lightbox for small phones */
    #lightbox-img {
        max-height: 65vh !important;
    }
    #lightbox-modal {
        padding: 0.75rem !important;
    }

    /* Social Bar on mobile: compact and discreet */
    #social-bar {
        right: 0.5rem !important;
        gap: 0.5rem !important;
        transform: translateY(-50%) scale(0.9);
        transform-origin: right center;
    }
    #social-bar a {
        width: 38px !important;
        height: 38px !important;
    }
}

/* --- LARGE PHONES & SMALL TABLETS (480px - 767px) --- */
@media (min-width: 480px) and (max-width: 767px) {
    .responsive-container {
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
    }

    .hero-floating-card {
        width: 170px !important;
        left: 0.5rem !important;
        bottom: -1.25rem !important;
    }

    #social-bar {
        right: 0.75rem !important;
    }
}

/* --- TABLETS & iPADS (768px - 1023px, Portrait/Landscape) --- */
@media (min-width: 768px) and (max-width: 1023px) {
    .responsive-container {
        padding-left: 2.5rem !important;
        padding-right: 2.5rem !important;
    }

    .hero-floating-card {
        width: 200px !important;
        left: -1rem !important;
        bottom: -1.5rem !important;
    }

    .tablet-2-col {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
    .tablet-3-col {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

/* --- LAPTOPS & DESKTOPS (1024px - 1439px) --- */
@media (min-width: 1024px) {
    .responsive-container {
        padding-left: 3.5rem !important;
        padding-right: 3.5rem !important;
    }

    .hero-floating-card {
        width: 220px !important;
        left: -2rem !important;
        bottom: -1.5rem !important;
    }
}

/* --- LARGE DESKTOPS & ULTRA-WIDE (1440px+) --- */
@media (min-width: 1440px) {
    .responsive-container {
        max-width: 1400px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
}

/* 7. Rich Interactive Product Detail Modal & High-Res Lightbox */
#product-detail-modal {
    transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    -webkit-overflow-scrolling: touch;
}

#modal-product-card {
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.28s ease;
    will-change: transform;
}

#modal-p-img {
    image-rendering: auto;
    image-rendering: -webkit-optimize-contrast;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
    touch-action: manipulation;
}

/* Custom Scrollbar for Modal Specification Pane */
.custom-modal-scrollbar::-webkit-scrollbar {
    width: 5px;
}
.custom-modal-scrollbar::-webkit-scrollbar-track {
    background: #f0ebe1;
}
.custom-modal-scrollbar::-webkit-scrollbar-thumb {
    background: #8c857b;
    border-radius: 4px;
}
.custom-modal-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #2d2a26;
}

/* Lightbox Legacy Fallback */
#lightbox-modal {
    transition: opacity 0.3s ease;
}
#lightbox-modal.flex {
    display: flex;
}
#lightbox-img {
    touch-action: pinch-zoom;
    max-width: 95vw;
    image-rendering: auto;
    image-rendering: -webkit-optimize-contrast;
}

/* ==========================================================================
   8. Device View Switcher & Smartphone Preview Simulator
   ========================================================================== */

/* Navbar Device Toggle Pill */
.device-switcher-pill {
    display: inline-flex;
    align-items: center;
    background: rgba(240, 235, 225, 0.85);
    border: 1px solid rgba(45, 42, 38, 0.15);
    border-radius: 9999px;
    padding: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.25s ease;
    user-select: none;
}

.device-switcher-pill button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 9px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9999px;
    border: none;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    color: #8c857b;
    background: transparent;
    line-height: 1;
}

.device-switcher-pill button:hover {
    color: #2d2a26;
}

.device-switcher-pill button.active {
    background: #2d2a26;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(45, 42, 38, 0.2);
}

/* When viewed inside the simulator iframe, hide the switcher to prevent recursion */
body.in-device-simulator .device-switcher-pill,
body.in-device-simulator #device-preview-stage {
    display: none !important;
}

/* Smartphone Preview Stage (Simulator Overlay) */
#device-preview-stage {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(18, 16, 14, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 10px 16px 20px 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

#device-preview-stage.active {
    opacity: 1;
    pointer-events: auto;
}

/* Top Simulator Control Bar */
.preview-stage-toolbar {
    width: 100%;
    max-width: 600px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 14px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 9999px;
    backdrop-filter: blur(8px);
    color: #ffffff;
    flex-shrink: 0;
}

/* Realistic Smartphone Frame */
.smartphone-frame {
    position: relative;
    width: 390px;
    height: min(844px, calc(100vh - 80px));
    background: #1f1d1a;
    border: 11px solid #2d2a26;
    border-radius: 50px;
    box-shadow: 
        0 25px 70px -15px rgba(0, 0, 0, 0.8),
        0 0 0 1px rgba(255, 255, 255, 0.15),
        inset 0 0 0 2px rgba(255, 255, 255, 0.08);
    overflow: hidden;
    transform: scale(0.93) translateY(14px);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
}

#device-preview-stage.active .smartphone-frame {
    transform: scale(1) translateY(0);
}

/* Dynamic Island / Top Camera Pill */
.phone-dynamic-island {
    position: absolute;
    top: 9px;
    left: 50%;
    transform: translateX(-50%);
    width: 96px;
    height: 22px;
    background: #000000;
    border-radius: 20px;
    z-index: 100;
    pointer-events: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 9px;
}

.phone-camera-lens {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #141724;
    border: 1px solid #2b2f3e;
}

/* Bottom Home Indicator */
.phone-home-indicator {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 115px;
    height: 4px;
    background: rgba(255, 255, 255, 0.65);
    border-radius: 9999px;
    z-index: 100;
    pointer-events: none;
}

/* Smartphone Iframe Screen */
.smartphone-screen {
    width: 100%;
    height: 100%;
    border: none;
    background: #faf9f6;
    border-radius: 39px;
}

/* ==========================================================================
   9. Dark / Light Mode Theme System
   ========================================================================== */

/* Global Smooth Theme Transitions */
html, body, nav, header, section, footer, div, span, h1, h2, h3, h4, p, a, button, input, select, textarea {
    transition: background-color 0.35s ease, color 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

/* Theme Toggle Button */
.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 9999px;
    background: rgba(45, 42, 38, 0.06);
    border: 1px solid rgba(45, 42, 38, 0.15);
    color: #2d2a26;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
    padding: 0;
    flex-shrink: 0;
    user-select: none;
}

.theme-toggle-btn:hover {
    background: rgba(45, 42, 38, 0.14);
    transform: scale(1.05);
}

/* Icons state in Light Mode */
.theme-icon-sun {
    display: none;
}
.theme-icon-moon {
    display: block;
}

/* --- DARK MODE RULES (html.dark) --- */
html.dark {
    color-scheme: dark;
}

html.dark body {
    background-color: #161412 !important;
    color: #f5f2eb !important;
}

html.dark nav#navbar {
    background-color: rgba(22, 20, 18, 0.96) !important;
    border-bottom-color: rgba(255, 255, 255, 0.1) !important;
    color: #f5f2eb !important;
}

html.dark #navbar.scrolled {
    background-color: rgba(22, 20, 18, 0.98) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

html.dark .nav-box {
    background-color: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
    color: #f5f2eb !important;
}
html.dark .nav-box:hover,
html.dark .nav-box.active {
    background-color: #dcb996 !important;
    color: #161412 !important;
    border-color: #dcb996 !important;
}

html.dark .theme-toggle-btn {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: #f5f2eb !important;
}
html.dark .theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.18) !important;
}

html.dark .theme-icon-sun {
    display: block !important;
    color: #fbbf24 !important; /* warm sun gold */
}
html.dark .theme-icon-moon {
    display: none !important;
}

/* Dark Mode Backgrounds */
html.dark .bg-sv-bg {
    background-color: #161412 !important;
}
html.dark .bg-sv-light,
html.dark .bg-\[\#ede8df\],
html.dark .bg-\[\#f0ebe1\],
html.dark .bg-\[\#f5f0e8\] {
    background-color: #1e1b18 !important;
}
html.dark .bg-white {
    background-color: #24201c !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Dark Mode Text Colors */
html.dark .text-sv-charcoal,
html.dark .text-\[\#2d2a26\] {
    color: #f5f2eb !important;
}
html.dark .text-sv-muted,
html.dark .text-\[\#8c857b\] {
    color: #a69f94 !important;
}
html.dark .text-gray-500,
html.dark .text-gray-600 {
    color: #b0a99e !important;
}

/* Dark Mode Cards & Borders */
html.dark .product-card,
html.dark .product-item,
html.dark .lookbook-item,
html.dark .testimonial-card,
html.dark .review-card,
html.dark .border-black\/5,
html.dark .border-black\/10,
html.dark .border-gray-100,
html.dark .border-gray-200 {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Dark Mode Hero Gradients */
html.dark header.bg-gradient-to-b {
    background: linear-gradient(180deg, #221e1a 0%, #161412 100%) !important;
}

/* Dark Mode Search & Filter Bar */
html.dark #search-filter-section,
html.dark .search-filter-bar {
    background-color: rgba(22, 20, 18, 0.95) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
}
html.dark .search-input {
    background-color: #24201c !important;
    color: #f5f2eb !important;
    border-color: rgba(255, 255, 255, 0.16) !important;
}
html.dark .search-input::placeholder {
    color: #8c857b !important;
}
html.dark .category-filter-btn {
    background-color: rgba(255, 255, 255, 0.06) !important;
    color: #a69f94 !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
}
html.dark .category-filter-btn.active,
html.dark .category-filter-btn:hover {
    background-color: #dcb996 !important;
    color: #161412 !important;
    border-color: #dcb996 !important;
}

/* Dark Mode Product Modal */
html.dark #modal-product-card {
    background-color: #1e1b18 !important;
    color: #f5f2eb !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
}
html.dark #modal-product-card .bg-gradient-to-br {
    background: linear-gradient(135deg, #28231f 0%, #1c1815 100%) !important;
}
html.dark #modal-product-card .bg-white {
    background-color: #24201c !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Dark Mode Device Switcher Pill */
html.dark .device-switcher-pill {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}
html.dark .device-switcher-pill button {
    color: #a69f94 !important;
}
html.dark .device-switcher-pill button.active {
    background: #dcb996 !important;
    color: #161412 !important;
}

/* Dark Mode Mobile Drawer Menu */
html.dark #mobile-menu {
    background-color: rgba(22, 20, 18, 0.98) !important;
    color: #f5f2eb !important;
    border-left: 1px solid rgba(255, 255, 255, 0.1) !important;
}
html.dark #mobile-menu-backdrop {
    background-color: rgba(0, 0, 0, 0.75) !important;
}
html.dark .mobile-nav-link:hover {
    background-color: rgba(255, 255, 255, 0.08) !important;
}

/* ==========================================================================
   9. Mobile & Tablet Navigation Drawer & Header Responsiveness Fixes
   ========================================================================== */

/* Header Flexibility */
nav#navbar {
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box;
}

/* Mobile Drawer & Backdrop */
#mobile-menu-backdrop {
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 99;
}

#mobile-menu {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 100;
    box-shadow: -6px 0 28px rgba(0, 0, 0, 0.22);
    -webkit-overflow-scrolling: touch;
}

/* On Mobile & Tablet Screens (< 1024px) */
@media (max-width: 1023px) {
    /* Hide desktop device switcher pill to avoid header overcrowding */
    .device-switcher-pill {
        display: none !important;
    }

    /* Modern Hamburger Button Visible */
    #mobile-menu-btn {
        display: flex !important;
        flex-shrink: 0 !important;
    }

    /* Flexible Header Logo & Title */
    nav#navbar a[href="index.html"] {
        min-width: 0 !important;
        flex-shrink: 1 !important;
    }

    nav#navbar a[href="index.html"] span {
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Container padding on mobile & tablet */
    .responsive-header-padding {
        padding-left: clamp(12px, 3.5vw, 24px) !important;
        padding-right: clamp(12px, 3.5vw, 24px) !important;
    }
}

/* Desktop Screens (>= 1024px) */
@media (min-width: 1024px) {
    #mobile-menu-btn,
    #mobile-menu,
    #mobile-menu-backdrop {
        display: none !important;
    }
}

/* ==========================================================================
   10. Mobile Catalog & Grid Alignment Fixes (< 768px)
   ========================================================================== */
@media (max-width: 768px) {
    /* Prevent any card clipping or horizontal page blowout */
    html, body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        width: 100% !important;
    }

    /* Fluid Grids with minmax(0, 1fr) */
    .grid {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Product Cards & Highlights */
    .product-card,
    .product-item,
    .lookbook-item,
    .category-card {
        min-width: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box;
    }

    /* Prevent text overflowing cards */
    .product-card h3,
    .product-item h3,
    .category-card h3 {
        word-break: break-word;
        overflow-wrap: break-word;
    }

    /* Image zoom container bounds */
    .img-zoom-container {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Section padding on mobile phones */
    section {
        padding-left: clamp(12px, 4vw, 24px) !important;
        padding-right: clamp(12px, 4vw, 24px) !important;
    }

    /* Compact Social Bar on Mobile so it doesn't block card clicks */
    #social-bar {
        right: 6px !important;
        gap: 6px !important;
        transform: translateY(-50%) scale(0.85);
        transform-origin: right center;
    }
    #social-bar a {
        width: 38px !important;
        height: 38px !important;
    }
}



