/* DASHBOARD LAYOUT: Sets up the main two-column structure */
.dashboard-container {
    /* Uses CSS Grid to create two columns: the Map area (1fr) and the Sidebar list (400px) */
    flex: 1; 
    display: grid;
    grid-template-columns: 1fr 400px; 
    gap: 20px;
    padding: 20px;
    box-sizing: border-box;
    overflow: hidden;
    min-height: 0; 
}

.map-column {
    /* Arranges the Controls (top) and the Map (bottom) vertically */
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
    overflow: hidden;
}

/* Styling for the "Sort By" Header */
.control-header {
    margin-bottom: 5px;
}
.control-header h3 {
    margin: 0;
    font-size: 1em;
    color: #333;
    border-bottom: 1px solid #e0e0e0; /* Clean light gray border */
    padding-bottom: 5px;
}

/* COMPACT CONTROLS (Filter/Sort Box) */
.map-controls {
    /* Styles for the "bubble" container holding all the controls */
    background: white;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border: 1px solid #ddd;
    flex-shrink: 0;
}

.controls-grid {
    /* Uses a 2-column grid to put two sliders on one line */
    display: grid;
    grid-template-columns: 1fr 1fr; 
    gap: 5px 15px; 
    align-items: end;
}

.control-item.full-width {
    /* Forces the Sort Buttons to stretch across both columns */
    grid-column: 1 / -1; 
    margin-bottom: 5px;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 5px;
}

.control-item { min-width: 0; }
.control-item label { 
    font-size: 0.75em; 
    font-weight: bold; 
    color: #555; 
    display: flex; 
    justify-content: space-between; 
    margin-bottom: 2px;
}
/* Style for the dynamic value span */
.control-item label span {
    color: #009688; /* Accent Teal for slider values */
    font-size: 1em;
}
.control-item input[type="range"] { 
    width: 100%; margin: 0; cursor: pointer; height: 25px;
}

