/* assets/styles/shop.css */

/* Shop Container (Archive View) */
/* Shop Container (Archive View) - Wide Mode Unification */
.shop-container {
    width: 100%;
    max-width: none;
    /* Remove constraint */
    padding: 80px 40px;
    /* Match Archive Header/Padding */
    margin: 0;
    position: relative;
    z-index: 20;
    /* Glassmorphism to match Archive Container */
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    min-height: 100vh;
}

@media (max-width: 768px) {
    .shop-container {
        padding: 80px 16px;
        /* px-4 equivalent */
    }
}

/* Screen Title */
.shop-header {
    margin-bottom: var(--space-lg);
    border-bottom: 2px solid var(--text-color);
    padding-bottom: var(--space-sm);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.shop-title {
    font-size: var(--text-xl);
    text-transform: uppercase;
    letter-spacing: -0.02em;
}

/* Product Grid (Card Layout) */
/* Mobile Constraints */
@media (max-width: 768px) {
    .product-list {
        gap: 1.5rem;
    }
}

/* Glass Product Card */
.glass-product-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
}

[data-theme="light"] .glass-product-card {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.glass-product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border-color: var(--text-color);
}

/* Image Container & Ratios */
.card-img-container {
    width: 100%;
    aspect-ratio: 1 / 1 !important;
    position: relative;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.1);
}

/* Aspect Ratio Modifiers */
.ratio-poster .card-img-container {
    aspect-ratio: 4/5;
}

.ratio-square .card-img-container {
    aspect-ratio: 1/1;
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.glass-product-card:hover .card-img {
    transform: scale(1.05);
}

/* Security Protection Layer */
.protection-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    /* Let clicks pass through to card */

    /* Noise / Grain Effect */
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.08'/%3E%3C/svg%3E");
    opacity: 0.6;
    mix-blend-mode: overlay;
}

/* View Toggle (Glass Pill) */
.view-toggle-container {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
    /* Dark mode tint */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    padding: 6px 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .view-toggle-container {
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Base Button Style */
.view-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    /* Touch target */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.4;
    transition: all 0.3s ease;
    border-radius: 50%;
    /* Hover circle */
}

.view-btn:hover {
    opacity: 0.8;
    background: rgba(255, 255, 255, 0.05);
}

.view-btn.active {
    opacity: 1;
    transform: scale(1.1);
}

/* Dots Styling */
.dot-icon,
.dot-group span {
    background-color: var(--text-color);
    border-radius: 50%;
    display: block;
}

/* --- SHOP CONTROLS & FILTERS --- */
.shop-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.shop-filters {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    /* Enable horizontal scroll on mobile */
    padding-bottom: 5px;
    /* Space for scrollbar if visible */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Hide scrollbar Firefox */
}

.shop-filters::-webkit-scrollbar {
    display: none;
    /* Hide scrollbar Chrome/Safari */
}

.filter-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    white-space: nowrap;
    /* Prevent line break */
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

.filter-btn.active {
    background: var(--text-color);
    border-color: var(--text-color);
    color: var(--bg-color);
    box-shadow: 0 0 15px rgba(125, 125, 125, 0.2);
    text-shadow: none;
    font-weight: 600;
}



/* Adjust View Toggle Container Alignment */
.view-toggle-container {
    margin-left: auto;
    /* Push to right if wrapped */
}

/* 1 Col: Big Dot */
.dot-icon.one {
    width: 10px;
    height: 10px;
}

/* Dot Groups (2, 3, 4) */
.dot-group {
    display: flex;
    gap: 3px;
    align-items: center;
}

.dot-group span {
    width: 6px;
    height: 6px;
}

/* 4 Cols: Grid of Dots */
.dot-group.four {
    width: 15px;
    /* constrain width to force wrap if needed, but flex gap handles it better with wrap */
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px;
}

.dot-group.four span {
    width: 5px;
    height: 5px;
}

/* Active Glow (Orange) */
.view-btn.active .dot-icon,
.view-btn.active .dot-group span {
    background-color: var(--fluid-color);
    /* Unified Orange */
    box-shadow: 0 0 8px var(--fluid-color), 0 0 4px var(--fluid-color);
}


[data-theme="light"] .view-btn.active .dot-icon,
[data-theme="light"] .view-btn.active .dot-group span {
    background-color: var(--color-deep-cyan);
    box-shadow: 0 0 8px var(--color-deep-cyan);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .view-btn.desktop-only {
        display: none;
    }

    .view-toggle-container {
        padding: 4px 12px;
        /* Slightly compact */
        gap: 8px;
    }

    .view-btn {
        padding: 10px;
        /* Ensure 44px+ touch target area if possible */
    }

    /* Hide 3 and 4 column options on mobile */
    .view-btn[data-cols="3"],
    .view-btn[data-cols="4"] {
        display: none;
    }
}

/* Card Info */
.card-info {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.card-title {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    text-transform: uppercase;
}

.card-price {
    font-size: 13px;
    color: var(--text-muted);
}

/* Add Button (Floating on valid card?) or simple text */
/* User requested "Click to Detail Modal". 
   Maybe a small Add button on the card for quick access? 
   Let's keep it clean for now, or add a corner button. */

.card-add-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.2s ease;
}

.glass-product-card:hover .card-add-btn {
    opacity: 1;
    transform: translateY(0);
}

/* Mobile: Always show Add button? Or just rely on Modal? 
   Let's always show it on mobile if needed, or keep hidden to encourage detail view.
   For now, hover-only is fine for desktop. Mobile tap opens modal. */

/* Shop Controls Layout */
.shop-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* Vertical center */
    margin-bottom: 24px;
    gap: var(--space-md);
    flex-wrap: wrap;
    /* Allow wrapping on small screens */
}

