/* =============================
   1. RESET & VARIABLES
   ============================= */
:root {
    --primary: #2c3e50;
    --secondary: #e67e22;
    --bg-light: #f8f9fa;
    --white: #ffffff;
    --text-dark: #333333;
    --text-light: #666666;
    --border: #e1e1e1;
    --shadow: 0 4px 6px rgba(0,0,0,0.1);
    --radius: 8px;
    --sidebar-width: 280px; /* Width of slide-out menu */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: rgb(252, 249, 234);
    color: var(--text-dark);
    line-height: 1.6;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

/* =============================
   2. NAVIGATION & LAYOUT
   ============================= */
nav {
    padding: 1rem;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.shop-layout {
    padding: 1rem;
    position: relative;
}

nav {
    padding: 1.5rem;
    background-color: rgb(151, 168, 122);
}

nav a {
    text-decoration: none;
    background-color: rgb(252, 249, 234);
    color: rgb(151, 168, 122);
    padding: 10px 20px;       /* Top/Bottom, Left/Right */
    border-radius: 50px;      /* Makes it fully round (Pill shape) */
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1); /* Subtle shadow for depth */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: inline-block;
}


/* =============================
   3. MOBILE SIDEBAR (Off-Canvas)
   ============================= */
/* The dark background overlay */
.overlay {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 900;
}
.overlay.active { display: block; }

/* The Sidebar Panel */
.sidebar {
    position: fixed;
    top: 0;
    left: -100%; /* Hide off-screen to the left */
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--white);
    z-index: 1000;
    transition: left 0.3s ease-in-out;
    box-shadow: 2px 0 10px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
}

.sidebar.active {
    left: 0; /* Slide in */
}

/* Header inside the sidebar (Mobile only) */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: rgb(151, 168, 122);
    color: rgb(65, 64, 64);
}

.btn-close {
    background: none;
    border: none;
    color: var(--white);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

.sidebar-content {
    padding: 15px;
    overflow-y: auto; /* Scroll INSIDE the sidebar if list is long */
    flex-grow: 1;
}

/* Hide the "Desktop Title" on mobile to avoid duplicate headers */
.sidebar-content > h3 { display: none; }

/* Filter List Styles */
.filter-group { margin-bottom: 1.5rem; }
.filter-group h4 { margin-bottom: 0.5rem; border-bottom: 1px solid #eee; padding-bottom: 5px; font-size: 1rem; }
.filter-list { list-style: none; }
.filter-list li { margin-bottom: 10px; display: flex; align-items: center; font-size: 1.1rem; } /* Larger touch target */
.filter-list input { margin-right: 12px; width: 20px; height: 20px; }

/* Mobile Filter Toggle Button */
.btn-mobile-filter {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding: 12px 15px;
    background: rgb(255, 162, 57);
    border: 1px solid var(--primary);
    color: var(--primary);
    border-radius: var(--radius);
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 20px;
    cursor: pointer;
}

/* =============================
   4. PRODUCT GRID
   ============================= */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
}

.product-card {
    background: rgb(151, 168, 122);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card-image-wrapper {
    height: 160px;
    overflow: hidden;
    background: #eee;
    filter: brightness(0.85); 
}

.card-image-wrapper img {
    width: 100%;
    height: 100%;
    transition: transform 0.3s;
}

.card-details {
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-details h3 { font-size: 1rem; margin-bottom: 5px;color: rgb(252, 249, 234);}
.card-details .description {
    font-size: 0.85rem;
    color: rgb(252, 249, 234);
    margin-bottom: 15px;
    flex-grow: 1;
}

.price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.price { 
    font-weight: bold;
    font-size: 1.1rem;
    color: rgb(252, 249, 234); 
    padding: 5px;
}

.btn-add {
    background: var(--secondary);
    color: var(--white);
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
}

/* =============================
   5. DESKTOP STYLES (Min-width: 768px)
   ============================= */
@media (min-width: 768px) {
    .shop-layout {
        display: grid;
        grid-template-columns: 240px 1fr; /* Fixed sidebar, flexible content */
        gap: 40px;
        max-width: 1200px;
        margin: 0 auto;
        padding: 2rem;
    }

    /* Reset Sidebar to standard column */
    .sidebar {
        position: static; /* Back to normal flow */
        width: auto;
        height: auto;
        background: transparent;
        box-shadow: none;
        z-index: auto;
        border-right: 1px solid var(--border);
        padding-right: 20px;
        transform: none; /* remove slide effect */
        display: block; /* Ensure it's visible */
    }
    
    .sidebar-header { display: none; } /* Hide mobile header/close button */
    .sidebar-content > h3 { display: block; margin-bottom: 20px;} /* Show Desktop Title */
    .sidebar-content { padding: 0; overflow: visible; }
    
    /* Hide Mobile Elements */
    .btn-mobile-filter { display: none; }
    .overlay { display: none !important; }

    /* Desktop Product Card Refinements */
    .card-image-wrapper { height: 220px; }
    .product-card:hover { transform: translateY(-5px); transition: 0.3s; }
    .card-image-wrapper img:hover { transform: scale(1.05); }
}