/* --- 1. VARIABILE & RESET --- */
:root { 
    --primary: #e74c3c; 
    --dark: #2c3e50; 
    --light: #ecf0f1; 
    --success: #27ae60;
    --shadow: 0 4px 6px rgba(0,0,0,0.1); 
}

*, *::before, *::after {
    box-sizing: border-box;
}

body { font-family: system-ui, -apple-system, sans-serif; background: #f8f9fa; color: var(--dark); margin: 0; padding-bottom: 0; }
body.menu-open { overflow: hidden; } 

a { text-decoration: none; color: inherit; }
ul { list-style: none; padding: 0; margin: 0; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 15px; }

/* --- 2. HEADER --- */
header { 
    background: #fff; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.05); 
    position: sticky; 
    top: 0; 
    z-index: 100; 
    padding: 15px 0; 
}
.nav-wrapper { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}
.logo { font-weight: 900; font-size: 1.4rem; color: var(--primary); }

.desktop-nav {
    display: block;
}
.desktop-nav .nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}
.desktop-nav .nav-links li a {
    font-weight: 600;
    font-size: 0.95rem;
}

.cart-icon { 
    cursor: pointer; 
    background: var(--light); 
    padding: 10px 20px; 
    border-radius: 30px; 
    font-weight: bold; 
    display: flex; 
    align-items: center; 
    gap: 10px; 
}
#cartCount { 
    background: var(--primary); 
    color: #fff; 
    padding: 2px 8px; 
    border-radius: 10px; 
    font-size: 0.8rem; 
}

/* --- Meniul mobil --- */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--dark);
    padding: 5px 10px;
    z-index: 1001; /* Peste meniul deschis */
}

.mobile-nav {
    display: none; 
}

/* --- Media Queries pentru Responsive --- */
@media (max-width: 768px) {
    .desktop-nav { 
        display: none;
    }
    .mobile-menu-toggle {
        display: block;
    }
    header {
        position: static; /* Eliminăm sticky pe mobil */
    }
    .mobile-nav {
        display: none; /* Starea inițială: ascuns */
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: #fff;
        z-index: 1000;
        overflow-y: auto;
        padding-top: 60px; /* Spațiu pentru butonul de închidere */
    }
    .mobile-nav.open {
        display: block; /* Starea deschis: vizibil */
    }
    .mobile-nav .nav-links {
        display: flex;
        flex-direction: column;
        padding: 10px 15px;
    }
    .mobile-nav .nav-links li {
        width: 100%;
        border-bottom: 1px solid #eee;
    }
    .mobile-nav .nav-links li:last-child {
        border-bottom: none;
    }
    .mobile-nav .nav-links li a {
        padding: 15px 5px;
        display: block;
        width: 100%;
        font-size: 1.1rem;
        font-weight: 500;
        color: var(--dark);
    }
    #closeMobileMenu { /* Stil pentru butonul de închidere */
        position: fixed;
        top: 15px;
        right: 20px;
        font-size: 2rem;
        color: var(--dark);
        z-index: 1001;
    }
}


/* --- Stil pentru Active Orders Tracker --- */
#active-orders-tracker {
    background-color: var(--dark);
    color: var(--light);
    padding: 10px 0;
    position: relative;
    z-index: 99;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
