/* ============================================================================
   gewissenapp.de — App-Stylesheet
   Farben: Navy #1C2B45 · Gold #D4A574 · Sage #A8B8A8 · Cream #F5F1EC
   ============================================================================ */

:root {
    --navy:        #1C2B45;
    --navy-light:  #2A3B5C;
    --gold:        #D4A574;
    --gold-dark:   #B58858;
    --sage:        #A8B8A8;
    --cream:       #F5F1EC;
    --white:       #FFFFFF;
    --error:       #D26060;
    --success:     #6FA876;
}

* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    background: var(--cream);
    color: var(--navy);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    min-height: 100vh;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

#root { min-height: 100vh; display: flex; flex-direction: column; }

/* ---- Auth-Screen ---- */
.auth-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 24px;
    background: linear-gradient(180deg, var(--navy) 0%, var(--navy-light) 100%);
    color: var(--white);
}

.auth-logo {
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--gold);
    margin: 0 0 8px;
    letter-spacing: -0.5px;
}

.auth-tagline {
    font-size: 0.95rem;
    color: var(--sage);
    margin: 0 0 40px;
    text-align: center;
}

.auth-card {
    background: var(--white);
    color: var(--navy);
    border-radius: 20px;
    padding: 28px 24px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: var(--cream);
    border-radius: 12px;
    padding: 4px;
}

.auth-tab {
    flex: 1;
    padding: 10px 16px;
    border: 0;
    background: transparent;
    color: var(--navy);
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-tab.active {
    background: var(--navy);
    color: var(--white);
}

.input-group { margin-bottom: 16px; }

.input-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--navy);
    margin-bottom: 6px;
    font-weight: 500;
}

.input-group input {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px dashed var(--sage);
    border-radius: 16px;
    background: var(--cream);
    color: var(--navy);
    font-size: 1rem;
    transition: border-color 0.2s, border-style 0.2s;
    -webkit-appearance: none;
}

.input-group input:focus {
    outline: none;
    border: 1.5px solid var(--gold);
    background: var(--white);
}

.btn {
    width: 100%;
    padding: 14px 16px;
    border: 0;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--gold);
    color: var(--navy);
}
.btn-primary:hover { background: var(--gold-dark); color: var(--white); }
.btn-primary:disabled { background: var(--sage); cursor: not-allowed; }

.btn-secondary {
    background: transparent;
    color: var(--gold);
    border: 1.5px solid var(--gold);
}

.msg {
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.9rem;
    margin: 12px 0;
}
.msg-error    { background: #FFEDED; color: var(--error); }
.msg-success  { background: #E8F5E9; color: var(--success); }

/* ---- App-Screen ---- */
.app-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 8px 24px;
}

.app-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--navy);
    margin: 0;
}

.user-info {
    font-size: 0.85rem;
    color: var(--sage);
}

.card {
    background: var(--white);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(28, 43, 69, 0.06);
}

.card h2 {
    font-size: 1.1rem;
    color: var(--navy);
    margin: 0 0 12px;
}

