/* =============================================================================
   SSV Anstel Special - Terminsystem
   Mobile-First, grosse Schrift, grosse Buttons, hoher Kontrast (WCAG AA).

   FARBREGELN
   - Kurzwaffe  = Blau   (--kurz)
   - Langwaffe  = Gruen  (--lang)  -> nur Terminkopf/Rahmen
   - Ampel      = Gruen / Gelb / Grau  -> nur Buchen-Button
   - Austragen  = Rot
   - Neutrale Aktionen (Anmelden, Speichern) = Anthrazit, damit sie nicht mit
     den Bedeutungsfarben verwechselt werden.
   ========================================================================== */

:root {
    --kurz: #0b5ed7;
    --kurz-dark: #084298;
    --lang: #0f5132;
    --lang-bright: #198754;
    --ampel-green: #198754;
    --ampel-amber: #ffc107;
    --ampel-grey: #dee2e6;
    --danger: #b02a37;
    --ink: #212529;
    --bg: #f1f3f5;
    --tabbar-h: 4.25rem;
}

html { font-size: 112.5%; } /* 18px Basis statt 16px */

body,
.app-body,
.guest-body {
    color: var(--ink);
    background-color: var(--bg);
    background-image: url("../img/wallpaper.webp");
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
    background-attachment: fixed;
    min-height: 100vh;
    line-height: 1.5;
}

:focus-visible { outline: 4px solid #ff9800; outline-offset: 2px; }

.skip-link {
    position: absolute; left: -999px; top: 0; background: #000; color: #fff;
    padding: .75rem 1rem; z-index: 2000;
}
.skip-link:focus { left: 0; }

.app-container { width: 100%; max-width: 44rem; margin: 0 auto; padding-left: 1rem; padding-right: 1rem; }

/* ---------------------------------------------------------------- Kopfzeile */
.app-header { background: var(--ink); color: #fff; }
.app-header__inner {
    display: flex; align-items: center; gap: .85rem;
    padding-top: .55rem; padding-bottom: .55rem;
}
.app-header__logo {
    width: auto; height: 2.9rem; flex-shrink: 0;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .4));
}
.app-header__text { min-width: 0; }
.app-header__club { font-weight: 700; font-size: 1.15rem; line-height: 1.25; }
.app-header__user { font-size: .9rem; opacity: .95; line-height: 1.3; }

.app-main { padding-top: 1rem; padding-bottom: calc(var(--tabbar-h) + 1.5rem); }
.page-title {
    font-size: 1.6rem; font-weight: 800; margin: 1rem 0 .5rem;
    text-shadow: 0 1px 4px rgba(255, 255, 255, .9), 0 0 12px rgba(255, 255, 255, .75);
}

