@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;700&display=swap');

body {
    background: #f7f5f2 url('https://www.transparenttextures.com/patterns/cream-paper.png'); /* subtle paper texture */
    font-family: 'Georgia', serif;
    margin: 0;
}

header {
    background: #fff;
    box-shadow: 0 2px 12px rgba(180, 140, 100, 0.08);
    padding: 0 0 8px 0;
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 18px 24px 0 24px;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.home-link {
    color: #7a5c3e;
    text-decoration: none;
    font-size: 17px;
    font-family: 'Playfair Display', 'Georgia', serif;
    font-weight: bold;
    padding-bottom: 2px;
    border-bottom: 2px solid transparent;
    transition: border 0.2s;
}

.home-link:hover {
    border-bottom: 2px solid #b48c64;
}

.nav-logo {
    width: 70px;
    margin-right: 24px;
}

.nav-categories {
    list-style: none;
    display: flex;
    gap: 32px;
    margin: 0;
    padding: 0;
}

.nav-category {
    position: relative;
    font-size: 17px;
    color: #7a5c3e;
    cursor: pointer;
    font-family: 'Playfair Display', 'Georgia', serif;
    font-weight: bold;
    padding-bottom: 2px;
    border-bottom: 2px solid transparent;
    transition: border 0.2s;
}

.nav-category:hover, .nav-category.active {
    border-bottom: 2px solid #b48c64;
}

.nav-category:hover .nav-subcategories {
    display: block;
}

.nav-subcategories {
    display: none;
    position: absolute;
    left: 0;
    top: 28px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(180, 140, 100, 0.10);
    list-style: none;
    padding: 8px 0;
    min-width: 120px;
    z-index: 10;
}

.nav-subcategories li {
    padding: 8px 18px;
    color: #b48c64;
    font-size: 15px;
    cursor: pointer;
    font-family: 'Georgia', serif;
    transition: background 0.2s;
}

.nav-subcategories li:hover {
    background: #f7f5f2;
    color: #7a5c3e;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Hamburger Menu Button */
.hamburger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.hamburger-menu span {
    width: 100%;
    height: 3px;
    background: #7a5c3e;
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
}

.hamburger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Mobile Navigation */
.mobile-nav {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 85%;
    height: 100vh;
    max-height: 100vh;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    z-index: 1000;
    padding: 70px 15px 25px 15px;
    overflow-y: scroll;
    overflow-x: hidden;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    box-sizing: border-box;
}

.mobile-nav.active {
    transform: translateX(0);
}

.mobile-nav .nav-categories {
    flex-direction: column;
    gap: 0;
    margin-bottom: 20px;
}

.mobile-nav .nav-category {
    padding: 12px 0;
    border-bottom: 1px solid #f0e6dd;
    font-size: 17px;
}

.mobile-nav .nav-category:last-child {
    border-bottom: none;
}

.mobile-nav .nav-subcategories {
    position: static;
    display: block;
    box-shadow: none;
    background: #f9f7f4;
    border-radius: 6px;
    margin-top: 8px;
    padding: 8px 0;
    min-width: auto;
}

.mobile-nav .nav-subcategories li {
    padding: 6px 16px;
    font-size: 15px;
    border-bottom: 1px solid #f0e6dd;
}

.mobile-nav .nav-subcategories li:last-child {
    border-bottom: none;
}



/* Desktop Only Elements */
.desktop-only {
    display: block;
}

/* Desktop only - make categories horizontal */
@media (min-width: 769px) {
    .nav-categories {
        display: flex !important;
        flex-direction: row !important;
        gap: 32px !important;
        align-items: center !important;
    }
}

/* Body scroll lock when mobile nav is open */
body.nav-open {
    overflow: hidden;
}

/* Custom scrollbar for mobile navigation */
.mobile-nav::-webkit-scrollbar {
    width: 6px;
}

.mobile-nav::-webkit-scrollbar-track {
    background: transparent;
}

.mobile-nav::-webkit-scrollbar-thumb {
    background: rgba(180, 140, 100, 0.3);
    border-radius: 3px;
}

.mobile-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(180, 140, 100, 0.5);
}

/* Ensure mobile nav content can scroll properly */
.mobile-nav .nav-categories {
    min-height: auto;
    padding-bottom: 20px;
}



/* Add extra bottom space to prevent content cutoff */
.mobile-nav::after {
    content: '';
    display: block;
    height: 20px;
    width: 100%;
}

/* Force scrollbar to be visible and ensure content flows */
.mobile-nav {
    scrollbar-width: thin;
    scrollbar-color: rgba(180, 140, 100, 0.3) transparent;
}

/* Ensure the mobile nav container allows full scrolling */
.mobile-nav > *:last-child {
    margin-bottom: 0;
}

/* Prevent body scroll on mobile when nav is open */
@media (max-width: 768px) {
    body.nav-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
}

.login-link {
    background: #7a5c3e;
    color: #fff;
    border-radius: 6px;
    padding: 10px 22px;
    font-size: 16px;
    font-family: 'Georgia', serif;
    font-weight: bold;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(122, 92, 62, 0.15);
    transition: all 0.2s;
}

.login-link:hover {
    background: #5a4a3a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(122, 92, 62, 0.25);
}

.cart-link {
    background: linear-gradient(90deg, #b48c64 60%, #e2c9a0 100%);
    color: #fff;
    border-radius: 6px;
    padding: 10px 22px;
    font-size: 16px;
    font-family: 'Georgia', serif;
    font-weight: bold;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(180, 140, 100, 0.10);
    transition: background 0.2s;
    position: relative;
}

.cart-link:hover {
    background: linear-gradient(90deg, #a07a4a 60%, #d1b48a 100%);
}

#cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    min-width: 20px;
}

.page-title {
    text-align: center;
    color: #b48c64;
    font-size: 2.2rem;
    margin: 32px 0 24px 0;
    font-family: 'Playfair Display', 'Georgia', serif;
    letter-spacing: 1px;
    font-weight: 700;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
    max-width: 1200px;
    margin: 0 auto 40px auto;
    padding: 0 16px;
}

/* For tablets and larger */
@media (min-width: 600px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 24px;
        padding: 0 24px;
    }
}

/* For desktops */
@media (min-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 32px;
    }
}