/* Filter Controls */
.shop-filters {
    display: flex;
    gap: 8px;
    /* Tighter gap */
    flex-wrap: wrap;
}

/* Scrollable Filters Mobile */
@media (max-width: 768px) {
    .shop-controls {
        flex-direction: column !important;
        /* Force stack */
        align-items: center !important;
        /* Center align */
        gap: 20px;
        /* More breathing room */
        width: 100%;
    }

    .shop-filters {
        width: 100%;
        justify-content: center;
        /* Center filters */
    }

    .shop-filters {
        overflow-x: auto;
        padding-bottom: 8px;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        justify-content: flex-start;
        /* Ensure scrolling start */
    }

    .shop-filters::-webkit-scrollbar {
        display: none;
    }

    .filter-btn {
        flex-shrink: 0;
    }

    /* Center toggle on mobile */
    .view-toggle-container {
        justify-content: center;
        max-width: 100%;
        margin: 0 auto;
    }
}

/* Dynamic Grid Columns (Override) - Deprecated, using Tailwind Utilities instead */

/* Modal Glass Card - Viewport Based Refactor */
.modal-content {
    background: var(--glass-container-bg);
    border: 1px solid var(--glass-border);
    box-shadow: 0 50px 100px -20px rgba(0, 0, 0, 0.8);
    border-radius: 12px;

    /* Viewport Constraint */
    width: 90vw;
    height: auto;
    /* Dynamic height based on content */
    max-height: 90vh;
    /* Cap at 90% viewport */
    max-width: 1400px;
    /* Cap ultra-wide */

    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    /* Master Scroll */
    display: block;
    /* Remove flex to allow native scroll */

    /* Custom Scrollbar for Modal */
    scrollbar-width: thin;
    scrollbar-color: var(--fluid-color) rgba(255, 255, 255, 0.05);
}


/* Custom Scrollbar Styling (Webkit) */
.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.modal-content::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background-color: var(--fluid-color);
}

.modal-close {
    position: absolute;
    top: 25px;
    right: 30px;
    background: rgba(0, 0, 0, 0.5);
    /* Visibility on images */
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    z-index: 100;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--fluid-color);
    color: #fff;
    transform: rotate(90deg);
}


.modal-body {
    width: 100%;
    /* Scroll handled by .modal-content */
}

/* 3-SLOT GRID LAYOUT */
.modal-layout {
    display: grid;
    width: 100%;
    /* Desktop: 2 Cols (1.2 : 1), Row 1 Flexible (min 500px, max 60vh), Row 2 Auto */
    grid-template-columns: 1.2fr 1fr;
    grid-template-rows: minmax(500px, 60vh) auto;
    grid-template-areas:
        "image info"
        "details details";
    background: transparent;
}

/* Slot A: Main Image */
.slot-a {
    grid-area: image;
    background: rgba(0, 0, 0, 0.2);
    border-right: 1px solid var(--glass-border);
    border-bottom: 1px solid var(--glass-border);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    height: 100%;
    /* Fill grid cell */
}

.slot-a img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.6));
    max-height: 100%;
    /* Ensure it respects container */
}

