/* Diet plan viewer overlay + "diet ready" banner */

.diet-plan-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 1080;
}
.diet-plan-overlay.d-none { display: none; }

.diet-plan-panel {
    background: #fff;
    width: 100%;
    max-width: 640px;
    max-height: 88vh;
    border-radius: 16px 16px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.2);
}
@media (min-width: 700px) {
    .diet-plan-overlay { align-items: center; }
    .diet-plan-panel { border-radius: 16px; }
}

.diet-plan-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: #8B0000;
    color: #fff;
}
.diet-plan-title { margin: 0; font-size: 1rem; }
.diet-plan-close {
    background: none; border: none; color: #fff;
    font-size: 1.6rem; line-height: 1; cursor: pointer;
}

.diet-plan-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 12px 14px;
    border-bottom: 1px solid #eee;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.diet-plan-tabs::-webkit-scrollbar { display: none; }
.diet-plan-tab {
    flex: 1 1 0;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 8px;
    border: 1px solid #e0e0e0;
    background: #f5f5f5;
    color: #444;
    border-radius: 17px;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    text-transform: capitalize;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.diet-plan-tab:hover { background: #ececec; }
.diet-plan-tab.active { background: #8B0000; color: #fff; border-color: #8B0000; font-weight: 600; }
.diet-plan-tab.active:hover { background: #7a0000; }
/* Week-summary tab: natural width (after the days), subtle accent */
.diet-plan-tab-week { flex: 0 0 auto; background: #f0eaea; border-color: #e3d3d3; color: #8B0000; font-weight: 600; }
.diet-plan-tab-week.active { background: #8B0000; color: #fff; }

.diet-plan-body { padding: 14px 18px; overflow-y: auto; }
.diet-plan-loading, .diet-plan-empty { color: #888; text-align: center; padding: 20px; }

.diet-plan-meal { margin-bottom: 18px; }
.diet-plan-meal-type {
    margin: 0 0 8px; color: #8B0000; font-weight: 600;
    border-bottom: 2px solid #f0e0e0; padding-bottom: 4px;
}
.diet-plan-option {
    background: #faf7f7; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px;
}
.diet-plan-option-label { font-weight: 600; margin-bottom: 4px; }
.diet-plan-opt-kcal { font-weight: 400; color: #999; font-size: 0.82rem; }
.diet-plan-option ul { margin: 0; padding-left: 18px; }
.diet-plan-option li { font-size: 0.9rem; margin: 2px 0; }

/* "Diet ready" banner */
.diet-ready-banner {
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    background: #8B0000;
    color: #fff;
    padding: 10px 14px;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    z-index: 1090;
    max-width: 92vw;
}
.diet-ready-banner.d-none { display: none; }
.diet-ready-text { font-size: 0.92rem; }
.diet-ready-view {
    background: #fff; color: #8B0000; border: none;
    border-radius: 6px; padding: 5px 12px; font-weight: 600; cursor: pointer;
}
.diet-ready-dismiss {
    background: none; border: none; color: #fff;
    font-size: 1.3rem; line-height: 1; cursor: pointer;
}

/* Daily nutrient summary card (weekly plan) */
.diet-plan-summary {
    background: #f3f7f4; border: 1px solid #e0e8e2; border-radius: 8px;
    padding: 10px 14px; margin: 0 0 14px;
}
.diet-plan-summary-kcal { font-size: 1.15rem; font-weight: 700; color: #2e7d32; }
.diet-plan-summary-target { font-size: 0.8rem; font-weight: 400; color: #888; }
.diet-plan-summary-macros {
    display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 6px;
    font-size: 0.85rem; color: #555;
}
.diet-plan-summary-macro b { color: #333; }
.diet-plan-summary-flags {
    margin-top: 8px; padding-top: 6px; border-top: 1px dashed #d6e0d9;
    font-size: 0.78rem; color: #8a6d00;
}
.diet-plan-flag-title { font-weight: 600; }
.diet-plan-summary-pct { color: #999; font-weight: 400; }
.diet-plan-flags-issue { color: #8a6d00; }
.diet-plan-flags-ok { color: #2e7d32; border-top-color: #d6e0d9; }

/* Interactive viewer: selectable options (radio) + ingredient dropdown */
label.diet-plan-option {
    display: block; cursor: pointer;
    border: 1px solid transparent;
    transition: border-color 0.15s ease, background 0.15s ease;
}
label.diet-plan-option:hover { background: #f1f1f1; }
/* Selected = neutral highlight (NOT green): options are all valid/equivalent, the
   green looked like "this one is right, the others wrong". The ★ marks the
   recommended option; selection is shown by the radio + a neutral grey card. */
label.diet-plan-option.selected { border-color: #d0d0d0; background: #f2f2f2; }

.diet-opt-head { display: flex; align-items: center; gap: 8px; }
.diet-opt-head .diet-opt-radio { accent-color: #8B0000; cursor: pointer; flex: 0 0 auto; margin: 0; }
.diet-opt-head .diet-plan-option-label { flex: 1 1 auto; min-width: 0; }
.diet-opt-star { color: #e0a400; }

.diet-opt-dishes { font-size: 0.84rem; color: #666; margin: 3px 0 0; }

.diet-opt-details { margin-top: 5px; }
.diet-opt-details > summary {
    cursor: pointer; color: #8B0000; font-size: 0.78rem; font-weight: 600;
    list-style-position: inside; outline: none;
}
.diet-opt-details > summary:hover { text-decoration: underline; }
.diet-opt-ings { margin-top: 4px; }
.diet-dish { margin: 4px 0; }
.diet-dish-head { font-weight: 600; font-size: 0.84rem; color: #444; }
.diet-dish-meta { font-weight: 400; color: #999; font-size: 0.8rem; }
.diet-opt-ings ul { margin: 2px 0 6px; padding-left: 18px; }
.diet-opt-ings li { font-size: 0.84rem; color: #555; margin: 1px 0; }

/* ===== Interactive recap: chosen-combination intake vs LARN + range ===== */

/* Status colors (shared): green = within range, amber = below/above */
.diet-rec-ok { color: #2e7d32; }
.diet-rec-low, .diet-rec-high { color: #b25b00; }

/* Header: big kcal + target + recommended badge + range */
.diet-rec-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.diet-rec-kcal { font-size: 1.3rem; font-weight: 800; }
.diet-rec-kcal-u { font-size: 0.9rem; font-weight: 600; }
.diet-rec-ref { font-size: 0.8rem; color: #888; }
.diet-rec-head-range { margin-left: auto; }
.diet-plan-rec-badge {
    font-size: 0.72rem; font-weight: 600; color: #2e7d32;
    background: #e3f0e5; border-radius: 10px; padding: 1px 9px;
}
.diet-rec-statusline { margin-top: 2px; font-size: 0.8rem; }
.diet-rec-allok { color: #2e7d32; font-weight: 600; }
.diet-rec-warn { color: #b25b00; font-weight: 600; }

/* Section headers */
.diet-rec-section {
    margin: 12px 0 6px; font-size: 0.72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.04em; color: #6a7a72;
}
.diet-rec-section-sub { font-weight: 400; text-transform: none; letter-spacing: 0; color: #9aa7a0; }

/* Range chip (dim, secondary) */
.diet-rec-range { color: #9aa7a0; font-weight: 400; font-size: 0.74rem; white-space: nowrap; }

/* Macronutrients: compact stat-cards */
.diet-rec-macros {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.diet-rec-card {
    background: #fff; border: 1px solid #e6ece8; border-radius: 8px;
    padding: 7px 8px; text-align: center;
}
.diet-rec-card-label { font-size: 0.72rem; color: #888; }
.diet-rec-card-val { font-size: 1rem; margin: 1px 0; color: #333; }
.diet-rec-card.diet-rec-ok .diet-rec-card-val b { color: #2e7d32; }
.diet-rec-card.diet-rec-low .diet-rec-card-val b,
.diet-rec-card.diet-rec-high .diet-rec-card-val b { color: #b25b00; }
.diet-rec-card-pct { font-size: 0.72rem; color: #9aa7a0; font-weight: 400; }
.diet-rec-card-sub { font-size: 0.7rem; min-height: 0.9em; }

/* Micronutrients: aligned two-line rows in a responsive grid */
.diet-rec-micros {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 18px;
}
.diet-rec-mline {
    display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 5px;
    font-size: 0.84rem;
}
.diet-rec-micon { width: 1em; text-align: center; }
.diet-rec-mname { color: #444; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.diet-rec-mval { white-space: nowrap; color: #333; }
.diet-rec-mval b { font-weight: 700; }
.diet-rec-mrow.diet-rec-ok .diet-rec-mval b { color: #2e7d32; }
.diet-rec-mrow.diet-rec-low .diet-rec-mval b,
.diet-rec-mrow.diet-rec-high .diet-rec-mval b { color: #b25b00; }
.diet-rec-msub {
    display: flex; gap: 8px; margin-left: calc(1em + 5px);
    font-size: 0.7rem; color: #9aa7a0; min-height: 0.85em;
}
.diet-rec-min { color: #b25b00; }

.diet-plan-rec-hint { margin-top: 10px; font-size: 0.7rem; color: #9aa7a0; }

@media (max-width: 560px) {
    .diet-rec-macros { grid-template-columns: repeat(2, 1fr); }
    .diet-rec-micros { grid-template-columns: 1fr; }
}

/* ===== Weekly summary tab (averages, kcal trend, LARN adherence, variety) ===== */
.wk-section { margin: 0 0 14px; }
.wk-section-title {
    font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
    color: #6a7a72; margin-bottom: 6px;
}

/* kcal trend: 7 bars + dashed target line */
.wk-chart {
    position: relative; display: flex; align-items: flex-end; gap: 6px;
    height: 96px; padding-top: 4px;
}
.wk-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.wk-bar { width: 62%; min-height: 2px; background: #9fc0ab; border-radius: 3px 3px 0 0; transition: height 0.2s ease; }
.wk-bar-lbl { font-size: 0.66rem; color: #999; margin-top: 4px; }
.wk-target-line { position: absolute; left: 0; right: 0; border-top: 1px dashed #8B0000; pointer-events: none; }

/* LARN adherence: per-nutrient day dots */
.wk-adq { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px 18px; }
.wk-adq-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 8px; font-size: 0.82rem; color: #444; }
.wk-adq-row.diet-rec-low .wk-adq-name { color: #b25b00; }
.wk-dots { display: inline-flex; gap: 3px; }
.wk-dot { width: 8px; height: 8px; border-radius: 50%; background: #dde3df; }
.wk-dot.on { background: #2e7d32; }
.wk-adq-count { font-size: 0.72rem; color: #999; min-width: 24px; text-align: right; }

.wk-variety { font-size: 0.85rem; color: #555; margin-top: 4px; }

@media (max-width: 560px) {
    .wk-adq { grid-template-columns: 1fr; }
}
