/* Gamingwochenende – dunkles Design, zuerst fürs Handy gebaut */

:root {
    --bg: #14111f;
    --bg-2: #1c1830;
    --card: #221d38;
    --line: #342c55;
    --text: #ece9f6;
    --muted: #9d96b8;
    --accent: #8b5cf6;
    --accent-2: #22d3ee;
    --yes: #22c55e;
    --maybe: #f59e0b;
    --no: #ef4444;
    --heat-1: #2a3a3a;
    --heat-2: #1f5a46;
    --heat-3: #1c8a55;
    --heat-4: #22c55e;
    --ferien: #f472b6;
    --ferien-nl: #fb923c;
    --holiday: #facc15;
    --radius: 14px;
    color-scheme: dark;
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    background: radial-gradient(1200px 600px at 80% -10%, #2a1f55 0%, transparent 60%), var(--bg);
    background-attachment: fixed;
    color: var(--text);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
    padding-bottom: env(safe-area-inset-bottom);
}

a { color: var(--accent-2); }
h1 { font-size: 1.6rem; margin: 1.2rem 0 .6rem; }
h2 { font-size: 1.2rem; margin: 1.6rem 0 .6rem; }
h3 { font-size: 1.05rem; margin: 1.2rem 0 .4rem; }
code { background: var(--bg-2); padding: .1em .4em; border-radius: 6px; word-break: break-all; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }

/* ---------- Kopfzeile ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .4rem 1rem;
    padding: calc(.6rem + env(safe-area-inset-top)) 1rem .6rem;
    background: rgba(20, 17, 31, .85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.brand { color: var(--text); font-weight: 700; text-decoration: none; }
.topbar nav { display: flex; flex-wrap: wrap; gap: .2rem; }
.topbar nav a {
    color: var(--muted);
    text-decoration: none;
    padding: .35rem .7rem;
    border-radius: 999px;
    font-size: .92rem;
}
.topbar nav a.active, .topbar nav a:hover { color: var(--text); background: var(--card); }

.container { max-width: 1100px; margin: 0 auto; padding: 0 1rem 3rem; }
.container.narrow { max-width: 440px; }

/* ---------- Bausteine ---------- */

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem;
}
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .6rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--bg-2);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: linear-gradient(135deg, var(--accent), #6d28d9); border-color: transparent; }
.btn.subtle { background: transparent; }
.btn.danger { color: #fca5a5; }
.btn.small { padding: .35rem .7rem; font-size: .85rem; }

.form { display: grid; gap: .9rem; }
.form label { display: grid; gap: .3rem; font-size: .9rem; color: var(--muted); }
.form label.check { display: flex; gap: .7rem; align-items: flex-start; color: var(--text); font-size: .95rem; }
.form label.check input { width: 1.2rem; height: 1.2rem; margin-top: .15rem; flex: none; accent-color: var(--accent); }
.cron-url { display: block; padding: .5rem .7rem; margin: .4rem 0; }
.inline-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .8rem 0; }
.cron-help { margin-top: 1rem; }
.cron-help summary { cursor: pointer; color: var(--accent-2); }
.cron-help ol { padding-left: 1.2rem; }
.cron-help li { margin: .4rem 0; }
input, select {
    width: 100%;
    padding: .65rem .8rem;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--text);
    font: inherit;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.flash { padding: .75rem 1rem; border-radius: 10px; margin: 1rem 0; border: 1px solid var(--line); background: var(--bg-2); }
.flash.error { border-color: var(--no); color: #fecaca; }
.flash.success { border-color: var(--yes); color: #bbf7d0; }

.tag {
    display: inline-block;
    font-size: .75rem;
    padding: .1rem .5rem;
    border-radius: 999px;
    margin: .2rem .2rem 0 0;
    border: 1px solid var(--line);
    color: var(--muted);
}
.tag.holiday, .tag.bridge { color: var(--holiday); border-color: rgba(250, 204, 21, .4); }
.tag.ferien { color: var(--ferien); border-color: rgba(244, 114, 182, .4); }
.tag.ferien-nl { color: var(--ferien-nl); border-color: rgba(251, 146, 60, .4); }

.legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .85rem; color: var(--muted); margin: .5rem 0; }
.dot { display: inline-block; width: .8rem; height: .8rem; border-radius: 4px; vertical-align: -1px; }
.dot.yes { background: var(--yes); }
.dot.maybe { background: var(--maybe); }
.dot.no { background: var(--no); }
.dot.heat-1 { background: var(--heat-1); }
.dot.heat-4 { background: var(--heat-4); }
.dot.top { background: transparent; box-shadow: inset 0 0 0 2px var(--accent-2); }
.dot.ferien { background: transparent; border-bottom: 3px solid var(--ferien); border-radius: 0; }
.dot.ferien-nl { background: transparent; border-bottom: 3px solid var(--ferien-nl); border-radius: 0; }
.dot.holiday { background: var(--holiday); border-radius: 50%; width: .5rem; height: .5rem; vertical-align: 1px; }

.bar { display: block; height: 6px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--yes)); }

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(1.2rem + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    background: var(--card);
    border: 1px solid var(--yes);
    padding: .6rem 1rem;
    border-radius: 999px;
    z-index: 100;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .4);
    max-width: calc(100% - 2rem);
}
.toast.error { border-color: var(--no); }

