/* --- 1. RESET & VARIABLES --- */
:root {
    /* Fancy Gradient Palette */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #ff9a9e 0%, #fecfef 99%, #fecfef 100%);
    --bg-gradient: linear-gradient(120deg, #fdfbfb 0%, #ebedee 100%);
    
    /* Colors */
    --accent-color: #667eea;
    --text-dark: #2d3436;
    --text-light: #636e72;
    
    /* Glass Effect Variables */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: 1px solid rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --backdrop-blur: blur(12px);
    
    /* Spacing */
    --border-radius: 16px;
}

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

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif; /* Recommend importing Poppins from Google Fonts in HTML */
    background: var(--bg-gradient); /* Subtle gradient background */
    color: var(--text-dark);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- 2. HEADER (Glassmorphism) --- */
header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: var(--backdrop-blur);
    border-bottom: var(--glass-border);
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.brand {
    font-size: 1.8rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent; /* Gradient Text Effect */
    text-decoration: none;
    letter-spacing: -1px;
}

/* --- 3. SHOPPING CART (Fancy Button) --- */
.cart-wrapper {
    position: relative;
    padding: 10px 20px;
    background: white;
    cursor: pointer;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border: 1px solid rgba(0,0,0,0.05);
    z-index: 2000; /* Ensure it stays on top */
}

.cart-wrapper:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(118, 75, 162, 0.2);
}

/* Invisible bridge to prevent menu from closing when moving mouse down */
.cart-wrapper::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 20px; /* The safe bridge area */
    background: transparent;
}

.cart-wrapper span {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-dark);
}

/* Dropdown Menu */
.shopping-list {
    display: none;
    position: absolute;
    top: calc(100% + 10px); /* Slightly below button */
    right: 0;
    width: 320px;
    background: rgba(255, 255, 255, 0.98); /* Less transparent for readability */
    backdrop-filter: blur(20px);
    border: var(--glass-border);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2); /* Stronger shadow */
    z-index: 2100;
    cursor: default; /* Reset cursor inside the cart */
}

/* Show on Hover */
.cart-wrapper:hover .shopping-list {
    display: block;
    animation: slideUp 0.2s ease-out;
}

/* Dropdown Menu (Floating Glass Card) */
.shopping-list {
    display: none;
    position: absolute;
    top: 150%;
    right: 0;
    width: 320px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: var(--glass-border);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--glass-shadow);
    z-index: 2000;
    animation: slideUp 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.cart-wrapper:hover .shopping-list {
    display: block;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px dashed #ddd;
    padding-bottom: 10px;
    font-size: 0.9rem;
}

.checkout-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary-gradient); /* Gradient Button */
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 10px;
}

.checkout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(118, 75, 162, 0.4);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- 4. LAYOUT --- */
.container {
    display: flex;
    max-width: 1200px;
    margin: 40px auto;
    width: 90%;
    gap: 40px;
    flex: 1;
}

/* --- 5. SIDEBAR (Floating Menu) --- */
aside {
    flex: 0 0 240px;
    height: fit-content;
}

aside nav {
    background: var(--glass-bg);
    border: var(--glass-border);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(5px);
}

aside h3 {
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 700;
}

aside ul {
    list-style: none;
}

aside a {
    text-decoration: none;
    color: var(--text-dark);
    display: block;
    padding: 12px 15px;
    border-radius: 10px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
    font-weight: 500;
}

aside a:hover {
    background: white;
    color: var(--accent-color);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transform: translateX(5px);
}

/* --- 6. MAIN CONTENT --- */
main {
    flex: 1;
}