.product-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(180, 140, 100, 0.10);
    padding: 18px 18px 24px 18px;
    text-align: center;
    transition: box-shadow 0.2s, transform 0.2s;
    cursor: pointer;
    position: relative;
}

.product-card:hover {
    box-shadow: 0 6px 24px rgba(180, 140, 100, 0.16);
    transform: translateY(-4px) scale(1.02);
}

.product-img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(180, 140, 100, 0.10);
}

.product-info h2 {
    font-size: 1.2rem;
    color: #7a5c3e;
    margin: 0 0 8px 0;
    font-family: 'Playfair Display', 'Georgia', serif;
    font-weight: 500;
}

.product-price {
    color: #b48c64;
    font-size: 1rem;
    margin-bottom: 10px;
    font-family: 'Georgia', serif;
}

.out-of-stock {
    color: #721c24;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: bold;
    text-align: center;
    margin-bottom: 8px;
    font-family: 'Georgia', serif;
}

.view-btn, .add-cart-btn {
    display: inline-block;
    margin: 4px 2px;
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 15px;
    font-family: 'Georgia', serif;
    font-weight: bold;
    border: none;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.view-btn {
    background: #e2c9a0;
    color: #7a5c3e;
}

.view-btn:hover {
    background: #b48c64;
    color: #fff;
}

.add-cart-btn {
    background: #b48c64;
    color: #fff;
}

.add-cart-btn:hover {
    background: #a07a4a;
}

/* Modal styles */
.modal {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    background: #fffefb;
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(180, 140, 100, 0.18);
    padding: 40px 36px 36px 36px;
    z-index: 1001;
    min-width: 500px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1.5px solid #e2c9a0;
    margin: 0 !important;
}

/* Larger size field (dropdown) in product modal */
.modal select.form-control {
    height: 44px;
    padding: 10px 12px;
    font-size: 1rem;
    border: 1px solid #e0d6c3;
    border-radius: 8px;
    background: #f9f7f4;
    color: #5a4632;
}

/* Ensure visible white space directly under the Add to Cart button (all devices) */
.modal .add-cart-btn {
    margin-bottom: 56px;
}

@media (max-width: 768px) {
    .modal select.form-control {
        height: 48px;
        padding: 12px 14px;
        font-size: 1.05rem;
    }
}

.modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(180, 140, 100, 0.18);
    z-index: 1000;
}

.modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    font-size: 1.7em;
    color: #b48c64;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #7a5c3e;
}

.add-cart-btn, .view-btn {
    box-shadow: 0 2px 8px rgba(180, 140, 100, 0.10);
    border: 1.5px solid #e2c9a0;
}

.add-cart-btn:hover, .view-btn:hover {
    box-shadow: 0 4px 16px rgba(180, 140, 100, 0.16);
    border-color: #b48c64;
}

/* Modal Image Container */
.modal-image-container {
    width: 100%;
    max-height: 700px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

.modal-product-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

/* Tighter spacing between image and product name in modal */
.modal-product-title {
    margin: 4px 0 8px;
    line-height: 1.15;
}

@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    /* Mobile Navigation */
    .navbar {
        position: relative;
        padding: 16px 20px 0 20px;
    }

.nav-left {
    gap: 16px;
}

.nav-logo {
    width: 60px;
    margin-right: 0;
}

.home-link {
    font-size: 16px;
}

/* Show hamburger menu on mobile and position it on the left */
.hamburger-menu {
    display: flex;
    order: -1; /* Move hamburger to the left */
}

/* Make login and cart buttons smaller on mobile */
.nav-right .login-link,
.nav-right .cart-link {
    padding: 8px 16px;
    font-size: 14px;
}

.nav-right .login-link {
    padding: 8px 14px;
}
    
    /* Hide desktop navigation on mobile */
    .desktop-only {
        display: none !important;
    }
    
    /* Mobile nav styling */
    .mobile-nav {
        display: block;
    }
    
    .modal {
        padding: 0;
        min-width: 0;
        margin: 0;
        max-width: 100vw;
        width: 100vw;
        height: auto; /* allow content height */
        max-height: 100vh; /* clamp to viewport */
        overflow-y: auto; /* scroll only as needed */
        border-radius: 0;
    }
    
    .modal-image-container {
        height: 55vh;
        width: 100%;
        margin: 0;
        border-radius: 0;
        overflow: hidden;
    }
    
    .modal-product-image {
        width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: center;
    }
    
    .modal-content {
        padding: 24px 16px 40px; /* extra top padding for size elements, extra bottom space below Add to Cart */
    }
    
    .modal-content .form-group:first-of-type {
        margin-top: 16px; /* extra padding above the size field */
    }

    /* Ensure visible white space directly under the Add to Cart button */
    .modal .add-cart-btn {
        margin-bottom: 64px; /* more white space on mobile */
    }

    /* Guarantee extra scrollable whitespace at the very bottom of the modal */
    .modal::after {
        content: '';
        display: block;
        height: 80px; /* visible white space even after the button */
        width: 100%;
    }

    /* allow natural bottom margins for last elements so space is visible */
    
    .modal-close {
        position: fixed;
        top: 15px;
        left: 15px;
        background: rgba(0,0,0,0.5);
        color: white;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 1002;
    }
    
    .modal-close::before {
        content: "←";
        font-size: 1.2em;
    }
    
    .back-to-top-btn {
        bottom: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
}

@media (max-width: 600px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .navbar {
        padding: 12px 16px 0 16px;
    }
    
    .nav-logo {
        width: 50px;
    }
    
    .home-link {
        font-size: 15px;
    }
    
    .hamburger-menu {
        width: 26px;
        height: 26px;
    }
    
    .hamburger-menu span {
        height: 2px;
    }
    
    /* Even smaller buttons on very small screens */
    .nav-right .login-link,
    .nav-right .cart-link {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .nav-right .login-link {
        padding: 6px 10px;
    }
    
    .mobile-nav {
        width: 80%;
        padding: 65px 12px 20px 12px;
        overflow-y: scroll;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    .mobile-nav .nav-category {
        font-size: 16px;
        padding: 10px 0;
    }
    
    .mobile-nav .nav-subcategories li {
        font-size: 14px;
        padding: 5px 14px;
    }
    

}

/* Back to Top Button */
.back-to-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #b48c64 0%, #e2c9a0 100%);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(180, 140, 100, 0.3);
    transition: all 0.3s ease;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
}

.back-to-top-btn:hover {
    background: linear-gradient(135deg, #a07a4a 0%, #d1b48a 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(180, 140, 100, 0.4);
}

.back-to-top-btn.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