/* ---------- Anmeldung ---------- */

.auth { padding-top: 8vh; }
.auth h1 { text-align: center; margin-top: .2rem; }
.auth > .muted { text-align: center; }
.auth-logo { font-size: 3rem; text-align: center; }

/* ---------- Meine Verfügbarkeit ---------- */

.bulk { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; margin: 1rem 0; }
.month-title { position: sticky; top: 3.4rem; background: var(--bg); padding: .4rem 0; z-index: 1; }
.weekend-list { display: grid; gap: .5rem; }
.weekend-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    padding: .7rem .9rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-left: 4px solid var(--line);
    border-radius: var(--radius);
}
.weekend-row[data-status="yes"] { border-left-color: var(--yes); }
.weekend-row[data-status="maybe"] { border-left-color: var(--maybe); }
.weekend-row[data-status="no"] { border-left-color: var(--no); opacity: .75; }

.choice { display: flex; gap: .35rem; }
.choice button {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 4.2rem;
    padding: .35rem .4rem;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--muted);
    font: inherit;
    font-size: 1.1rem;
    cursor: pointer;
    filter: grayscale(1);
    opacity: .6;
}
.choice button span { font-size: .7rem; }
.weekend-row[data-status="yes"] [data-status="yes"],
.weekend-row[data-status="maybe"] [data-status="maybe"],
.weekend-row[data-status="no"] [data-status="no"] { filter: none; opacity: 1; color: var(--text); }
.weekend-row[data-status="yes"] [data-status="yes"] { border-color: var(--yes); background: rgba(34, 197, 94, .15); }
.weekend-row[data-status="maybe"] [data-status="maybe"] { border-color: var(--maybe); background: rgba(245, 158, 11, .15); }
.weekend-row[data-status="no"] [data-status="no"] { border-color: var(--no); background: rgba(239, 68, 68, .15); }

/* ---------- Dashboard ---------- */

.fixed-banner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 1.2rem;
    border-color: var(--accent);
    background: linear-gradient(135deg, rgba(139, 92, 246, .25), rgba(34, 211, 238, .12)), var(--card);
}
.fixed-banner h1 { margin: .2rem 0; }
.banner-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.eyebrow { display: block; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-2); font-weight: 700; }

.top-grid { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.top-card {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    text-align: left;
    color: inherit;
    font: inherit;
    cursor: pointer;
    position: relative;
}
.top-card:hover { border-color: var(--accent-2); }
.top-card.rank-1 { border-color: var(--accent-2); box-shadow: 0 0 0 1px var(--accent-2), 0 10px 40px rgba(34, 211, 238, .12); }
.top-card .rank { position: absolute; top: .8rem; right: 1rem; font-size: 1.4rem; font-weight: 800; color: var(--accent); }
.top-card .score b { font-size: 1.3rem; color: var(--yes); }
.top-card .names { font-size: .85rem; color: var(--muted); }
.price-line { font-size: .85rem; }
.top-card .tag { align-self: flex-start; margin: 0; }
.empty { text-align: center; padding: 1.5rem; }

.missing { display: grid; gap: .5rem; }
.missing-row { display: grid; grid-template-columns: minmax(6rem, 1fr) 2fr 11rem; gap: .8rem; align-items: center; }
.missing-row > :last-child { text-align: right; }

.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .5rem; }
.section-head h2 { margin-bottom: 0; }