.breadcrumbs {
    margin-bottom: 30px;
    font-size: 0.9rem;
    color: var(--text-light);
    background: white;
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.breadcrumbs a {
    text-decoration: none;
    color: var(--text-light);
    font-weight: 500;
}

.breadcrumbs a:hover {
    color: var(--accent-color);
}

/* --- 7. PRODUCT GRID (Fancy Cards) --- */
.product-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px; /* Updated from 30px to match your inline style */
  }
  
  .product-card {
    background: white;
    border: 1px solid #eee; /* Added from inline style */
    border-radius: 8px;     /* Updated from 20px to match inline */
    padding: 15px;          /* Updated from 20px to match inline */
    width: 220px;           /* Updated to strict 220px from inline */
    text-align: center;     /* Changed from left to center */
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
  }
  
  .product-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1); /* Updated to match inline */
  }
  
  /* Ensure images fit the smaller card */
  .product-card img, .product-card .product-image {
    width: 100%;
    height: 180px; /* Slightly smaller to fit 220px width */
    object-fit: cover;
    border-radius: 8px; /* Match new card border-radius */
    margin-bottom: 10px;
    background-color: #f4f4f4;
  }
  
  /* Update Add Button in grid */
  .product-card .add-btn {
    margin-top: 10px; /* From inline */
    padding: 5px 10px; /* From inline */
    cursor: pointer;
    background: transparent;
    border: 2px solid var(--accent-color);
    color: var(--accent-color);
    border-radius: 6px;
    font-weight: 700;
    transition: all 0.3s;
    text-transform: uppercase;
    font-size: 0.8rem;
  }
  
  .product-card .add-btn:hover {
    background: var(--primary-gradient);
    border-color: transparent;
    color: white;
  }
/* --- PRODUCT DETAIL LAYOUT --- */
/* --- 8. PRODUCT DETAIL PAGE --- */

.product-detail-view {
    display: flex;
    gap: 50px; /* Space between image and text */
    background: white;
    padding: 40px;
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
    margin-top: 20px;
    /* CHANGE: stretch items to make both columns equal height */
    align-items: stretch; 
    min-height: 500px; /* Force a minimum height */
}

.product-detail-image {
    flex: 1; 
    /* CHANGE: Ensure it fills the height */
    display: flex;
    justify-content: center;
    align-items: center; /* Center the image vertically & horizontally */
    background: #f8f9fa; 
    border-radius: 20px;
    padding: 40px; /* Add more padding inside the gray box */
    height: auto; /* Let flex-grow handle the height */
}

.product-detail-image img {
    max-width: 100%;
    max-height: 400px; /* Limit image height so it doesn't explode */
    width: auto;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center; /* Center text vertically */
    padding-top: 10px;
}

/* Title */
.product-info h2 {
    font-size: 3rem; /* Huge title */
    font-weight: 800;
    margin-bottom: 15px;
    letter-spacing: -1px;
}

/* Price Tag */
.product-info .price {
    font-size: 2.2rem;
    color: var(--accent-color);
    font-weight: 800;
    background: #f0f2ff; /* Light purple bg */
    padding: 10px 25px;
    border-radius: 12px;
    margin-bottom: 30px;
    display: inline-block;
}

/* Description Title */
.description-box h3 {
    font-size: 0.9rem;
    color: #999;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 10px;
}

/* Add to Cart Button */
.product-info .add-btn {
    width: 100%;
    padding: 18px;
    background: var(--primary-gradient);
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3); /* Purple shadow */
    letter-spacing: 1px;
}

.product-info .add-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

/* 5. Responsive (Mobile Stack) */
@media (max-width: 768px) {
    .product-detail-view {
        flex-direction: column; /* Stack vertically */
        padding: 20px;
        gap: 30px;
    }
    
    .product-detail-image, .product-info {
        flex: none;
        width: 100%;
    }
    
    .product-info h2 {
        font-size: 1.8rem;
    }
}

/* --- 9. RESPONSIVE --- */
@media (max-width: 768px) {
    .container { flex-direction: column; }
    aside { width: 100%; }
    .product-card { width: calc(50% - 15px); }
    .product-detail-view { flex-direction: column; }
    .main-image { width: 100%; height: auto; }
}

@media (max-width: 480px) {
    .product-card { width: 100%; }
}

/* --- 10. FOOTER --- */
footer {
    text-align: center;
    padding: 40px;
    background: white;
    color: #aaa;
    margin-top: 60px;
    border-top: 1px solid #eee;
}

/* FIX: Category Active State */
aside ul li {
    list-style: none;
    padding: 12px 15px;
    border-radius: 10px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
    font-weight: 500;
    cursor: pointer;
}

aside ul li.active {
    background: white;
    color: var(--accent-color);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    font-weight: 700;
}

aside ul li:hover {
    background: white;
    color: var(--accent-color);
    transform: translateX(5px);
}

/* FIX: Product Card Images (Generic) */
.product-card img,
.product-card .product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 15px;
    margin-bottom: 15px;
    background-color: #f4f4f4;
}

/* FIX: Shopping Cart Dropdown Toggle (Click-based, not hover) */
.shopping-list-content.active {
    display: block !important;
}

