/* General Styling - Light Mode (Default) */
:root {
    --bg-color: #f7f7f7;
    --text-color: #333;
    --card-bg-color: #fff;
    --theme-button-bg-color: #120707;
    --theme-button-shadow: 0 2px 5px rgba(0,0,0,0.1);
    --theme-button-icon-color: white;
}

body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Sticky Header Container */
.sticky-header-container {
    position: sticky;
    top: 0;
    background-color: var(--bg-color);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px 0 0;
    max-width: 1200px;
    margin: 0 auto;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* --- New Header Brand Section --- */
.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 25px;
}

.brand-logo {
    width: 40px;
    height: 40px;
}

.brand-name {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #4CAF50;
}

/* Header Section (Search & Filter) */
.top-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
}

.search-bar-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
    background-color: var(--card-bg-color);
    border-radius: 15px;
    padding: 10px 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    margin-right: 15px;
    transition: background-color 0.3s ease;
}

.search-input {
    border: none;
    outline: none;
    flex-grow: 1;
    padding: 5px 10px;
    font-size: 1em;
    color: var(--text-color);
    background-color: transparent;
    transition: color 0.3s ease;
}

.search-icon {
    color: #999;
    font-size: 1.1em;
    transition: color 0.3s ease;
}

.theme-toggle-button {
    background-color: var(--theme-button-bg-color);
    border: none;
    border-radius: 15px;
    padding: 15px 18px;
    cursor: pointer;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--theme-button-shadow);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.theme-toggle-button i {
    color: var(--theme-button-icon-color);
    font-size: 1em;
}

/* --- Navigation List (Corrected Padding) --- */
.categories-list {
    display: flex;
    padding: 20px 25px 25px; /* Added horizontal padding to the list itself */
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.categories-list::-webkit-scrollbar {
    display: none;
}

/* --- Category Item Styling (Default) --- */
.category-item {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #777; /* Default color for text/icons */
    margin-right: 20px;
    background-color: var(--card-bg-color);
    border-radius: 50px;
    padding: 10px 15px;
    min-width: 80px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.2s ease-in-out;
}

.category-item i {
    margin-right: 8px;
    font-size: 1.1em;
    color: inherit;
}

.category-item span {
    font-size: 0.85em;
    font-weight: 500;
}

/* --- Active Category Item Styling (Light Mode) --- */
.category-item.active {
    background-color: #120707; /* Dark background on active pill */
    color: white; /* White font/icon color on active pill */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.category-item.active i,
.category-item.active span {
    color: white;
}

/* Main Content Area */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
}

/* Dish Grid (for Popular items) */
.dish-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 0 25px;
}

/* Dish Card */
.dish-card {
    background-color: var(--card-bg-color);
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.08);
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    cursor: pointer; /* Add a pointer cursor to indicate it's clickable */
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, background-color 0.3s ease, color 0.3s ease;
}

/* --- Hover Effect for Dish Card --- */
.dish-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.card-text-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    margin-right: 15px;
}

.card-text-content h3 {
    margin: 0 0 5px 0;
    font-size: 1.3em;
    font-weight: 600;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.card-text-content .description {
    font-size: 0.9em;
    color: #777;
    margin-bottom: 10px;
    transition: color 0.3s ease;
}

.calories-info {
    display: flex;
    align-items: center;
    font-size: 0.8em;
    color: #ff5722;
    margin-bottom: 10px;
    transition: color 0.3s ease;
}

.calories-info .hot-icon {
    margin-right: 5px;
    font-size: 0.9em;
}

.card-text-content .price {
    font-size: 1.5em;
    font-weight: bold;
    color: #4CAF50;
}

.card-image-wrapper {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}


/* --- Modal Styling --- */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 2000; /* Sit on top of everything */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--card-bg-color);
    margin: auto;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    width: 80%; /* Adjusted for responsiveness */
    max-width: 500px;
    position: relative;
    animation-name: animatetop;
    animation-duration: 0.4s;
}

@keyframes animatetop {
    from {top: -300px; opacity: 0}
    to {top: 0; opacity: 1}
}

.modal-close-button {
    color: var(--text-color);
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
}

.modal-close-button:hover,
.modal-close-button:focus {
    color: #ff5722;
    text-decoration: none;
    cursor: pointer;
}

.modal-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 2em;
    margin: 0 0 10px;
    color: var(--text-color);
}

.modal-description {
    font-size: 1em;
    color: #777;
    line-height: 1.5;
}

/* --- Dark Mode Styles --- */
body[data-theme='dark'] {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --card-bg-color: #2a2a2a;
    --theme-button-bg-color: #ffffff;
    --theme-button-shadow: 0 2px 5px rgba(255,255,255,0.1);
    --theme-button-icon-color: #1a1a1a;
}

/* Dark mode-specific overrides */
body[data-theme='dark'] .search-input,
body[data-theme='dark'] .search-input::placeholder,
body[data-theme='dark'] .card-text-content h3,
body[data-theme='dark'] .brand-name {
    color: var(--text-color);
}

body[data-theme='dark'] .search-icon,
body[data-theme='dark'] .card-text-content .description {
    color: #ccc;
}

body[data-theme='dark'] .categories-list .category-item {
    background-color: var(--card-bg-color); /* Dark card color for pills */
    color: #ccc;
}

/* --- Active Category Item Styling (Dark Mode) --- */
body[data-theme='dark'] .category-item.active {
    background-color: #ffffff; /* White background on active pill */
    color: #120707; /* Dark font/icon color on active pill */
    box-shadow: 0 4px 8px rgba(255,255,255,0.15);
}

body[data-theme='dark'] .category-item.active i,
body[data-theme='dark'] .category-item.active span {
    color: #120707;
}

body[data-theme='dark'] .dish-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(255,255,255,0.1);
}

/* --- Responsive Design (Updated) --- */
@media (min-width: 768px) {
    .dish-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (min-width: 1024px) {
    .dish-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 480px) {
    .top-section {
        padding: 15px 20px 0;
    }
    /* Updated brand section size for small screens */
    .brand-logo {
        width: 30px;
        height: 30px;
    }
    .brand-name {
        font-size: 1.2rem;
    }

    /* Make category item width flexible on mobile */
    .category-item {
        min-width: initial;
    }

    .categories-list {
        padding: 15px 20px;
    }
    .dish-grid {
        padding: 0 20px;
    }
    .dish-card {
        flex-direction: row;
        padding: 10px;
    }
    .card-text-content h3 {
        font-size: 1.1em;
    }
    .card-text-content .description {
        font-size: 0.8em;
    }
    .calories-info {
        font-size: 0.75em;
    }
    .card-text-content .price {
        font-size: 1.3em;
    }
    .card-image-wrapper {
        width: 100px;
        height: 100px;
    }
}