/* ============================================================================
   ADD FOOD MODAL — professional redesign (blue + gold + white)
   Loads last so it overrides the older fragmented tab styles + any reddish tint.
   ============================================================================ */

/* Modal shell — FIXED size so it never resizes as you switch tabs (desktop).
   Mobile full-screen is handled by mobile-shell.css which loads after this. */
#food-modal .food-modal-content,
.food-modal-content {
    background: #0f1a2e !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    border-radius: 18px !important;
    box-shadow: 0 24px 60px rgba(0,0,0,0.5) !important;
    overflow: hidden !important;
    width: 560px !important;
    max-width: 94vw !important;
    height: 600px !important;
    max-height: 88vh !important;
    display: flex !important;
    flex-direction: column !important;
}
/* Body fills the fixed height and scrolls — every tab is the same size */
#food-modal .food-modal-content .modal-body,
.food-modal-content .modal-body {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    min-height: 0 !important;
}

/* Header */
.food-modal-content .modal-header {
    padding: 1.25rem 1.5rem !important;
    border-bottom: 1px solid rgba(255,255,255,0.07) !important;
    background: linear-gradient(180deg, rgba(200,160,60,0.05), transparent) !important;
}
.food-modal-content .modal-header h2 {
    font-size: 1.15rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.3px !important;
    color: #fff !important;
}
/* Close uses the app-wide canonical gold "X" (styles.css) — no per-page override. */

/* "Add to:" meal selector — clean pill row */
.fmt-meal-selector {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    padding: 1rem 1.5rem 0.5rem !important;
    flex-wrap: wrap !important;
}
.fmt-meal-label {
    font-size: 0.72rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.08em !important;
    color: rgba(255,255,255,0.4) !important;
    font-weight: 600 !important;
}
.fmt-meal-btns { display: flex !important; gap: 0.5rem !important; flex-wrap: wrap !important; }
.fmt-meal-btn {
    padding: 0.5rem 1rem !important;
    border-radius: 10px !important;
    background: rgba(255,255,255,0.04) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    color: rgba(255,255,255,0.7) !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.18s !important;
}
.fmt-meal-btn:hover { border-color: rgba(200,160,60,0.5) !important; color: #fff !important; }
.fmt-meal-btn.active {
    background: var(--gold, #c8a03c) !important;
    border-color: var(--gold, #c8a03c) !important;
    color: #0a1628 !important;
}

/* Segmented tab bar — modern, no underline-only, clear active state, NO red */
.food-modal-tabs {
    display: flex !important;
    gap: 4px !important;
    margin: 0.75rem 1.5rem 0 !important;
    padding: 4px !important;
    background: rgba(0,0,0,0.25) !important;
    border-radius: 12px !important;
    border: 1px solid rgba(255,255,255,0.06) !important;
}
.fmt-tab {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    padding: 0.6rem 0.4rem !important;
    border: none !important;
    border-radius: 9px !important;
    background: transparent !important;
    color: rgba(255,255,255,0.55) !important;
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.18s !important;
    white-space: nowrap !important;
    text-align: center !important;
}
.fmt-tab:hover:not(.active) {
    color: #fff !important;
    background: rgba(255,255,255,0.04) !important;
}
.fmt-tab.active {
    background: var(--gold, #c8a03c) !important;
    color: #0a1628 !important;
    border-bottom: none !important;       /* kill the old underline style */
    box-shadow: 0 2px 8px rgba(200,160,60,0.3) !important;
}

/* Body + search box */
.food-modal-content .modal-body { padding: 1.25rem 1.5rem 1.5rem !important; }
.food-modal-content .search-box input,
.usda-search-box input,
#usda-search-input {
    width: 100% !important;
    padding: 0.85rem 1rem !important;
    border-radius: 12px !important;
    background: rgba(255,255,255,0.05) !important;
    border: 1px solid rgba(255,255,255,0.12) !important;
    color: #fff !important;
    font-size: 0.95rem !important;
    transition: border-color 0.18s, background 0.18s !important;
}
.food-modal-content .search-box input::placeholder,
#usda-search-input::placeholder { color: rgba(255,255,255,0.35) !important; }
.food-modal-content .search-box input:focus,
#usda-search-input:focus {
    outline: none !important;
    border-color: var(--gold, #c8a03c) !important;
    background: rgba(255,255,255,0.07) !important;
}

.usda-hint {
    font-size: 0.72rem !important;
    color: rgba(255,255,255,0.4) !important;
    margin: 0.6rem 2px 0.9rem !important;
}
.usda-empty {
    text-align: center !important;
    color: rgba(255,255,255,0.35) !important;
    padding: 2.5rem 1rem !important;
    font-size: 0.9rem !important;
}

/* Quick-pick category chips + result rows */
.food-category-btn {
    padding: 0.4rem 0.85rem !important;
    border-radius: 9px !important;
    background: rgba(255,255,255,0.04) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    color: rgba(255,255,255,0.65) !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.15s !important;
}
.food-category-btn.active {
    background: rgba(200,160,60,0.18) !important;
    border-color: var(--gold, #c8a03c) !important;
    color: var(--gold, #c8a03c) !important;
}
.food-result-item, .usda-result-item {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0.8rem 1rem !important;
    border-radius: 10px !important;
    background: rgba(255,255,255,0.03) !important;
    border: 1px solid rgba(255,255,255,0.06) !important;
    margin-bottom: 0.5rem !important;
    cursor: pointer !important;
    transition: all 0.15s !important;
}
.food-result-item:hover, .usda-result-item:hover {
    background: rgba(200,160,60,0.08) !important;
    border-color: rgba(200,160,60,0.4) !important;
}
.food-cals { color: var(--gold, #c8a03c) !important; font-weight: 700 !important; }
.food-cals span { color: rgba(255,255,255,0.4) !important; font-weight: 400 !important; font-size: 0.7rem !important; margin-left: 2px; }

/* Authoritative food-result list layout — stops multi-line names overlapping the next
   box (the min-height + competing !important rules were clipping tall rows). Each item is
   a self-contained card that grows to fit; long names wrap inside it. */
.food-results, .usda-results, #food-results { display: flex !important; flex-direction: column !important; gap: 0.5rem !important; }
.food-result-item, .usda-item {
    flex: 0 0 auto !important;        /* size to content — never shrink to fit the scroll box (was clipping names) */
    align-items: center !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0.7rem 0.85rem !important;
    background: rgba(255,255,255,0.05) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    overflow: visible !important;
}
.food-result-item .food-details, .usda-item .food-details { min-width: 0 !important; flex: 1 1 auto !important; }
.food-result-item .food-details strong { display: block; overflow-wrap: anywhere; white-space: normal; }
.food-result-item .food-cals, .usda-item .food-cals { flex: 0 0 auto !important; }
