/* Eat That Frog – Stylesheet. Mobile first, Light/Dark über prefers-color-scheme. */

:root {
    --green-900: #14532d;
    --green-700: #2f855a;
    --green-500: #48bb78;
    --green-100: #e6f6ec;
    --bg: #f4f7f5;
    --surface: #ffffff;
    --surface-2: #f0f4f1;
    --text: #1a202c;
    --text-muted: #5f6b66;
    --border: #d9e2dc;
    --danger: #c53030;
    --danger-bg: #fff5f5;
    --info-bg: #ebf8ff;
    --info: #2b6cb0;
    --radius: 16px;
    --shadow: 0 6px 24px rgba(20, 83, 45, 0.08);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f1a14;
        --surface: #17261d;
        --surface-2: #1f3327;
        --text: #eef4f0;
        --text-muted: #9fb2a7;
        --border: #2b4334;
        --green-100: #1f3d2a;
        --danger-bg: #3b1d1d;
        --info-bg: #1b2a3a;
        --info: #8ec5ff;
        --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
    }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    padding-bottom: env(safe-area-inset-bottom);
}

a { color: var(--green-700); }

.hidden { display: none !important; }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.muted { color: var(--text-muted); }

/* ---------- Auth-Seiten ---------- */
.auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px 16px;
}

.auth__card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px 24px;
}

.auth__switch {
    text-align: center;
    margin: 20px 0 0;
    color: var(--text-muted);
}

.brand { text-align: center; margin-bottom: 24px; }
.brand__icon { display: block; margin: 0 auto 8px; }
.brand__title { font-size: 1.6rem; margin: 0 0 4px; }
.brand__claim { margin: 0; color: var(--text-muted); }

/* ---------- Alerts ---------- */
.alert {
    padding: 12px 14px;
    border-radius: 10px;
    margin: 0 0 16px;
    font-size: 0.95rem;
}
.alert--error { background: var(--danger-bg); color: var(--danger); }
.alert--info { background: var(--info-bg); color: var(--info); }

/* ---------- Formulare ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field--inline { flex-direction: row; align-items: center; gap: 10px; }
.field__label { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }

.field__input {
    font: inherit;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text);
    width: 100%;
}
/* iOS Safari: Datum/Zeit-Felder haben eine feste Eigenbreite und ignorieren width:100% ohne appearance:none */
input[type="time"].field__input,
input[type="date"].field__input {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    min-width: 0;
    max-width: 100%;
    min-height: 48px;
    text-align: left;
}
.field__input:focus { outline: 2px solid var(--green-500); outline-offset: 1px; border-color: var(--green-500); }
.field__input--big { font-size: 1.15rem; padding: 16px; }

.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }

textarea.field__input { resize: vertical; min-height: 60px; }

input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--green-700); }

/* ---------- Buttons ---------- */
.btn {
    font: inherit;
    font-weight: 600;
    padding: 12px 18px;
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    transition: transform 0.08s ease, background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn--primary { background: var(--green-700); color: #fff; }
.btn--primary:hover { background: var(--green-900); }
.btn--ghost { background: transparent; color: var(--green-700); border-color: var(--border); }
.btn--ghost:hover { background: var(--green-100); }
.btn--block { width: 100%; }
.btn--small { padding: 6px 12px; font-size: 0.85rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- App-Layout ---------- */
.app { max-width: 640px; margin: 0 auto; padding: 0 16px 40px; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0 8px;
    padding-top: calc(16px + env(safe-area-inset-top));
}
.topbar__brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; }

.content { display: flex; flex-direction: column; gap: 16px; }

.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}
.card--today {
    background: linear-gradient(150deg, var(--green-700), var(--green-900));
    color: #fff;
}
.card--today .field__label { color: rgba(255, 255, 255, 0.85); }
.card--today .field__input { background: rgba(255, 255, 255, 0.95); color: #1a202c; border-color: transparent; }
.card--today .btn--primary { background: #fff; color: var(--green-900); }
.card--today .btn--primary:hover { background: var(--green-100); }
.card--today .btn--ghost { color: #fff; border-color: rgba(255, 255, 255, 0.4); }
.card--today .btn--ghost:hover { background: rgba(255, 255, 255, 0.12); }

.card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card__title { margin: 0; font-size: 1.15rem; }
.card__date { font-size: 0.9rem; opacity: 0.85; white-space: nowrap; }

.frog-empty__text { margin: 0 0 16px; opacity: 0.95; }

/* ---------- Heutiger Frosch ---------- */
.frog { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: start; }
.frog__actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.frog__body { min-width: 0; }
.frog__title { margin: 0; font-size: 1.35rem; font-weight: 700; overflow-wrap: anywhere; }
.frog__notes { margin: 6px 0 0; opacity: 0.9; white-space: pre-wrap; overflow-wrap: anywhere; }
.frog__notes:empty { display: none; }
.frog__status { margin: 8px 0 0; font-size: 0.9rem; opacity: 0.85; }

.frog__check {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.8);
    background: transparent;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background 0.2s ease, transform 0.1s ease;
    -webkit-tap-highlight-color: transparent;
}
.frog__check:active { transform: scale(0.94); }
.frog__checkmark {
    width: 26px;
    height: 14px;
    border-left: 4px solid #fff;
    border-bottom: 4px solid #fff;
    transform: rotate(-45deg) translate(2px, -3px);
    opacity: 0;
    transition: opacity 0.2s ease;
}
.frog__check[aria-pressed="true"] { background: var(--green-500); border-color: var(--green-500); }
.frog__check[aria-pressed="true"] .frog__checkmark { opacity: 1; }
.frog--done .frog__title { text-decoration: line-through; opacity: 0.8; }

/* ---------- Statistik ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 8px;
    text-align: center;
    display: flex;
    flex-direction: column;
}
.stat__value { font-size: 1.6rem; font-weight: 800; color: var(--green-700); line-height: 1.1; }
.stat__label { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

/* ---------- Verlauf ---------- */
.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.history__item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid var(--border);
}
.history__item:first-child { border-top: 0; }
.history__mark {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border);
}
.history__item--done .history__mark { background: var(--green-500); }
.history__body { display: flex; flex-direction: column; min-width: 0; }
.history__date { font-size: 0.78rem; color: var(--text-muted); }
.history__title { overflow-wrap: anywhere; }
.history__item--done .history__title { text-decoration: line-through; color: var(--text-muted); }

/* ---------- Einstellungen ---------- */
.settings-group { padding: 14px 0; border-top: 1px solid var(--border); min-width: 0; }
.settings-group:first-of-type { border-top: 0; padding-top: 0; }
.settings-group__title { margin: 0 0 10px; font-size: 1rem; }

/* ---------- Geräte ---------- */
.devices { list-style: none; margin: 0 0 12px; padding: 0; }
.device {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid var(--border);
}
.device:first-child { border-top: 0; }
.device__body { display: flex; flex-direction: column; min-width: 0; }
.device__label { font-weight: 600; }
.device--current .device__label::after { content: " · dieses Gerät"; font-weight: 400; color: var(--green-700); }
.device__meta { font-size: 0.78rem; color: var(--text-muted); }

@media (max-width: 420px) {
    .field-row { grid-template-columns: 1fr; }
    .stat__value { font-size: 1.3rem; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