/* --- FANCY QUANTITY SELECTOR --- */

.quantity-selector {
    display: flex;
    align-items: center;
    gap: 15px; /* Space between label and input */
    margin: 20px 0 30px 0; /* Spacing around the row */
    font-family: 'Poppins', sans-serif;
}

.quantity-selector label {
    font-weight: 800; /* Bold label */
    font-size: 1.1rem;
    color: var(--text-dark);
    margin: 0;
}

.quantity-selector input[type="number"] {
    width: 80px;
    padding: 10px;
    border: 2px solid #eee;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    color: var(--text-dark);
    background: white;
    transition: all 0.2s ease;
    outline: none;
}

.quantity-selector input[type="number"]:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

/* Hide the ugly spinner arrows in Chrome/Safari/Edge */
.quantity-selector input[type="number"]::-webkit-inner-spin-button, 
.quantity-selector input[type="number"]::-webkit-outer-spin-button { 
    -webkit-appearance: none; 
    margin: 0; 
}

/* Shopping list dropdown */
.shopping-list-content.active {
    display: block;
}

/* Checkout button */
.checkout-btn {
    display: block;
    width: calc(100% - 20px);
    margin: 10px;
    padding: 8px;
    background-color: #e44d26;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    border-radius: 4px;
}

.checkout-btn:hover {
    background-color: #c0392b;
}

/* Category sidebar list items */
.category-list li {
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 4px;
  }
  
  .category-list li:hover {
    background-color: #f0f0f0;
  }
  
  .category-list li.active {
    font-weight: bold;
    color: #007bff;
  }
  
  /* =========================================
   SHOPPING CART DROPDOWN
========================================= */
.cart-empty {
    padding: 10px;
    text-align: center;
    color: #666;
  }
  
  .cart-table {
    width: 100%;
    border-collapse: collapse;
  }
  
  .cart-th {
    padding: 6px 10px;
    text-align: left;
    border-bottom: 2px solid #ddd;
    font-size: 13px;
    font-weight: bold;
  }
  
  .cart-td {
    padding: 6px 10px;
    font-size: 13px;
    vertical-align: middle;
    border-bottom: 1px solid #f0f0f0;
  }
  
  .cart-qty-input {
    width: 55px;
    text-align: center;
    padding: 3px 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
  }
  
  .cart-remove-btn {
    cursor: pointer;
    background: none;
    border: none;
    font-size: 18px;
    color: #e00;
    padding: 0 4px;
    line-height: 1;
  }
  
  .cart-remove-btn:hover {
    color: #a00;
  }
  
  .cart-total {
    padding: 8px 10px;
    font-weight: bold;
    border-top: 2px solid #ddd;
    text-align: right;
    font-size: 14px;
    background: #fafafa;
  }
  
  .cart-actions {
    display: flex;
    gap: 8px;
    padding: 8px 10px;
    justify-content: flex-end;
    background: #fafafa;
    border-top: 1px solid #eee;
    border-radius: 0 0 6px 6px;
  }
  
  .cart-checkout-btn {
    cursor: pointer;
    padding: 7px 14px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: bold;
  }
  
  .cart-checkout-btn:hover {
    background-color: #218838;
  }
  
  .cart-clear-btn {
    cursor: pointer;
    padding: 7px 14px;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 13px;
  }
  
  .cart-clear-btn:hover {
    background-color: #c82333;
  }  
  
  /* Back to shop link on product page */
.back-to-shop {
    display: block;
    margin-top: 20px;
    color: #888;
    text-decoration: none;
  }
  
  .back-to-shop:hover {
    color: #555;
    text-decoration: underline;
  }
  /* --- USER STATUS (Header) --- */
#user-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Poppins', sans-serif;
  }
  
  .user-greeting {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-light);
  }
  
  /* Change Password link — matches nav a style */
  .user-action-link {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-color);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(102, 126, 234, 0.08);
    transition: all 0.2s ease;
  }
  
  .user-action-link:hover {
    background: rgba(102, 126, 234, 0.18);
    transform: translateY(-1px);
  }
  
  /* Logout button — pill shaped, matches cart-wrapper style */
  .user-logout-btn {
    font-size: 0.8rem;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
    color: white;
    background: var(--primary-gradient);
    border: none;
    border-radius: 20px;
    padding: 6px 16px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
    transition: all 0.3s ease;
    letter-spacing: 0.3px;
  }
  
  .user-logout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
  }
  
  