/* ------------------------------------------------------- Feste Tab-Leiste */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
    background: #fff; border-top: 3px solid var(--ink);
    padding-bottom: env(safe-area-inset-bottom);
}
.tabbar__inner { display: flex; gap: .25rem; padding-left: .25rem; padding-right: .25rem; }
.tabbar__form { flex: 1 1 0; margin: 0; display: flex; }
.tabbar__item {
    flex: 1 1 0; min-height: var(--tabbar-h);
    display: flex; align-items: center; justify-content: center; text-align: center;
    font-size: .9rem; font-weight: 700; line-height: 1.2; padding: .25rem;
    color: var(--ink); background: transparent; border: 0; text-decoration: none;
}
.tabbar__item.is-active { background: var(--ink); color: #fff; }
.tabbar__item--logout { color: var(--danger); width: 100%; }
.tabbar__item:hover { background: #e9ecef; }
.tabbar__item.is-active:hover { background: var(--ink); }

/* ------------------------------------------------ Buttons (immer mit Text) */
.app-btn {
    min-height: 3.5rem; font-size: 1.15rem; font-weight: 700; width: 100%;
    border-radius: .75rem; border: 3px solid transparent; padding: .5rem 1rem;
}
.app-btn--green  { background: var(--ampel-green); color: #fff; border-color: #146c43; }
.app-btn--green:hover, .app-btn--green:focus { background: #146c43; color: #fff; }
.app-btn--amber  { background: var(--ampel-amber); color: #000; border-color: #cc9a06; }
.app-btn--amber:hover, .app-btn--amber:focus { background: #e0a800; color: #000; }
.app-btn--grey, .app-btn--grey:disabled {
    background: var(--ampel-grey); color: #495057; border: 3px dashed #868e96; opacity: 1; cursor: not-allowed;
}
.app-btn--danger { background: var(--danger); color: #fff; border-color: #842029; }
.app-btn--danger:hover, .app-btn--danger:focus { background: #842029; color: #fff; }
.app-btn--none   { background: var(--ink); color: #fff; }
.app-btn.btn-outline-dark { background: rgba(255, 255, 255, .92); color: var(--ink); border-color: var(--ink); }
.app-btn.btn-outline-dark:hover, .app-btn.btn-outline-dark:focus { background: var(--ink); color: #fff; }

.app-btn-secondary { min-width: 6.5rem; font-weight: 700; font-size: 1rem; }
.app-btn-mini { margin-left: .5rem; padding: .35rem .75rem; font-weight: 700; min-height: 2.5rem; }

.app-label { font-weight: 700; font-size: 1.1rem; }
.app-input { min-height: 3.5rem; font-size: 1.15rem; border: 2px solid #495057; border-radius: .6rem; }
.app-check { font-size: 1.1rem; padding-left: 2.2rem; }
.app-check .form-check-input { width: 1.6rem; height: 1.6rem; margin-left: -2.2rem; margin-top: .1rem; border: 2px solid #495057; }

.app-flash { font-size: 1.1rem; font-weight: 600; border-width: 2px; }

/* ---------------------------------------------------------- Ankuendigungen */
.announcement { border-radius: .75rem; padding: 1rem 1.1rem; margin-bottom: 1rem; border: 3px solid; }
.announcement__title { font-weight: 800; text-transform: uppercase; letter-spacing: .04em; font-size: .85rem; }
.announcement__text { font-size: 1.15rem; font-weight: 600; }
.announcement--info    { background: #cfe2ff; border-color: #0a58ca; color: #052c65; }
.announcement--warning { background: #fff3cd; border-color: #cc9a06; color: #4d3800; }
.announcement--danger  { background: #f8d7da; border-color: #b02a37; color: #58151c; }

/* ------------------------------------------------------------------ Legende */
.legend { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.legend__item { padding: .3rem .8rem; border-radius: 2rem; color: #fff; font-weight: 700; font-size: .9rem; }
.legend__item--kurz { background: var(--kurz); }
.legend__item--lang { background: var(--lang); }

/* -------------------------------------------------- Admin-Stellvertreterbox */
.proxy-box { background: #fff; border: 3px solid var(--ink); border-radius: .75rem; padding: 1rem; margin-bottom: 1.25rem; }
.proxy-box__title { font-size: 1.15rem; font-weight: 800; }
.proxy-box__active { margin: 1rem 0 0; padding: .75rem; background: #fff3cd; border-radius: .5rem; font-weight: 600; }

/* --------------------------------------------------------------- Terminkarte */
.event { background: #fff; border-radius: 1rem; border: 3px solid; margin-bottom: 1.5rem; overflow: hidden; }
.event--kurz { border-color: var(--kurz); }
.event--lang { border-color: var(--lang); }
.event__head { padding: 1rem; color: #fff; }
.event--kurz .event__head { background: var(--kurz); }
.event--lang .event__head { background: var(--lang); }
.event__weapon {
    display: inline-block; background: #fff; border-radius: 2rem; padding: .1rem .8rem;
    font-weight: 800; text-transform: uppercase; font-size: .8rem; letter-spacing: .05em;
}
.event--kurz .event__weapon { color: var(--kurz-dark); }
.event--lang .event__weapon { color: var(--lang); }
.event__title { font-size: 1.4rem; font-weight: 800; margin: .5rem 0 .25rem; }
.event__when { font-size: 1.1rem; }
.event__desc { margin-top: .5rem; font-size: .95rem; opacity: .95; }
.event__empty { padding: 1rem; margin: 0; }

.slots { list-style: none; margin: 0; padding: 0; }
.slot { padding: 1rem; border-top: 2px solid #dee2e6; display: grid; gap: .6rem; }
.slot:first-child { border-top: 0; }
.slot--mine { background: #fff9db; }
.slot--past, .slot--full, .slot--locked { background: #f8f9fa; }
.slot__time { font-size: 1.3rem; font-weight: 800; }
.slot__free { display: block; font-size: .95rem; font-weight: 600; color: #495057; }
.slot__people { font-size: 1rem; }
.slot__people-label { font-weight: 700; }
.slot__nobody { color: #495057; }
.people { list-style: none; margin: .25rem 0 0; padding: 0; }
.people__item { padding: .2rem 0; }
.slot__note { margin: .5rem 0 0; font-size: .95rem; font-weight: 600; color: #664d03; }

/* ------------------------------------------------------------- Profil/Panel */
.panel { background: #fff; border: 2px solid #ced4da; border-radius: .75rem; padding: 1rem; margin-bottom: 1.25rem; }
.panel__title { font-size: 1.2rem; font-weight: 800; margin-bottom: .75rem; }
.app-empty { font-size: 1.15rem; }

/* ---------------------------------------------------------------- Login */
.guest-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-card {
    width: 100%; max-width: 28rem; background: #fff; border: 3px solid var(--ink);
    border-radius: 1rem; padding: 1.5rem;
}
.login-card__head {
    display: flex; align-items: center; gap: .9rem;
    padding-bottom: 1.1rem; margin-bottom: 1.25rem;
    border-bottom: 2px solid #dee2e6;
}
.login-card__logo {
    width: auto; height: 3.8rem; flex-shrink: 0;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .18));
}
.login-card__titles { min-width: 0; }
.login-card__club { font-size: 1.35rem; font-weight: 800; line-height: 1.2; margin: 0; text-align: left; }
.login-card__sub { text-align: left; font-size: 1rem; line-height: 1.3; margin: .2rem 0 0; color: #495057; }
.login-card__help { text-align: center; margin: 1.25rem 0 0; color: #495057; font-size: .95rem; }

/* ------------------------------------------------------------ Ab Tablet */
@media (min-width: 576px) {
    .slot { grid-template-columns: 1fr minmax(11rem, 14rem); align-items: start; }
    .slot__time { grid-column: 1; }
    .slot__people { grid-column: 1; }
    .slot__action { grid-column: 2; grid-row: 1 / span 2; }
}

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

/* =============================================================================
   ADMIN-BEREICH
   ========================================================================== */
.section-title {
    font-size: 1.25rem; font-weight: 800; margin: 1.5rem 0 .75rem;
    text-shadow: 0 1px 4px rgba(255, 255, 255, .9), 0 0 12px rgba(255, 255, 255, .75);
}
.app-btn--back { margin-bottom: .5rem; }
.app-btn--inline { width: auto; flex: 1 1 10rem; }

.admin-menu { display: grid; gap: 1rem; margin-top: 1rem; }
.admin-menu__btn { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1rem; }
.admin-menu__sub { font-size: .9rem; font-weight: 500; opacity: .9; }

.admin-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .9rem; }
.admin-item { background: #fff; border: 2px solid #adb5bd; border-left-width: 10px; border-radius: .75rem; padding: 1rem; }
.admin-item--kurz { border-left-color: var(--kurz); }
.admin-item--lang { border-left-color: var(--lang); }
.admin-item--inactive { background: #f1f3f5; border-style: dashed; }
.admin-item__title { font-size: 1.2rem; font-weight: 800; }
.admin-item__meta { color: #343a40; margin: .25rem 0 .75rem; }
.admin-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.admin-actions form { display: contents; }
.admin-item .announcement { margin: .75rem 0; }

.pill { display: inline-block; padding: .1rem .8rem; border-radius: 2rem; color: #fff; font-weight: 800; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.pill--kurz { background: var(--kurz); }
.pill--lang { background: var(--lang); }

.choice-row { display: grid; gap: .6rem; }
.choice { display: flex; align-items: center; gap: .75rem; min-height: 3.5rem; padding: .5rem 1rem; border: 3px solid #868e96; border-radius: .75rem; font-weight: 700; font-size: 1.1rem; cursor: pointer; background: #fff; }
.choice input { width: 1.5rem; height: 1.5rem; flex: none; }
.choice:has(input:checked) { border-width: 3px; box-shadow: 0 0 0 3px rgba(0,0,0,.15); }
.choice--kurz { border-color: var(--kurz); }
.choice--lang { border-color: var(--lang); }
.choice--info { border-color: #0a58ca; background: #cfe2ff; }
.choice--warning { border-color: #cc9a06; background: #fff3cd; }
.choice--danger { border-color: #b02a37; background: #f8d7da; }

.slot-edit { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.slot-edit__num { width: 6rem; flex: none; }

@media (max-width: 420px) {
    .tabbar__inner { gap: 0; padding-left: 0; padding-right: 0; }
    .tabbar__item { font-size: .68rem; padding: .1rem; }
    .login-card__logo { height: 3.2rem; }
    .login-card__club { font-size: 1.15rem; }
}

/* =============================================================================
   SCHIESSBUCH / STATISTIK
   ========================================================================== */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin-bottom: .75rem; }
.stat { background: #f8f9fa; border: 3px solid var(--ink); border-radius: .75rem; padding: .6rem .4rem; text-align: center; }
.stat--kurz { border-color: var(--kurz); }
.stat--lang { border-color: var(--lang); }
.stat__value { font-size: 1.9rem; font-weight: 800; line-height: 1.1; }
.stat__label { font-size: .8rem; font-weight: 700; line-height: 1.2; }

/* Auffaelliger Export-Button (bewusst kein Blau/Gruen/Ampel-Farbton) */
.app-btn--export {
    background: #c2410c; color: #fff; border-color: #7c2d12;
    min-height: 4.25rem; font-size: 1.25rem; box-shadow: 0 3px 0 #7c2d12;
}
.app-btn--export:hover, .app-btn--export:focus { background: #9a3412; color: #fff; }

.logbook-entry__title { font-size: 1.1rem; font-weight: 800; margin-bottom: .75rem; }
.logbook-entry { scroll-margin-top: 1rem; }

/* Aufklappbarer Bereich fuer vergangene Termine */
.past-events > summary { list-style: none; cursor: pointer; }
.past-events > summary::-webkit-details-marker { display: none; }
