/* assets/css/style.css - RESTORED PREMIUM DESIGN + FIXES */

/* =========================================
   1. VARIABLES & RESET
   ========================================= */
:root {
    /* Day Mode Palette */
    --bg-primary: #f8fafc;
    /* Ultra light gray/white */
    --bg-secondary: #ffffff;
    /* Pure white for cards */
    --accent: #3b82f6;
    /* Keep the blue brand color */
    --accent-hover: #2563eb;
    --text-primary: #0f172a;
    /* Dark slate for main text */
    --text-secondary: #64748b;
    /* Slate gray for secondary */
    --success: #16a34a;
    /* Green */
    --border: #e2e8f0;
    /* Light gray border */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

h1,
h2,
h3,
h4,
.logo {
    font-family: var(--font-heading);
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

img {
    display: block;
    max-width: 100%;
}

.container {
    max-width: 1200px;
    width: 95%;
    margin: 0 auto;
}

/* =========================================
   2. NAVBAR & NAVIGATION
   ========================================= */
.navbar {
    background: rgba(255, 255, 255, 0.85);
    /* Proper Glassmorphism */
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 1rem 0;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo i {
    color: var(--accent);
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
    align-items: center;
    margin: 0;
}

.nav-links a:hover {
    color: var(--accent);
}

/* Cart Icon Specifics */
.cart-icon {
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.badge-count {
    background: var(--accent);
    color: white;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 99px;
    font-weight: 700;
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border-radius: 99px;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    width: 300px;
}

.search-bar input {
    background: transparent;
    border: none;
    color: #333333;
    outline: none;
    flex: 1;
    font-size: 0.9rem;
}

.search-bar button {
    color: var(--text-secondary);
    cursor: pointer;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.hamburger {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-primary);
    padding: 0.5rem;
}

/* =========================================
   3. HERO SECTION
   ========================================= */
.hero-section {
    padding: 6rem 0 4rem;
    background: radial-gradient(circle at 50% 0%, rgba(59, 130, 246, 0.15), transparent 50%);
    text-align: center;
    margin-bottom: 2rem;
}

.hero-content h1 {
    font-size: 4rem;
    margin-bottom: 1rem;
    line-height: 1.1;
    font-weight: 800;
}

.text-gradient {
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-content p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 2rem;
}

.btn-hero {
    display: inline-block;
    background: var(--accent);
    color: white;
    padding: 0.875rem 2.5rem;
    border-radius: 99px;
    font-weight: 600;
    box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.5);
    transition: transform 0.2s, box-shadow 0.2s;
}

/* HERO CATEGORY NAV */
.hero-cat-nav {
    margin-top: 3rem;
    display: inline-block;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    padding: 0.5rem 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.cat-menu {
    list-style: none;
    display: flex;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
    position: relative;
}

.cat-item {
    position: relative;
}

.cat-link {
    display: block;
    padding: 0.5rem 1rem;
    font-weight: 600;
    color: var(--text-primary);
    border-radius: 6px;
    transition: all 0.2s;
    white-space: nowrap;
}

.cat-link:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent);
}

/* SUBMENU DROPDOWN */
.cat-submenu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: white;
    min-width: 200px;
    border-radius: 12px;
    list-style: none;
    padding: 0.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 100;
}

.cat-item.has-submenu:hover .cat-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(5px);
}

.cat-submenu li a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    border-radius: 6px;
    font-size: 0.95rem;
    text-align: left;
}

.cat-submenu li a:hover {
    background: var(--bg-primary);
    color: var(--accent);
}

/* Mobile: Hide nav or Stack? For now, hide on very small, but stack on tablets */
@media(max-width: 768px) {
    .hero-cat-nav {
        display: none;
    }

    /* Complex to make responsive menu in 1 shot, hiding for scope safety unless requested */
}

/* =========================================
   4. PRODUCT GRID
   ========================================= */
.section-title {
    margin-bottom: 2rem;
    font-size: 2rem;
    font-weight: 700;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2.5rem;
    margin-bottom: 4rem;
}

