:root {
    --primary-color: #2e7d32;
    /* Green for active/primary */
    --accent-color: #ffca28;
    --bg-color: #f4f6f8;
    --card-bg: #ffffff;
    --text-color: #333333;
    --text-muted: #666666;
    --hidden-bg: #e0e0e0;
    --active-bg: #e8f5e9;
    --border-radius: 12px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    padding-bottom: 20px;
}

/* Header */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: var(--card-bg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-img {
    height: 40px;
    width: auto;
}

.logo-text {
    font-size: 1.2rem;
    font-weight: 600;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
}

/* Categories */
.category-nav {
    background-color: var(--bg-color);
    padding: 10px 0;
    border-bottom: 1px solid #ddd;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    position: sticky;
    top: 60px;
    z-index: 99;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.category-scroll {
    display: inline-flex;
    padding: 0 15px;
    gap: 10px;
}

.cat-btn {
    background-color: #f0f0f0;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.cat-btn.active {
    background-color: var(--primary-color);
    color: white;
    color: white;
    font-weight: 500;
}

/* Main Page Filter Bar */
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    max-width: 1200px;
    margin: 0 auto;
    flex-wrap: wrap;
    gap: 20px;
    position: sticky;
    top: 108px;
    /* below header (~70px) + category-nav (~48px) */
    z-index: 98;
    background-color: var(--bg-color);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

/* Admin Controls Layout */
.admin-actions-bar {
    max-width: 1200px;
    margin: 5px auto;
    padding: 0 15px;
}

.filter-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0 15px 10px;
    max-width: 1200px;
    margin: 0 auto;
    align-items: center;
}

/* Compact Inputs */
.admin-input,
.btn-primary {
    padding: 8px 12px;
    font-size: 0.9rem;
}

/* Mobile: Compact 2-column Grid */
@media (max-width: 600px) {
    .filter-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "search search"
            "category sort"
            "toggle toggle";
        gap: 10px;
    }

    .search-wrapper {
        grid-area: search;
        width: 100%;
    }

    #adminCategoryFilter {
        grid-area: category;
    }

    #adminSortSelect {
        grid-area: sort;
    }

    .toggle-switch {
        grid-area: toggle;
        justify-self: center;
        /* Center horizontally */
        display: flex;
        align-items: center;
        gap: 10px;
    }

    /* Make toggle label smaller/compact on mobile */
    .toggle-switch .label-text {
        font-size: 0.8rem;
    }

    .admin-actions-bar,
    .filter-grid {
        padding: 0 10px;
    }
}

.search-wrapper {
    flex: 1;
    min-width: 200px;
    position: relative;
}

#searchInput,
#adminSearchInput {
    width: 100%;
    padding: 8px 36px 8px 12px;
    /* right padding leaves room for the ✕ btn */
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
}

.search-clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    color: #999;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 50%;
    transition: color 0.15s, background 0.15s;
}

.search-clear-btn:hover {
    color: #333;
    background: rgba(0, 0, 0, 0.07);
}

/* Toggle Switch */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.slider {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 24px;
    background-color: #ccc;
    border-radius: 34px;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--primary-color);
}

input:checked+.slider:before {
    transform: translateX(16px);
}

input[type="checkbox"] {
    display: none;
}

.label-text {
    font-size: 0.9rem;
    user-select: none;
}

/* Meal Grid */
.meal-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 10px;
    padding: 10px 15px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Filter visibility control */
#adminCategoryFilter {
    display: none;
    /* Hidden on desktop */
}

.category-nav {
    display: block;
    /* Visible on desktop */
}

/* Mobile: Single column */
@media (max-width: 600px) {
    .meal-container {
        grid-template-columns: 1fr;
    }

    .category-scroll {
        display: none !important;
        /* Hide buttons on mobile */
    }

    /* Show dropdown on mobile */
    #adminCategoryFilter {
        display: block;
    }

    .mobile-cat-select {
        display: block !important;
    }
}

.meal-card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 8px 10px;
    /* Compact padding */
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 5px solid transparent;
    transition: transform 0.2s ease;
}