/* Brand Toggles (Filter Buttons) */
.brand-toggles-container {
    margin-top: 8px; padding-top: 5px; border-top: none;
    display: flex; align-items: center; gap: 10px;
}
.brand-toggles-container label {
    font-size: 0.75em; font-weight: bold; color: #666; white-space: nowrap;
}
.brand-toggles {
    /* Allows the brand tags to scroll horizontally if many are present */
    display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; padding-bottom: 2px;
}
.brand-tag {
    font-size: 0.7em; background: #e8f5e9; /* Light green base */ color: #333; padding: 2px 8px;
    border-radius: 10px; cursor: pointer; border: 1px solid #c8e6c9; 
    user-select: none; transition: all 0.2s; white-space: nowrap;
}
.brand-tag.active {
    /* Active state (when a brand is selected) */
    background: #4CAF50; /* Primary Green */ color: white; border-color: #388E3C;
    font-weight: bold;
}
.brand-tag:hover { background: #d5e6d5; } 
.brand-tag.active:hover { background: #388E3C; } 


/* Map Frame */
.map-frame {
    /* Container for the actual Google Map element */
    flex: 1; background: white; padding: 5px; border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05); border: 1px solid #ddd;
    box-sizing: border-box;
}
#map { width: 100%; height: 100%; border-radius: 4px; background: #eee; }

/* --- Sidebar (List) --- */

.sidebar {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    border: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    height: 100%; 
    overflow: hidden; 
}

.sidebar-header {
    padding: 10px; 
    border-bottom: 1px solid #e0e0e0; 
    background: #f7faf7; /* Theme Light Background */ 
    flex-shrink: 0; 
}

.result-count {
    font-size: 0.8em; color: #888; text-align: center; margin-top: 5px;
}
.results-list {
    /* Ensures the list scrolls vertically if it's too long */
    flex: 1; overflow-y: auto; padding: 0;
}
.food-item-row {
    /* Styles for each individual menu item row */
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 15px; border-bottom: 1px solid #f0f0f0;
    cursor: pointer; transition: background 0.2s;
}
.food-item-row:hover { background: #f7faf7; } /* Hover background restored to theme color */
.food-info h4 { margin: 0 0 2px 0; font-size: 0.95em; color: #333; }
.food-info .meta { font-size: 0.8em; color: #888; }
.food-stats { 
    /* NEW: Flex column to stack stars and bar groups */
    display:flex;
    flex-direction: column;
    align-items: flex-end; /* Keep everything aligned to the right */
}

/* Sort Buttons */
.sort-btn-group {
    display: flex; gap: 4px; width: 100%;
}
.sort-btn {
    flex: 1; padding: 6px 0; font-size: 0.75em; background-color: #e8f5e9; /* Light green base */
    color: #4CAF50; border: 1px solid #c8e6c9; border-radius: 4px; cursor: pointer;
    text-align: center; font-weight: 600;
}
.sort-btn:hover { background-color: #c8e6c9; }
.sort-btn.active {
    background-color: #4CAF50; color: white; border-color: #388E3C;
}

/* STAR RATING */
.star-rating { 
    font-size: 1.2em; /* INCREASED SIZE for better visibility */ 
    letter-spacing: 1px; 
}
.star-rating .filled { color: #009688; /* Accent Teal */ }
.star-rating .empty { color: #ddd; }
.star-rating .half {
    /* CSS trick to render a half-star using gradient */
    background: linear-gradient(to right, #009688 50%, #ddd 50%); 
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent; 
}


/* --- NEW: NUTRITION BAR VISUALIZATION (Smaller) --- */

/* Grouping for a single bar (Label + Bar) */
.nutrition-bar-group {
    /* Constrain the bar width to fit better in the sidebar */
    width: 100px; /* Reduced width for sidebar */
    margin-bottom: 3px;
    
}
.bar-label {
    font-size: 0.7em; /* Smaller label font */
    color: #555;
    margin-bottom: 1px;
    display: flex;
    justify-content: flex-end;
}
.bar-container {
    height: 8px; /* Smaller bar height */
    background-color: #f0f0f0; 
    border-radius: 4px; /* Smaller border radius */
    overflow: hidden;
    width: 100%;
}
.bar-fill {
    height: 100%;
    transition: width 0.3s ease-in-out;
}

/* --- Bar Colors --- */
.protein-bar .bar-fill {
    background-color: #EF5350; /* Light Red */
}
.calorie-bar .bar-fill {
    background-color: #66BB6A; /* Light Green */
}

@media (max-width: 768px) {

     .map-column {
        height: 50%;
    } 
    
    .dashboard-container {
        display: flex !important;
        flex-direction: column !important;
        padding: 10px;
        gap: 0 !important;
        height: auto !important;
    }

    .map-frame {
        display: none !important;
    }

    .map-controls {
        padding: 6px 8px !important;
        margin: 0 8px 4px 8px !important;
        border-radius: 8px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }

    .map-controls > * {
        margin-bottom: 2px !important;
    }

    .control-item.full-width {
        border-bottom: none !important;
        margin-bottom: 2px !important;
        padding-bottom: 2px !important;
    }

    .sort-btn {
        font-size: 0.7em !important;
        padding: 4px 0 !important;
        border-radius: 4px;
    }

    .control-item label {
        font-size: 0.65em !important;
        margin-bottom: 0 !important;
    }

    .control-item input[type="range"] {
        height: 16px !important;
    }

    .brand-toggles-container {
        margin-top: 2px !important;
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }

    .brand-toggles {
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 3px !important;
        height: 26px !important;
        white-space: nowrap !important;
        overflow-x: auto !important;
        padding-bottom: 0 !important;
    }

    .brand-tag {
        font-size: 0.6em !important;
        padding: 1px 5px !important;
        border-radius: 10px;
        user-select: none;
    }

    .sidebar {
        width: 80vw !important;
        margin: 20px !important;
        border-radius: 8px;
        display: flex;
        flex-direction: column;
    }

    .sidebar-header {
        position: sticky;
        top: 0;
        background: white;
        z-index: 10;
        padding: 6px !important;
    }

    .results-list {
        margin: 4px 8px 0 8px !important;
        flex: 1 1 auto;
        max-height: calc(100vh - 120px) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 30px;
    }



}