/* Slot B: Info & Actions */
.slot-b {
    grid-area: info;
    padding: 40px 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-bottom: 1px solid var(--glass-border);
    height: 100%;
    /* Fill grid cell */
}

/* Typography Adjustments for Slot B */
.slot-b .modal-product-subtitle {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.slot-b .modal-product-title {
    font-size: 3rem;
    line-height: 1.1;
    font-weight: 400;
    color: var(--text-color);
    margin-top: 5px;
    margin-bottom: 15px;
}

.slot-b .modal-product-price {
    font-size: 1.8rem;
    color: var(--fluid-color);
    font-weight: 300;
    margin-top: 10px;
    margin-bottom: 30px;
}

/* Slot C: Details Flow (Full Width) */
.slot-c {
    grid-area: details;
    padding: 50px;
    display: flex;
    flex-direction: column;
    gap: 40px;
    max-width: 900px;
    margin: 0 auto;
    /* Center content in wide detail area */
    width: 100%;
    height: auto;
    /* Allow growth */
    overflow: visible;
    /* Let parent scroll */
}

/* Actions */
.modal-actions {
    margin-top: 10px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--glass-border);
}

.modal-cta-btn {
    width: 100%;
    padding: 18px;
    background: var(--text-color);
    color: var(--bg-color);
    border: none;
    font-size: 1rem;
    text-transform: uppercase;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    letter-spacing: 1px;
}

.modal-cta-btn:hover {
    background: var(--fluid-color);
    color: #fff;
    box-shadow: 0 0 30px rgba(255, 85, 0, 0.3);
    transform: translateY(-2px);
}


.policy-note {
    margin-top: 15px;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.5;
    text-align: center;
}

/* Description Content & Images */
.desc-content {
    font-size: 14px;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.85);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.desc-content p {
    margin: 0;
}

/* Fix: Constrain Detailed Images in Description */
/* Fix: Expand Detailed Images in Description (Slot C) */
.desc-content img {
    width: 100%;
    /* Force full width */
    max-width: 100%;
    height: auto;
    /* Maintain aspect ratio */
    max-height: none;
    /* Remove previous height limit */

    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);

    display: block;
    margin: 30px 0;
    /* More spacing */
    padding: 20px;
    /* Internal breathing room */
    box-sizing: border-box;
    /* Include padding in width */
}

/* Specs Box */
.product-specs-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 20px;
    border-radius: 4px;
    margin-top: 10px;
}

.spec-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 12px;
    font-family: 'Courier New', monospace;
    color: var(--text-muted);
}

.spec-row:last-child {
    border-bottom: none;
}

.spec-row strong {
    color: var(--text-color);
}

/* --- MOBILE RESPONSIVE (Stack) --- */
@media (max-width: 900px) {
    .modal-content {
        width: 100vw;
        height: 100vh;
        max-width: none;
        max-height: none;
        border-radius: 0;
        border: none;
    }

    .modal-layout {
        flex-direction: column;
        overflow-y: auto;
        /* Whole layout scrolls on mobile */
    }

    /* Stack Order: Image First */
    .modal-left {
        flex: none;
        height: 45vh;
        /* Fixed height for image area */
        width: 100%;
        padding: 20px;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
        position: sticky;
        top: 0;
        z-index: 10;
        background: black;
        /* Solid bg to cover scroll */
    }

    .modal-hero-img {
        max-height: 100%;
        width: auto;
    }

    /* Info Area */
    .modal-right {
        flex: none;
        /* Let it grow naturally */
        overflow-y: visible;
        /* Scroll handled by parent */
        padding: 30px 24px;
        min-height: 60vh;
        /* Ensure enough scroll space */
        padding-bottom: 100px;
        /* Space for bottom nav/safe area */
    }

    .modal-product-title {
        font-size: 2rem;
    }

    .modal-close {
        top: 20px;
        right: 20px;
    }
}

.modal.fade-in {
    opacity: 1;
    pointer-events: auto;
}

.modal.hidden {
    display: none;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--space-md);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Buttons */
.modal-cta-btn {
    width: 100%;
    padding: 16px;
    background: var(--text-color);
    color: var(--bg-color);
    border: none;
    font-size: 14px;
    text-transform: uppercase;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 1px;
}

.modal-cta-btn:hover {
    background: var(--color-neon-lime);
    /* Brand highlight */
    color: #000;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.3);
}