/* 1. Global Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background-color: whitesmoke;
    color: navy;
    line-height: 1.6;
}

/* 2. Layout Sections */
header {
    background-color: mediumturquoise;
    color: white;
    padding: 15px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 24px;
}

main {
    padding: 40px;
}

footer {
    background-color: mediumturquoise;
    color: white;
    text-align: center;
    padding: 15px;
    margin-top: 40px;
}

/* 3. Navigation & Dropdown Logic */
.main-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.main-nav > a, .droptn {
    color: white;
    text-decoration: none;
    font-size: 16px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 5px; /* Added padding for easier hovering */
}
/* 3. Shared Navigation Logic */
.dropdown {
    position: relative;
    display: inline-block;
}

/* Base styles for all dropdown boxes */
.dropdown-content {
    display: none; 
    position: absolute;
    top: 100%;
    background-color: white;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    border: 1px solid #ddd;
    z-index: 9999; 
    color: #333;
    border-radius: 4px;
}

/* This rule makes ANY dropdown-content show when its parent is hovered */
.dropdown:hover .dropdown-content {
    display: block;
}

/* Keep this for the "Add to Cart" click behavior so it stays open when clicked */
.dropdown-content.show {
    display: block !important;
}

/* 3a. Specific Styling for CATEGORIES (Vertical List) */
.category-menu {
    min-width: 160px;
    left: 0; /* Align to the left of the 'Categories' text */
    padding: 10px 0;
}

.category-menu a {
    color: #333;
    padding: 12px 16px;
    text-decoration: none;
    display: block; /* Forces vertical stacking */
    text-align: left;
}

.category-menu a:hover {
    background-color: #f1f1f1;
}

/* 3b. Specific Styling for SHOPPING LIST (The Overlay) */
.shopping-list-menu {
    min-width: 350px; /* Increased width to fit buttons and alignment */
    right: 0; 
    padding: 15px;
}

/* Empty Cart Message Styling */
.empty-msg {
    text-align: center;
    padding: 20px;
    color: #888;
    font-style: italic;
}

/* Updated Row Styling for Alignment */
/* Updated Row Styling for Alignment (No +/- buttons) */
.cart-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

/* Column 1: Product Name */
.item-name {
    flex: 2;
    font-size: 14px;
    padding-right: 10px;
}

/* Column 2: Standard Number Input */
.cart-item-row input {
    width: 50px; /* Slightly wider to fit the browser's native arrows */
    text-align: center;
    border: 1px solid #ddd;
    padding: 4px;
    border-radius: 4px;
}

/* Column 3: Subtotal */
.item-subtotal {
    flex: 1;
    text-align: right;
    font-family: 'Courier New', Courier, monospace; 
    font-weight: bold;
}

.cart-total {
    text-align: right;
    font-weight: bold;
    padding: 15px 0;
    font-size: 1.1em;
    border-top: 2px solid #eee;
    margin-top: 5px;
}

.checkout-btn {
    width: 100%;
    background-color: orangered;
    color: white;
    border: none;
    padding: 12px;
    cursor: pointer;
    font-weight: bold;
    border-radius: 4px;
}

.checkout-btn:hover {
    background-color: #e65c00;
}

/* 5. Breadcrumbs */
.breadcrumb {
    margin-bottom: 20px;
    font-size: 14px;
}

.breadcrumb a {
    color: #2235c1;
    text-decoration: none;
}

.breadcrumb a:after {
    content: " > ";
    color: #aaa;
    margin: 0 5px;
}

.breadcrumb a:last-child:after {
    content: "";
}

/* 6. Product Grid (Tableless) */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
}

.card {
    border: 1px solid #ddd;
    background: white;
    padding: 15px;
    text-align: center;
    border-radius: 8px;
}

.card img {
    width: 100%;
    height: 180px;
    object-fit: contain;
    margin-bottom: 10px;
}

.card h3 a {
    text-decoration: none;
    color: navy;
    font-size: 18px;
}

.price {
    color: #ff6600;
    font-weight: bold;
    font-size: 20px;
    margin: 10px 0;
}

.card button, .product-info button {
    background: orangered;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

/* 7. Product Detail Page (Requirement 5) */
.product-detail {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    align-items: flex-start;
    background: white;
    padding: 20px;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.product-image-container {
    flex: 2;
    max-width: 400px;
}

.product-image {
    width: 100%;
    height: auto;
    border-radius: 4px;
    max-height: 500px;
    object-fit: contain;
}

.product-info {
    flex: 1;
    min-width: 250px;
}

.product-info h2 {
    font-size: 28px;
    margin-bottom: 10px;
}

.product-description {
    margin: 20px 0;
    color: #555;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

/* Requirement 7: Toast Notification */
#toast {
    visibility: hidden;
    min-width: 250px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 5px;
    padding: 16px;
    position: fixed;
    z-index: 10000;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    font-weight: bold;
}

#toast.visible {
    visibility: visible;
    animation: fadein 0.5s, fadeout 0.5s 2.5s;
}

@keyframes fadein {
    from {bottom: 0; opacity: 0;}
    to {bottom: 30px; opacity: 1;}
}

@keyframes fadeout {
    from {bottom: 30px; opacity: 1;}
    to {bottom: 0; opacity: 0;}
}

/* Layout for the image/thumbnail area */
.product-image-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex: 1;
}

.main-display {
    width: 100%;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.image-thumbnails {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
}

.thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border: 2px solid #ddd;
    cursor: pointer;
    transition: 0.2s;
}

.thumb:hover, .thumb.active {
    border-color: orangered;
}

/* --- Master Auth Styles (Login, Register, Change Password) --- */
.auth-body {
    background-color: #f4f7f6;
    margin: 0;
    padding: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.auth-card {
    max-width: 480px;
    margin: 60px auto;
    padding: 40px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    box-sizing: border-box;
}

.auth-card h2 {
    margin-bottom: 25px;
    color: #333;
    text-align: center;
    font-weight: 600;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #4b5563;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 16px;
    transition: all 0.2s ease;
}

.form-group input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

.btn-auth {
    width: 100%;
    padding: 14px;
    background-color: #2563eb;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 10px;
}

.btn-auth:hover {
    background-color: #1d4ed8;
}

.alert-error {
    background-color: #fef2f2;
    color: #dc2626;
    padding: 12px;
    border: 1px solid #fee2e2;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    text-align: center;
}

.auth-footer {
    text-align: center;
    margin-top: 25px;
    font-size: 14px;
    color: #6b7280;
}

.auth-footer a {
    color: #2563eb;
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}