/* Kalender */
.calendar { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.month { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; }
.month h3 { margin: 0 0 .5rem; font-size: .95rem; }
.grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.dow { font-size: .7rem; color: var(--muted); text-align: center; }
.day {
    position: relative;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    border-radius: 6px;
    color: var(--muted);
}
.day.wk { color: var(--text); background: var(--bg-2); cursor: pointer; }
.day.wk.heat-1 { background: var(--heat-1); }
.day.wk.heat-2 { background: var(--heat-2); }
.day.wk.heat-3 { background: var(--heat-3); }
.day.wk.heat-4 { background: var(--heat-4); color: #052e16; font-weight: 700; }
.day.wk:hover { outline: 2px solid var(--text); }
.day.top { box-shadow: inset 0 0 0 2px var(--accent-2); }
.day.fixed { box-shadow: inset 0 0 0 2px #fff; background: var(--accent) !important; color: #fff; }
/* Ferienbalken unten: linke Hälfte NRW, rechte Hälfte NL */
.day.ferien::after, .day.ferien-nl::after {
    content: "";
    position: absolute;
    left: 12%;
    right: 12%;
    bottom: 2px;
    height: 3px;
    border-radius: 2px;
}
.day.ferien::after { background: var(--ferien); }
.day.ferien-nl::after { background: var(--ferien-nl); }
.day.ferien.ferien-nl::after { background: linear-gradient(90deg, var(--ferien) 50%, var(--ferien-nl) 50%); }
.day.holiday::before {
    content: "";
    position: absolute;
    top: 3px;
    right: 3px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--holiday);
}
.day.past { opacity: .35; }
.day.today { text-decoration: underline; text-underline-offset: 3px; }
.badge {
    position: absolute;
    top: -6px;
    left: -4px;
    font-style: normal;
    font-size: .62rem;
    font-weight: 800;
    padding: 0 .25rem;
    border-radius: 6px;
    background: var(--accent-2);
    color: #082f49;
    z-index: 1;
}
.badge.fixed { background: #fff; }

/* Detailfenster */
.dialog {
    width: min(640px, calc(100% - 1.5rem));
    max-height: calc(100% - 2rem);
    padding: 1.2rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--text);
}
.dialog::backdrop { background: rgba(5, 3, 15, .7); backdrop-filter: blur(3px); }
.dialog-head { display: flex; justify-content: space-between; gap: 1rem; }
.dialog-head h2 { margin: .2rem 0; }
.dialog-head p { margin: 0 0 .3rem; }
.close { background: none; border: 0; color: var(--muted); font-size: 1.3rem; cursor: pointer; align-self: flex-start; }
.people-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .6rem; margin-top: 1rem; }
.people { background: var(--bg-2); border-radius: 10px; padding: .6rem .8rem; }
.people h4 { margin: 0; font-size: .85rem; }
.people p { margin: .2rem 0 0; font-size: .9rem; }
.price-form { margin-top: .8rem; padding: .8rem; background: var(--bg-2); border-radius: 10px; display: grid; gap: .4rem; }
.price-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; }
.price-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.price-inputs input[name="note"] { grid-column: 1 / -1; }
.price-inputs button { grid-column: 1 / -1; }
.no-text { color: var(--no); }
.dialog-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; margin-top: 1.2rem; }

/* Verwaltung */
.table-wrap { overflow-x: auto; padding: 0; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: .6rem .8rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; }
.table .actions form { display: flex; flex-wrap: wrap; gap: .3rem; }

@media (min-width: 640px) {
    .price-inputs { grid-template-columns: 1fr 1fr 2fr auto; }
    .price-inputs input[name="note"], .price-inputs button { grid-column: auto; }
}

@media (max-width: 640px) {
    /* Auf dem Handy scrollt die Kopfzeile mit weg, damit mehr Platz bleibt */
    .topbar { position: static; }
    .month-title { top: 0; }
}

@media (max-width: 480px) {
    h1 { font-size: 1.35rem; }
    .choice button { min-width: 3.4rem; }
    .missing-row { grid-template-columns: 1fr auto; }
    .missing-row .bar { grid-column: 1 / -1; order: 3; }
}