@media (max-width: 768px) {
    #active-orders-tracker {
        position: static;
    }
}
.active-orders-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}
.active-order-item {
    background-color: rgba(255,255,255,0.1);
    padding: 8px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 500;
}
.active-order-item .status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    color: #fff;
}
.status-badge.status-pending { background-color: #ffc107; color: #212529; }
.status-badge.status-preluata { background-color: #6f42c1; }
.status-badge.status-in_asteptare_client { background-color: #fd7e14; }
.status-badge.status-in_livrare { background-color: #0dcaf0; }

/* --- ETC --- */
.hero { background: linear-gradient(135deg, #ff9f43 0%, #ff6b6b 100%); color: #fff; padding: 80px 20px; text-align: center; margin-bottom: 40px; }
.hero h1 { margin: 0 0 10px 0; font-size: 2.5rem; }
.section-title { margin-bottom: 30px; border-bottom: 2px solid var(--primary); display: inline-block; padding-bottom: 5px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 30px; margin-bottom: 50px; }
.product-card { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); transition: transform 0.3s ease; border: 1px solid #eee; display: flex; flex-direction: column; }
.product-card:hover { transform: translateY(-5px); }
.prod-img-box { height: 200px; background: #f8f9fa; overflow: hidden; }
.prod-img-box img { width: 100%; height: 100%; object-fit: cover; }
.prod-details { padding: 20px; flex-grow: 1; display: flex; flex-direction: column; }
.prod-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 5px; display: block; }
.prod-desc { font-size: 0.9rem; color: #7f8c8d; margin-bottom: 15px; flex-grow: 1; }
.prod-footer { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid #f1f1f1; padding-top: 15px; margin-top: auto; }
.price-tag { font-size: 1.2rem; font-weight: 800; }
.btn-add { background-color: var(--primary); color: white; border: none; padding: 10px 20px; border-radius: 25px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; font-size: 0.9rem; }
.btn-add:hover { background-color: #c0392b; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
.cat-card { background: #fff; padding: 20px; text-align: center; border-radius: 10px; box-shadow: var(--shadow); border: 2px solid transparent; transition: 0.2s; display: block; font-weight: bold; }
.cat-card:hover { border-color: var(--primary); color: var(--primary); }
.daily-menu-section { background: linear-gradient(to right, #fff, #fff3cd); border-left: 5px solid #ffc107; padding: 30px; border-radius: 8px; margin: 40px 0; box-shadow: var(--shadow); }
.cart-modal { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.6); 
    z-index: 9999; 
    display: none; 
    /* Changed from justify/align-items to allow scrolling from top */
    overflow-y: auto; 
    padding: 20px 0; /* Add some padding for better spacing on scroll */
    backdrop-filter: blur(5px); 
}
.cart-content { 
    background: #fff; 
    width: 90%; 
    max-width: 500px; 
    border-radius: 15px; 
    overflow: hidden; 
    display: flex; 
    flex-direction: column; 
    /* max-height: 85vh; --- REMOVED to allow content to grow */
    margin: auto; /* Center the content vertically and horizontally */
    animation: slideDown 0.3s ease-out; 
    box-shadow: 0 20px 50px rgba(0,0,0,0.3); 
}
@keyframes slideDown { 
    from { transform: translateY(-50px); opacity: 0; } 
    to { transform: translateY(0); opacity: 1; }
}
.cart-header { 
    background: var(--dark); 
    color: #fff; 
    padding: 15px 20px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}
.cart-header h3 { margin: 0; font-size: 1.2rem; }
.close-cart { cursor: pointer; font-size: 1.5rem; }
#cartItems { 
    padding: 20px; 
    /* overflow-y: auto; --- REMOVED to stop internal scroll */
    flex-grow: 1; 
    /* flex-shrink is important to allow it to grow but not force parent */
    flex-shrink: 0;
}
.cart-item { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 10px 0; 
    border-bottom: 1px solid #eee; 
}
.cart-footer { padding: 20px; border-top: 1px solid #eee; background: #f9f9f9; }
.cart-footer .total { font-size: 1.3rem; font-weight: bold; text-align: right; margin-bottom: 15px; }
.checkout-btn { width: 100%; padding: 12px; background: var(--success); color: white; border: none; border-radius: 8px; font-weight: bold; cursor: pointer; font-size: 1rem; }
.checkout-btn:hover { opacity: 0.9; }
.customer-details { padding: 15px 20px; border-top: 1px solid #eee; background-color: #fcfcfc; }
.customer-details h5 { font-size: 1.1rem; color: var(--dark); margin-bottom: 15px; }
.customer-details .form-group { margin-bottom: 10px; }
.customer-details .form-control { width: 100%; padding: 8px 12px; border: 1px solid #ced4da; border-radius: 5px; font-size: 0.9rem; }
.customer-details .form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 0.2rem rgba(231, 76, 60, 0.25); outline: none; }
.customer-details .form-check-inline { margin-right: 15px; }
.customer-details .form-check-input { margin-right: 5px; }
.customer-details .form-check-label { font-size: 0.9rem; color: var(--dark); cursor: pointer; }

/* Custom styles for cart page items */
.list-group-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap; /* Allow items to wrap on smaller screens */
}

.cart-item-name-col {
    flex-grow: 1;
    flex-basis: 0; /* Allow it to shrink */
    min-width: 150px; /* Minimum width to prevent name from becoming too small */
    margin-right: 15px; /* Space between name and controls */
}

.cart-item-controls-col {
    width: 175px; /* Fixed width for the controls column as requested */
    flex-shrink: 0; /* Prevent it from shrinking */
    display: flex; /* Ensure its children align correctly */
    align-items: center;
    gap: 15px; /* Adjust gap as needed */
}

.cart-qty-controls {
    width: 120px; /* Fixed width for the quantity buttons group */
    flex-shrink: 0; /* Prevent it from shrinking */
}

.cart-item-total {
    width: 80px; /* Fixed width for the total price */
    flex-shrink: 0; /* Prevent it from shrinking */
    text-align: right; /* Ensure text remains right-aligned */
}

/* Styles for Modal Cart Items */
.modal-cart-item-name {
    flex-grow: 1;
    flex-basis: 0; /* Allows it to shrink */
    min-width: 100px; /* Minimum width for the name */
    margin-right: 10px; /* Space between name and controls */
}

.modal-cart-item-qty-controls {
    width: 120px; /* Fixed width for the quantity controls in the modal */
    flex-shrink: 0; /* Prevent it from shrinking */
    /* display: flex; align-items: center; gap: 5px; -> already added in JS */
}

.cart-qty-display {
    min-width: 25px;
    text-align: center;
}


@media (max-width: 576px) {
    .list-group-item {
        flex-direction: column; /* Stack items vertically on small screens */
        align-items: flex-start; /* Align items to the start when stacked */
    }
    .cart-item-name-col {
        min-width: unset; /* Remove min-width on very small screens */
        width: 100%; /* Take full width on small screens */
        margin-right: 0;
        margin-bottom: 10px; /* Add space below name on small screens */
    }
    .cart-item-controls-col {
        width: 100%; /* Allow full width on small screens */
        justify-content: space-between; /* Distribute controls on small screens */
        margin-top: 10px; /* Space above this section */
        gap: 10px; /* Adjust gap for small screens */
    }
    .cart-qty-controls {
        width: auto; /* Allow width to be flexible within the space-between context */
    }
    .cart-item-total {
        width: auto; /* Allow width to be flexible */
        flex-grow: 1; /* Allow it to take up available space */
    }

    /* Modal cart adjustments for small screens */
    .cart-item.d-flex {
        flex-direction: column;
        align-items: flex-start;
    }
    .modal-cart-item-name {
        width: 100%;
        margin-right: 0;
        margin-bottom: 5px;
    }
    .modal-cart-item-qty-controls {
        width: 100%;
        justify-content: flex-end; /* Align controls to the right */
    }
}

.hero-image-section {
    background-image: url('../img/la-olteanca.webp'); 
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    height: 385px; 
    position: relative; 
}

@media (max-width: 768px) {
    .hero-image-section {
        height: 40vh; 
        background-size: cover; 
    }
}

@media (max-width: 480px) {
    .hero-image-section {
        height: 30vh; 
    }
}
/* --- Search Module --- */
.search-container {
    position: relative;
    margin-top: 20px;
    margin-bottom: 20px;
}

.search-bar input {
    width: 100%;
    padding: 12px 20px;
    font-size: 1rem;
    border-radius: 30px;
    border: 1px solid #ddd;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.search-results {
    display: none; /* Ascuns inițial */
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-top: 5px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1001;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

.search-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #f1f1f1;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background-color: #f8f9fa;
}

.search-result-name {
    font-weight: 500;
    flex-grow: 1;
    margin-right: 15px;
}

.search-add-btn {
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.2s ease;
    padding: 0;
}

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


/* --- Styles for Add-to-Cart Feedback and Search Links --- */

.search-result-link {
    text-decoration: none;
    color: inherit;
    flex-grow: 1;
}

.btn-add.added {
    background-color: var(--success);
    color: transparent; /* Hide the original '+' */
    position: relative;
}

.btn-add.added::after {
    content: '✓';
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem; /* Match the original font size */
    line-height: 1;
}


/* --- Product Page (produs.php) --- */
.product-page-container {
    padding-top: 30px;
    padding-bottom: 30px;
}

.product-card-detailed {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 40px;
}

@media (min-width: 768px) {
    .product-card-detailed {
        grid-template-columns: 1fr 1.2fr;
        gap: 40px;
        padding: 30px;
    }
}

.product-image-detailed img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    object-fit: cover;
}

.product-info-detailed .breadcrumb {
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.product-info-detailed h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 15px;
}

.product-description-detailed {
    font-size: 1rem;
    color: #555;
    line-height: 1.6;
    margin-bottom: 25px;
}

.product-meta {
    display: flex;
    gap: 20px;
    font-size: 0.9rem;
    color: #777;
    margin-bottom: 25px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}
.product-meta span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
/* You would need to add icons for this to work, e.g., using an icon font */
.icon-timer, .icon-weight { 
    font-weight: bold;
} 

.product-ingredients {
    margin-bottom: 30px;
}
.product-ingredients h6 {
    font-weight: 700;
    margin-bottom: 10px;
}
.ingredient-list {
    font-size: 0.9rem;
    color: #666;
    padding-left: 0;
    list-style: none;
}

.product-purchase-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: var(--light);
    border-radius: 10px;
    margin-top: auto;
}

.price-tag-detailed {
    font-size: 2rem;
    font-weight: 900;
    color: var(--primary);
}

.btn-add-lg {
    padding: 12px 30px;
    font-size: 1.1rem;
    border-radius: 8px;
}

/* --- Recommendations Section --- */
.recommendations-section {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid #eee;
}
.recommendations-section .section-title {
    text-align: center;
    margin-bottom: 40px;
}


/* --- Breadcrumb Styles --- */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    padding: 0;
    margin: 0 0 1rem 0;
    list-style: none;
    background-color: transparent;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: '/';
    display: inline-block;
    padding: 0 0.75rem;
    color: #6c757d;
}

.breadcrumb-item a {
    color: var(--primary);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: #6c757d;
    font-weight: 500;
}