.meal-card.status-aktywny {
    background-color: var(--active-bg);
    border-left-color: var(--primary-color);
}

.meal-card.status-ukryty {
    background-color: var(--hidden-bg);
    border-left-color: #999;
    opacity: 0.8;
}

/* Category Colors */
.meal-card.cat-dania_glowne_1 {
    border-left-color: #2e7d32;
}

/* Green */
.meal-card.cat-dania_glowne_2 {
    border-left-color: #fbc02d;
}

/* Yellow/Gold */
.meal-card.cat-zupy {
    border-left-color: #d84315;
}

/* Burnt Orange */
.meal-card.cat-surowki {
    border-left-color: #8bc34a;
}

/* Light Green */
.meal-card.cat-dodatki {
    border-left-color: #78909c;
}

/* Blue Grey */
.meal-card.cat-napoje {
    border-left-color: #0288d1;
}

/* Light Blue */
.meal-card.cat-desery {
    border-left-color: #ad1457;
}

/* Pink */
.meal-card.cat-dania_glowne_zamowienie {
    border-left-color: #5e35b1;
}

/* Deep Purple */
.meal-card.cat-danie_dnia {
    border-left-color: #d32f2f;
}

/* Red */

/* Danie Dnia – full width on non-mobile */
@media (min-width: 601px) {
    .meal-card.cat-danie_dnia {
        grid-column: 1 / -1;
        background: linear-gradient(135deg, #fff8e1 0%, #fff3cd 100%);
        border-left-width: 8px;
        font-size: 1.05rem;
    }

    .meal-card.cat-danie_dnia .meal-name {
        font-size: 1.25rem;
    }

    .meal-card.cat-danie_dnia .meal-price {
        font-size: 1.25rem;
    }
}

/* Override for hidden (should stay grey/different?) 
   User said "active meals" need different backgrounds. 
   "status 'ukryty' normal white or grey".
   The current CSS for .status-ukryty defines background and border color.
   The specific category rules above will override the border-left-color because of specificity (class + class vs class + class).
   Actually, they have same specificity (.meal-card.cat-X vs .meal-card.status-ukryty). 
   So order matters. Let's make sure status-ukryty overrides if needed, OR we want the category color to show even if hidden?
   "Meal with status needs to have a different background color- lets say green, status "ukryty" normal white or grey."
   "make the backgrounds for the active meals (or maybe not the whole background but the left part of the list element - in every category little bit different."
   So the category color is likely for the ACTIVE meals. 
   Hidden meals should probably look "disabled" (grey).
   I will ensure .status-ukryty comes AFTER category colors if I want it to override, OR add !important, OR better specificity.
   I'll add specificity to the hidden state.
*/

.meal-card.status-ukryty {
    background-color: var(--hidden-bg);
    border-left-color: #999 !important;
    /* Force grey border for hidden */
    opacity: 0.8;
}

.meal-info {
    flex: 1;
    padding-right: 15px;
}

.meal-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-color);
}

.meal-meta {
    display: flex;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.meal-price {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1.1rem;
    white-space: nowrap;
}

.meal-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.fav-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: #ccc;
    transition: color 0.2s;
}

.fav-btn.is-favourite {
    color: #e91e63;
    /* Pink/Red for heart */
}

.cat-label {
    display: inline-block;
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-top: 5px;
}

/* Admin Styles */
.login-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.login-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 90%;
    max-width: 400px;
}

.admin-form-group {
    margin-bottom: 15px;
    text-align: left;
}

.admin-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    width: 100%;
}

.btn-primary:hover {
    filter: brightness(1.1);
}

.admin-dashboard {
    display: none;
    /* Hidden by default */
}

/* Match background for sticky category nav on admin */
.admin-dashboard .category-nav {
    background-color: transparent;
    border-bottom: none;
}

.admin-toolbar {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin: 20px auto;
    max-width: 800px;
    text-align: center;
}

.admin-action-btn {
    background: var(--text-color);
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    margin-top: 10px;
    margin-right: 5px;
}

.btn-delete {
    background: #d32f2f;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 200;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.toast {
    background-color: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    min-width: 200px;
    text-align: center;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.error {
    background-color: #d32f2f;
}