/* Kysunja Web – Design angelehnt an die App (Theme "Blaue Nacht").
   Farbreferenzen aus app/.../ui/theme/Color.kt + Theme.kt */

:root {
    --night: #0B1220;
    --night-deep: #08101C;
    --surface: #101A2C;
    --surface-variant: #1B2D49;
    --surface-2: #16233a;
    --primary: #5A9BFF;        /* BlueAccent  */
    --primary-container: #1F4F95; /* DeepBlue – vorhergesagte Periode */
    --secondary: #59D8FF;      /* CyanAccent – Eisprung */
    --rose: #EA6C93;           /* RosePeriod – bestätigte Periode */
    --text: #F2F5FB;
    --text-dim: #B9C7E1;
    --line: rgba(185, 199, 225, 0.16);
    --ovulation: #4A95FF;
    --radius-s: 16px;
    --radius-m: 22px;
    --radius-l: 28px;
    --shadow: 0 14px 40px rgba(0, 0, 0, 0.40);
    color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    min-height: 100vh;
    font-family: "Segoe UI", Roboto, "Helvetica Neue", system-ui, -apple-system, sans-serif;
    color: var(--text);
    background:
        linear-gradient(180deg, var(--night-deep) 0%, var(--night) 45%, var(--surface-variant) 140%) fixed;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

/* Hintergrund-"Orbs" wie KysunjaBackdrop */
.atmosphere {
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(20px);
}
.orb-blue {
    width: 62vw; height: 62vw;
    left: -12vw; top: -8vh;
    background: rgba(90, 155, 255, 0.16);
}
.orb-cyan {
    width: 48vw; height: 48vw;
    left: 60vw; top: 65vh;
    background: rgba(89, 216, 255, 0.09);
}

/* ---------- Topbar / Navigation ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(11, 18, 32, 0.82);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}
.topbar-inner, .tabbar-inner, .content, .auth-wrap {
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
    padding-left: 18px;
    padding-right: 18px;
}
.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    padding-bottom: 12px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
}
.brand-logo { width: 34px; height: 34px; border-radius: 10px; }
.brand-name { font-weight: 700; font-size: 1.2rem; letter-spacing: 0.2px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-user { color: var(--text-dim); font-size: 0.95rem; }

.tabbar { border-top: 1px solid var(--line); overflow-x: auto; }
.tabbar-inner {
    display: flex;
    gap: 4px;
    padding-top: 6px;
    padding-bottom: 6px;
}
.tab {
    flex: 0 0 auto;
    padding: 8px 14px;
    border-radius: 999px;
    text-decoration: none;
    color: var(--text-dim);
    font-size: 0.92rem;
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.tab:hover { color: var(--text); background: rgba(90, 155, 255, 0.10); }
.tab-active { color: #fff; background: var(--primary-container); }

/* ---------- Layout ---------- */
.content {
    position: relative;
    z-index: 1;
    padding-top: 22px;
    padding-bottom: 48px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.sitefooter {
    position: relative;
    z-index: 1;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.82rem;
    padding: 24px 18px 36px;
}

.page-title { margin: 4px 0 0; font-size: 1.5rem; font-weight: 700; }
.page-subtitle { margin: 0; color: var(--text-dim); font-size: 0.95rem; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-m);
    padding: 18px;
    box-shadow: var(--shadow);
}
.card-title { margin: 0 0 12px; font-size: 1.05rem; font-weight: 600; }
.card + .card { margin-top: 0; }
.muted { color: var(--text-dim); }
.small { font-size: 0.85rem; }

/* ---------- Hero (Begrüßung + Vorhersage) ---------- */
.hero {
    border: none;
    border-radius: var(--radius-l);
    padding: 24px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-container) 100%);
    color: #fff;
}
.hero-greeting { font-size: 1.05rem; opacity: 0.85; margin: 0; }
.hero-headline { font-size: 1.6rem; font-weight: 800; margin: 8px 0 6px; }
.hero-support { font-size: 1.02rem; opacity: 0.9; margin: 0; }
.hero-source {
    margin-top: 14px;
    font-size: 0.88rem;
    opacity: 0.85;
    border-top: 1px solid rgba(255,255,255,0.25);
    padding-top: 12px;
}