.grid-item {
    background: var(--bg-secondary);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.3s, border-color 0.3s;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.grid-item:hover {
    transform: translateY(-8px);
    border-color: var(--accent);
}

.item-image {
    background: #f1f5f9;
    height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.item-image img {
    transition: transform 0.5s;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.grid-item:hover .item-image img {
    transform: scale(1.05);
}

.item-info {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.item-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.item-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin-top: auto;
}

.item-financing {
    font-size: 0.85rem;
    color: var(--success);
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* =========================================
   5. PRODUCT PAGE
   ========================================= */
.product-page-container {
    padding-top: 2rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.back-link:hover {
    color: var(--accent);
}

.product-card {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    background: var(--bg-secondary);
    border-radius: 30px;
    overflow: hidden;
    border: 1px solid var(--border);
    margin-bottom: 4rem;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.2);
}

/* Product Gallery Layout */
.product-image-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 2rem 3rem;
    /* Increased side padding */
}

.main-image-container {
    height: 500px;
    background: #f1f5f9;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    cursor: crosshair;
    /* Indicates zoom capability */
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
}

.main-image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.1s ease-out;
    transform-origin: center center;
    pointer-events: none;
    /* Let mouse events pass to container */
}

/* Zoom Active State (Applied by JS) */
.main-image-container.zoomed img {
    transform: scale(2);
    /* Zoom Size */
}

.gallery-thumbnails {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.thumb-item {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    background: #f1f5f9;
    flex-shrink: 0;
}

.thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.7;
}

.thumb-item:hover,
.thumb-item.active {
    border-color: var(--accent);
}

.thumb-item:hover img,
.thumb-item.active img {
    opacity: 1;
}

/* Mobile responsive */
@media(max-width: 768px) {
    .main-image-container {
        height: 350px;
    }

    .main-image-container.zoomed img {
        transform: scale(1);
        /* Disable zoom on touch/mobile */
    }
}

.product-details {
    padding: 4rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.badge {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent);
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    width: fit-content;
    margin-bottom: 1rem;
}

.product-details h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    line-height: 1.1;
}

.description {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.price-main {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -1px;
}

.price-installment {
    color: var(--text-secondary);
    margin-top: 0.5rem;
    font-size: 1rem;
}

/* Installment Selector */
.installment-selector {
    margin-top: 2.5rem;
    background: rgba(15, 23, 42, 0.6);
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--border);
}

.selector-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.installment-option input {
    display: none;
}

.option-card {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    background: var(--bg-primary);
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.option-card:hover {
    border-color: var(--text-secondary);
}

.installment-option input:checked+.option-card {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.08);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.btn-checkout {
    margin-top: 1.5rem;
    width: 100%;
    padding: 1.25rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.btn-checkout:hover {
    background: var(--accent-hover);
}

.btn-checkout:active {
    transform: scale(0.98);
}

/* =========================================
   6. FOOTER
   ========================================= */
.site-footer {
    background: #f1f5f9;
    border-top: 1px solid var(--border);
    padding: 5rem 0 2rem;
    margin-top: auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 4rem;
    margin-bottom: 3rem;
}

.footer-col h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.footer-col h4 {
    font-size: 1rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li {
    margin-bottom: 0.75rem;
}

.footer-col ul li a {
    color: var(--text-secondary);
}

.footer-col ul li a:hover {
    color: var(--accent);
}

.footer-bottom {
    border-top: 1px solid #1e293b;
    padding-top: 2rem;
    text-align: center;
    color: #64748b;
    font-size: 0.9rem;
}

/* =========================================
   7. CART DRAWER (THE FIX)
   ========================================= */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 99998;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s, visibility 0.3s;
}

.cart-overlay.open {
    visibility: visible !important;
    /* Force visible */
    opacity: 1 !important;
}

.cart-drawer {
    position: fixed;
    top: 0;
    right: -450px;
    width: 400px;
    max-width: 90vw;
    height: 100vh;
    background: var(--bg-secondary);
    z-index: 99999;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border);
}

.cart-drawer.open,
.cart-drawer.force-visible {
    transform: translateX(-100%) !important;
    right: -400px;
    /* Reset */
    left: 100%;
    /* Anchor to right edge */
}

/* Drawer Internals */
.drawer-header {
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.5);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-header h2 {
    font-size: 1.25rem;
    margin: 0;
}

.close-cart {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.drawer-footer {
    padding: 1.5rem;
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
}

.cart-subtotal {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.btn-view-cart {
    display: block;
    width: 100%;
    padding: 1rem;
    background: white;
    color: black;
    text-align: center;
    border-radius: 8px;
    font-weight: 700;
}

.btn-view-cart:hover {
    background: #e2e8f0;
}

.cart-item {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #334155;
}

.cart-item-img {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    flex-shrink: 0;
}

.cart-item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-details {
    flex: 1;
}

.cart-item-title {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.cart-item-price {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.btn-remove {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    cursor: pointer;
    text-decoration: underline;
}

/* =========================================
   10. MOBILE & TABLET RESPONSIVE
   ========================================= */

@media(max-width: 900px) {

    /* Navbar & Header */
    .nav-container {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .logo {
        order: 1;
    }

    .nav-actions {
        order: 2;
        gap: 1rem;
        margin-left: auto;
        /* Push to right */
    }

    .search-bar {
        order: 3;
        width: 100%;
        margin: 0;
    }

    .hamburger {
        display: block;
    }

    .nav-links {
        display: none;
        width: 100%;
        order: 4;
        flex-direction: column;
        gap: 0;
        background: var(--bg-secondary);
        border-radius: 12px;
        margin-top: 1rem;
        border: 1px solid var(--border);
        overflow: hidden;
        animation: slideDown 0.3s ease-out;
    }

    .nav-links.mobile-open {
        display: flex;
    }

    .nav-links li {
        width: 100%;
    }

    .nav-links li a {
        display: block;
        padding: 1rem;
        border-bottom: 1px solid var(--border);
    }

    .nav-links li:last-child a {
        border-bottom: none;
    }

    /* Checkout */
    .checkout-grid {
        grid-template-columns: 1fr;
    }

    .checkout-summary {
        position: static;
        order: -1;
        margin-bottom: 2rem;
    }
}

@media(max-width: 768px) {
    .container {
        width: 92%;
    }

    /* Hero */
    .hero-section {
        padding: 3rem 0;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

    .btn-hero {
        width: 100%;
        text-align: center;
    }

    /* Product Grid */
    .product-grid {
        gap: 1.5rem;
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        /* Smaller min-width */
    }

    /* Product Details */
    .product-card {
        grid-template-columns: 1fr;
    }

    .main-image-container {
        height: 300px;
    }

    .product-details {
        padding: 1.5rem;
    }

    .price-main {
        font-size: 2.5rem;
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .cart-drawer {
        width: 100%;
        right: -100%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   8. PAGINATION
   ========================================= */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 3rem;
    margin-bottom: 2rem;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: white;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-weight: 600;
    transition: all 0.2s;
}

.page-link:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.page-link.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.page-link.disabled {
    opacity: 0.5;
    pointer-events: none;
    background: #f1f5f9;
}

/* =========================================
   9. CHECKOUT PAGE
   ========================================= */
.checkout-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 3rem;
    align-items: start;
}

.checkout-form {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 16px;
    border: 1px solid var(--border);
}

.section-title-sm {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed var(--border);
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.input-field {
    width: 100%;
    padding: 0.875rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-primary);
    font-size: 1rem;
    color: var(--text-primary);
    transition: all 0.2s;
}

.input-field:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Radio Cards (Shipping/Payment) */
.radio-card {
    display: flex;
    align-items: flex-start;
    /* top align icon */
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 10px;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-primary);
    position: relative;
}

.radio-card input {
    position: absolute;
    opacity: 0;
}

.radio-card.selected,
.radio-card:has(input:checked) {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.05);
}

.radio-content {
    display: flex;
    gap: 1rem;
    width: 100%;
}

.radio-content .icon {
    font-size: 1.5rem;
    color: var(--text-secondary);
    padding-top: 2px;
}

.radio-card.selected .icon,
.radio-card:has(input:checked) .icon {
    color: var(--accent);
}

.radio-content p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Summary sticky */
.checkout-summary {
    position: sticky;
    top: 100px;
}

.summary-card {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.summary-card h3 {
    margin-bottom: 1.5rem;
}

.items-list {
    margin-bottom: 1.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.summary-total {
    display: flex;
    justify-content: space-between;
    margin-top: 1.5rem;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
}