.coming-soon {
    color: var(--sage);
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.btn-link {
    background: transparent;
    border: 0;
    color: var(--gold);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 8px;
}

/* ---- Tracker-spezifisch ---- */
.balance-card {
    background: var(--navy);
    color: var(--white);
}
.balance-card h2 { color: var(--gold); }
.balance-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}
.balance-row > div {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.bal-label {
    font-size: 0.78rem;
    color: var(--sage);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.bal-val {
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 4px;
}
.bal-pos { color: var(--gold); }
.bal-neg { color: #FF9966; }

/* Bewertungs-Badge unter Ziel-Info */
.bewertung {
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.92rem;
    line-height: 1.4;
    border-left: 4px solid;
}
.bewertung.badge-ok   { background: #E8F5E9; color: #2E7D32; border-color: #6FB872; }
.bewertung.badge-warn { background: #FFEDED; color: #B23A3A; border-color: #D26060; }
.bewertung.badge-info { background: #EDF4F9; color: #1F5C8A; border-color: #5B9DD9; }

.macro-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(168, 184, 168, 0.3);
}
.macro-row > div {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.macro-label {
    font-size: 0.72rem;
    color: var(--sage);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.macro-val {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 2px;
    color: var(--white);
}

.energy-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.energy-row label {
    flex: 1;
    font-size: 0.9rem;
    color: var(--navy);
}
.energy-row input {
    width: 90px;
    padding: 8px 10px;
    border: 1.5px dashed var(--sage);
    border-radius: 10px;
    background: var(--cream);
    color: var(--navy);
    font-size: 0.95rem;
    text-align: right;
    -webkit-appearance: none;
    transition: border-color 0.2s, border-style 0.2s;
}
.energy-row input:focus {
    outline: none;
    border: 1.5px solid var(--gold);
    background: var(--white);
}
.energy-row span {
    width: 28px;
    color: var(--sage);
    font-size: 0.9rem;
}

.food-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--cream);
}
.food-row:last-child { border-bottom: 0; }
.food-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}
.food-info strong {
    font-size: 1.05rem;
    color: var(--navy);
}
.food-meta {
    font-size: 0.95rem;
    color: var(--navy);
    margin-top: 4px;
    font-weight: 500;
}
.food-meta-sep {
    color: var(--gold);
    margin: 0 6px;
    font-weight: 700;
}
.btn-del {
    background: transparent;
    border: 0;
    color: var(--error);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 8px;
    line-height: 1;
}
.btn-del:hover { color: #A04040; }

/* ---- Bottom-Navigation ---- */
.app-screen { padding-bottom: 80px; }
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--navy);
    display: flex;
    border-top: 1px solid var(--navy-light);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 100;
}
.nav-btn {
    flex: 1;
    background: transparent;
    border: 0;
    color: var(--sage);
    padding: 12px 4px;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
}
.nav-btn.active { color: var(--gold); font-weight: 700; }

/* ---- Datum-Navigation ---- */
.date-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0 16px;
    position: relative;
}
.date-btn {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: var(--white);
    color: var(--navy);
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(28, 43, 69, 0.1);
}
.date-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.date-label {
    flex: 1;
    display: inline-block;
    padding: 10px 16px;
    background: var(--white);
    border-radius: 12px;
    color: var(--navy);
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(28, 43, 69, 0.06);
    border: 0;
    font-size: 1rem;
    text-align: center;
    font-family: inherit;
}
.date-label:hover { background: var(--cream); }

/* date-pick liegt versteckt EXAKT über dem Label — so öffnet der Picker dort */
#date-pick {
    position: absolute;
    left: 52px;          /* nach dem ← Button (40px + 12px gap) */
    right: 52px;         /* vor dem → Button */
    top: 8px;
    bottom: 16px;
    opacity: 0;
    pointer-events: none;
    border: 0;
    background: transparent;
}

/* ---- Charts (freundlich) ---- */
:root {
    --chart-consumed:  var(--gold);   /* Aufgenommen */
    --chart-burned:    var(--navy);   /* Verbrannt */
    --chart-target:    #6FB872;       /* Tagesziel — grün */
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.9rem;
    color: var(--navy);
    margin-bottom: 14px;
}
.dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}
.dot-gold  { background: var(--chart-consumed); }
.dot-navy  { background: var(--chart-burned); }
.dot-sage  { background: var(--chart-target); }

.chart {
    display: flex;
    gap: 6px;
    height: 230px;
    padding: 16px 12px 8px;
    overflow-x: auto;
    background: #FAFBFC;
    border-radius: 12px;
    border: 1px solid #ECEEF1;
}
.chart-year { gap: 8px; }
.chart-col {
    flex: 1;
    min-width: 36px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}
.chart-col.empty { opacity: 0.4; }
.bars {
    flex: 1;
    display: flex;
    align-items: flex-end;
    gap: 2px;
    position: relative;
    padding: 0 2px;
    overflow: hidden;
}
.bar {
    flex: 1;
    border-radius: 4px 4px 0 0;
    transition: opacity 0.2s, transform 0.2s;
}
.bar.zero { display: none; }

.nav-btn.nav-info {
    font-size: 1.25rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 4px;
}

/* ===== INFO / CHAT ===== */
.video-wrap {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 10px;
    background: #000;
}
.video-wrap iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: 0;
}
.chat-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 4px;
    margin-bottom: 12px;
}
.chat-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    line-height: 1.45;
    font-size: 0.95rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.chat-msg.user {
    align-self: flex-end;
    background: var(--navy);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-msg.assistant {
    align-self: flex-start;
    background: #F1F4F1;
    color: var(--navy);
    border-bottom-left-radius: 4px;
}
.chat-msg.pending {
    opacity: 0.6;
    font-style: italic;
}
.chat-input-row {
    display: flex;
    gap: 8px;
}
.chat-input-row input {
    flex: 1;
    padding: 12px 14px;
    border: 1.5px solid var(--sage);
    border-radius: 12px;
    background: var(--cream);
    color: var(--navy);
    font-size: 1rem;
}
.chat-input-row button {
    padding: 0 18px;
    background: var(--gold);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
}
.chat-input-row button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.chat-hint {
    font-size: 0.82rem;
    color: #6B7B6B;
    margin-bottom: 8px;
}
.bar:hover {
    opacity: 0.85;
    transform: translateY(-2px);
}
.bar-gold { background: var(--chart-consumed); }
.bar-navy { background: var(--chart-burned); }
.target-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--chart-target);
    z-index: 2;
    border-radius: 1px;
    pointer-events: none;
    overflow: visible;
}
/* "Ziel"-Label nur EINMAL am Anfang, deutlich ÜBER der Linie */
.target-line::before { content: ''; }
.chart-col:first-child .target-line::before {
    content: 'Ziel';
    position: absolute;
    left: 2px;
    top: -14px;
    color: var(--chart-target);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
    background: transparent;
    padding: 0;
    white-space: nowrap;
}
.chart-label {
    font-size: 0.78rem;
    color: var(--navy);
    margin-top: 8px;
    text-align: center;
    line-height: 1.2;
    font-weight: 500;
}