/* ---------- Stat-Kacheln ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.stat {
    background: var(--surface-variant);
    border-radius: var(--radius-s);
    padding: 14px 16px;
}
.stat-value { font-size: 1.5rem; font-weight: 700; }
.stat-label { color: var(--text-dim); font-size: 0.85rem; }

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(90, 155, 255, 0.12);
    border: 1px solid var(--line);
    font-size: 0.88rem;
    color: var(--text);
}
.chip .emoji { font-size: 1rem; line-height: 1; }
.chip-rose  { background: rgba(234, 108, 147, 0.18); }
.chip-cyan  { background: rgba(89, 216, 255, 0.16); }
.chip-blue  { background: rgba(31, 79, 149, 0.45); }

/* ---------- Kalender ---------- */
.cal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 12px;
}
.cal-month { font-size: 1.25rem; font-weight: 700; }
.cal-nav { display: flex; gap: 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow {
    text-align: center;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-dim);
    padding-bottom: 4px;
}
.cal-cell {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: var(--radius-s);
    background: var(--surface-2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    gap: 3px;
}
.cal-cell.empty { background: transparent; }
.cal-cell.is-period { background: rgba(234, 108, 147, 0.85); color: #fff; }
.cal-cell.is-predicted { background: var(--primary-container); color: #fff; }
.cal-cell.is-today { outline: 2px solid var(--text-dim); outline-offset: -2px; }
.cal-markers { display: flex; flex-direction: column; align-items: center; gap: 2px; height: 10px; }
.marker-ovulation { width: 22px; height: 4px; border-radius: 999px; background: var(--ovulation); }
.marker-dot { width: 7px; height: 7px; border-radius: 50%; background: #8D95A3; }
.cal-cell.is-period .marker-dot { background: #E3E7EE; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 16px; }
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 0.82rem; color: var(--text-dim); }
.legend-swatch { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.sw-rose { background: var(--rose); }
.sw-blue { background: var(--primary-container); }
.sw-cyan { background: var(--secondary); }
.sw-dot  { background: #8D95A3; }
.sw-today { background: transparent; border: 2px solid var(--text-dim); }

/* ---------- Listen / Timeline ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.row {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(27, 45, 73, 0.45);
    border-radius: var(--radius-m);
    padding: 14px 16px;
}
.row-badge {
    flex: 0 0 auto;
    width: 46px; height: 46px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    background: rgba(90, 155, 255, 0.14);
    color: var(--primary);
}
.row-badge.rose { background: rgba(234, 108, 147, 0.16); color: var(--rose); }
.row-body { flex: 1 1 auto; min-width: 0; }
.row-title { font-weight: 600; }
.row-sub { color: var(--text-dim); font-size: 0.88rem; }
.row-note {
    margin-top: 8px;
    background: rgba(27, 45, 73, 0.5);
    border-radius: 14px;
    padding: 10px 12px;
    font-size: 0.9rem;
}
.row-note .label { display: block; color: var(--text-dim); font-size: 0.75rem; margin-bottom: 2px; }

.timeline-day {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-m);
    padding: 16px;
}
.timeline-date { font-weight: 700; margin-bottom: 4px; }
.timeline-cat { margin-top: 10px; }
.timeline-cat h4 { margin: 0 0 6px; font-size: 0.8rem; color: var(--text-dim); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 18px;
    border-radius: 999px;
    border: none;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    color: #fff;
    background: var(--primary);
    transition: filter 0.15s, background 0.15s;
}
.btn:hover { filter: brightness(1.08); }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--text-dim); border: 1px solid var(--line); }
.btn-ghost:hover { color: var(--text); background: rgba(90, 155, 255, 0.10); filter: none; }
.btn-small { padding: 7px 14px; font-size: 0.85rem; }

/* ---------- Definition rows (Einstellungen) ---------- */
.deflist { display: flex; flex-direction: column; }
.defrow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
}
.defrow:last-child { border-bottom: none; }
.defrow .k { color: var(--text-dim); }
.defrow .v { font-weight: 600; text-align: right; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; }
.pill-on { background: rgba(89, 216, 255, 0.18); color: var(--secondary); }
.pill-off { background: rgba(185, 199, 225, 0.14); color: var(--text-dim); }

/* ---------- Leerer Zustand ---------- */
.empty {
    text-align: center;
    color: var(--text-dim);
    padding: 28px 12px;
}

/* ---------- Login ---------- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    padding: 24px;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-l);
    padding: 32px 28px;
    box-shadow: var(--shadow);
}
.auth-logo { width: 72px; height: 72px; border-radius: 20px; display: block; margin: 0 auto 16px; }
.auth-title { text-align: center; font-size: 1.5rem; font-weight: 800; margin: 0 0 6px; }
.auth-sub { text-align: center; color: var(--text-dim); margin: 0 0 24px; font-size: 0.95rem; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.85rem; color: var(--text-dim); margin-bottom: 6px; }
.field input {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-s);
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text);
    font-size: 1rem;
}
.field input:focus { outline: none; border-color: var(--primary); }
.alert {
    background: rgba(234, 108, 147, 0.16);
    border: 1px solid rgba(234, 108, 147, 0.4);
    color: #ffd5e1;
    border-radius: var(--radius-s);
    padding: 11px 14px;
    margin-bottom: 18px;
    font-size: 0.9rem;
}
.readonly-banner {
    display: flex;
    gap: 8px;
    align-items: center;
    background: rgba(89, 216, 255, 0.10);
    border: 1px solid rgba(89, 216, 255, 0.25);
    border-radius: var(--radius-s);
    padding: 10px 14px;
    color: var(--text-dim);
    font-size: 0.85rem;
}

@media (max-width: 520px) {
    .brand-name { display: none; }
    .hero-headline { font-size: 1.35rem; }
    .cal-grid { gap: 4px; }
    .cal-cell { font-size: 0.85rem; border-radius: 12px; }
}
