@import url('/css/material/dist/material-components-web.css');

@font-face {
    font-family: 'Material Icons';
    font-style: normal;
    font-weight: 400;
    /* Korrektur: Die woff2-Datei liegt direkt im Hauptordner des Icon-Pakets */
    src: url('/icons/material/material-icons.woff2') format('woff2');
}

/* Optische Kennzeichnung für gesperrte Menüpunkte */
.menu-item.disabled {
    opacity: 0.35;               /* Verblasst den Knopf deutlich */
    cursor: not-allowed;         /* Zeigt das rote "Verboten"-Mauszeigersymbol */
    color: var(--text-muted) !important;
    background: transparent !important;
}


.material-icons {
    font-family: 'Material Icons';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    display: inline-block;
    line-height: 1;
    text-transform: none;
    letter-spacing: normal;
    word-wrap: normal;
    white-space: nowrap;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    -moz-osx-font-smoothing: grayscale;
}

/* --- ELEGANTE BLAU-FARBWELTEN (MATTE DOJO-TONE) --- */
:root {
    /* Light Mode: Edles Preußischblau & warmes Reispapier-Weiß */
    --bg-main: #fcf9f2;
    --bg-card: #ffffff;
    --primary: #1e3a8a;          /* Tiefes Dojo-Blau */
    --primary-hover: #172554;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #d9d4c7;
    --kanji-color: rgba(30, 58, 138, 0.07); /* Blaues Wasserzeichen */
    --shadow: 0 10px 30px rgba(30, 58, 138, 0.04);

    /* Offline-Stoffmuster des Judoanzugs (Kornwebung / Sashiko) */
    --gi-texture:
            repeating-linear-gradient(45deg, rgba(217, 212, 199, 0.15) 0px, rgba(217, 212, 199, 0.15) 2px, transparent 2px, transparent 10px),
            repeating-linear-gradient(-45deg, rgba(217, 212, 199, 0.15) 0px, rgba(217, 212, 199, 0.15) 2px, transparent 2px, transparent 10px),
            linear-gradient(90deg, #fcf9f2, #fbf7ed);
}

[data-theme="dark"] {
    /* Native Elemente (Scrollbalken, Selects, Eingaben) dunkel; scrollbar-color wird vererbt */
    color-scheme: dark;
    --scroll-track: #0b0f19;
    --scroll-thumb: #374151;
    scrollbar-color: var(--scroll-thumb) var(--scroll-track);

    /* Dark Mode: Mystisches Nachtblau & elektrisierendes Kobaltblau */
    --bg-main: #0b0f19;
    --bg-card: #111827;
    --primary: #3b82f6;          /* Klares Kobaltblau */
    --primary-hover: #2563eb;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --border: #1f2937;
    --kanji-color: rgba(59, 130, 246, 0.04);
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    .sidebar-brand img {
        filter: invert(1) brightness(2);
    }
    --gi-texture:
            repeating-linear-gradient(45deg, rgba(31, 41, 55, 0.4) 0px, rgba(31, 41, 55, 0.4) 2px, transparent 2px, transparent 10px),
            repeating-linear-gradient(-45deg, rgba(31, 41, 55, 0.4) 0px, rgba(31, 41, 55, 0.4) 2px, transparent 2px, transparent 10px),
            linear-gradient(90deg, #0b0f19, #090c14);
}

/* --- BASICS & BACKGROUND CONTROLS --- */
body {
    font-family: Roboto, 'Segoe UI', sans-serif;
    background: var(--gi-texture);
    color: var(--text-main);
    margin: 0;
    /* 260px fixe Sidebar + 24px Abstand links, 64px oben (40px Kopfleiste + 24px Abstand): oben, links
       und rechts ist der Abstand zum Inhalt damit überall identisch.
       Die Notification ist ohnehin fixed/floating positioniert (siehe #materialSnackbar in
       menu.js) und benötigt daher keinen eigenen reservierten Freiraum. */
    padding-top: 64px;
    padding-right: 24px;
    padding-bottom: 24px;
    padding-left: calc(260px + 24px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: calc(100vh - 184px);
    transition: background 0.3s, color 0.3s, padding-left 0.3s;
    position: relative;
    overflow-x: hidden;
}

/* --- FIXIERTE LINKE NAVIGATIONSLEISTE (SIDEBAR) --- */
.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    background-color: var(--bg-card);
    border-right: 2px solid var(--border);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    transition: background-color 0.3s, border-color 0.3s, width 0.3s;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 18px 20px;
    flex-shrink: 0;
}

.sidebar-brand img {
    display: block;
    flex-shrink: 0;
    filter: invert(0);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 12px;
    flex: 1;
    border-top: 2px solid var(--border);
}

/* Oben nur "Turniere" (Auswahl), darunter folgt die Gruppe für das gewählte Turnier */
.sidebar-nav-turniere {
    flex: none;
    border-top: 2px solid var(--border);
}

/* Allgemeine Punkte (Stammdaten, Nachrichten, Super-Admin …); unten Platz für den schwebenden Einklapp-Knopf */
.sidebar-nav-unten {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 12px 64px;
    flex-shrink: 0;
    border-top: 2px solid var(--border);
}

/* Sektionstitel im Menü: kurzer Strich, Titel, langer Strich bis zum Rand */
.menu-sektion-titel {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 0 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    user-select: none;
}
.menu-sektion-titel:first-child { margin-top: 0; }
.menu-sektion-titel::before { content: ""; flex: none; width: 12px; border-top: 2px solid var(--border); }
.menu-sektion-titel::after { content: ""; flex: 1; border-top: 2px solid var(--border); }
.menu-sektion-titel.leer { display: none; }

/* Einklapp-Knopf: kleiner Kreis, schwebt immer unten rechts in der Sidebar (kein Menüpunkt) */
.sidebar-collapse-btn {
    position: fixed;
    left: 214px;
    bottom: 14px;
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border);
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
    z-index: 101;
    transition: left 0.3s, color 0.2s, border-color 0.2s;
}
.sidebar-collapse-btn .material-icons { font-size: 18px; }
.sidebar-collapse-btn:hover { color: var(--text-main); border-color: var(--text-muted); }
.sidebar-collapse-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* --- MENÜ BEIM SEITENWECHSEL (menu.js) ---
   Solange der gemerkte Menüstand als Platzhalter dasteht, rechnet das echte Menü unsichtbar im
   Hintergrund. Die Überblendung zwischen zwei Seiten (@view-transition, von menu.js gesetzt) bleibt
   kurz; gleiche Bildteile wie Seiten- und Kopfleiste ändern sich dabei nicht. */
.menue-verborgen {
    visibility: hidden !important;
}

/* Während der Übergabe an das echte Menü keine Übergänge (.menu-item hat transition: all): sonst
   blendet das Sichtbarwerden bzw. die Hervorhebung erst langsam ein und die Punkte flackern. */
.menue-ohne-uebergang,
.menue-ohne-uebergang * {
    transition: none !important;
}

::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 120ms;
}

@media (prefers-reduced-motion: reduce) {
    ::view-transition-old(root),
    ::view-transition-new(root) {
        animation: none;
    }
}

/* --- SCHMALE FIXIERTE KOPFLEISTE RECHTS NEBEN DER SIDEBAR (Profil/Theme/Logout) --- */
.top-header-bar {
    position: fixed;
    top: 0;
    left: 260px;
    right: 0;
    height: 40px;
    background-color: var(--bg-card);
    border-bottom: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 24px;
    box-sizing: border-box;
    z-index: 99;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    transition: background-color 0.3s, border-color 0.3s, left 0.3s;
}

/* Name des aktuell ausgewählten Turniers, links in der Kopfleiste */
.top-header-title {
    margin: 0;
    font-size: 15px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.3s;
}

.top-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.theme-toggle {
    position: relative;
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-main);
    border-radius: 4px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.theme-toggle:hover { background-color: var(--border); }
/* Reine Anzeige im Stil der Symbole (z. B. Cloud-Symbol): kein Klick, daher ohne Hover-Hervorhebung */
.theme-toggle.nur-anzeige { cursor: default; }
.theme-toggle.nur-anzeige:hover { background-color: transparent; }

/* Variante mit Beschriftung (z.B. "Hallen-Server"-Button in der Kopfzeile) */
.theme-toggle.theme-toggle-text {
    width: auto;
    padding: 0 10px;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.theme-toggle.theme-toggle-text .material-icons { font-size: 20px; }
.theme-toggle.theme-toggle-text.active { background-color: var(--border); }

/* --- KOPFLEISTE: ANZEIGE + WECHSLER DES AKTIVEN VEREINS --- */
.top-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.verein-switcher {
    position: relative;
}

.verein-switcher-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-main);
    border-radius: 4px;
    height: 36px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: all 0.2s;
    max-width: 220px;
}
.verein-switcher-btn span:not(.material-icons) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.verein-switcher-btn:hover { background-color: var(--border); }
.verein-switcher-btn.no-dropdown { cursor: default; }
.verein-switcher-btn.no-dropdown:hover { background-color: transparent; }

.verein-switcher-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 220px;
    background-color: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 4px;
    box-shadow: var(--shadow);
    z-index: 200;
    overflow: hidden;
}

.verein-switcher-item {
    display: flex;
    flex-direction: column;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    transition: background-color 0.15s;
}
.verein-switcher-item:last-child { border-bottom: none; }
.verein-switcher-item:hover { background-color: var(--border); }
.verein-switcher-item.aktiv { color: var(--primary); }
.verein-switcher-item .verein-switcher-item-status {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-secondary, #888);
}

/* --- REITER-STYLING (MENU ITEMS, vertikal in der Sidebar) --- */
.menu-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 14px;
    border-radius: 4px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-sizing: border-box;
    transition: all 0.2s;
}

.menu-item .material-icons {
    font-size: 20px;
    vertical-align: middle;
    flex-shrink: 0;
    /* Feste Breite: solange die Icon-Schrift nach einem Seitenwechsel noch lädt, wäre das Icon so breit
       wie sein Name ("calendar_month") und der Text daneben spränge. */
    width: 20px;
}

/* Gelbes Achtung-Icon auf einem Menüpunkt (z.B. Pools: mind. ein Pool wartet auf
   Ergebnisprüfung) — absolut positioniert, damit es unabhängig vom Ein-/Ausklapp-Zustand
   der Sidebar immer oben rechts am Menüpunkt sitzt statt den Zeilenfluss zu verschieben. */
.menu-item-badge {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #f5a623;
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    line-height: 18px;
    text-align: center;
    box-sizing: border-box;
}
.menu-item-badge.hoch { background: #ef4444; }

.menu-item-warning {
    font-size: 16px !important;
    color: #f5a623;
}

.menu-item:hover {
    color: var(--text-main);
    background-color: rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] .menu-item:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

.menu-item.active {
    color: var(--primary);
    background-color: rgba(30, 58, 138, 0.06);
}

[data-theme="dark"] .menu-item.active {
    background-color: rgba(59, 130, 246, 0.1);
}

/* --- ORGA-UNTERMENÜ (aufklappbare Gruppe in der Sidebar) --- */
.menu-gruppe { display: flex; flex-direction: column; gap: 4px; }
.menu-gruppe-kopf { background: none; border: 0; font-family: inherit; cursor: pointer; text-align: left; }
.menu-gruppe-kopf .menu-gruppe-pfeil { margin-left: auto; font-size: 18px; }
.menu-untermenue { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.menu-gruppe.zugeklappt .menu-untermenue { display: none; }
.menu-subitem { padding: 7px 14px 7px 46px; font-size: 12px; font-weight: 600; text-transform: none; letter-spacing: 0.2px; }
.menu-kategorien { margin-top: 2px; }
.menu-kategorien .menu-subitem { padding-left: 62px; font-weight: 500; }
.menu-subitem .menu-item-badge { height: 16px; min-width: 16px; line-height: 16px; font-size: 10px; }
/* „Aufgaben“: eigener Auf-/Zuklapp-Pfeil rechts in der Zeile, die Zeile selbst bleibt ein Link */
.menu-aufgaben { position: relative; }
.menu-aufgaben > .menu-subitem { padding-right: 40px; }
.menu-aufgaben-pfeil { position: absolute; top: 2px; right: 8px; width: 26px; height: 26px; padding: 0; display: flex; align-items: center; justify-content: center; background: none; border: 0; border-radius: 4px; color: var(--text-muted); cursor: pointer; }
.menu-aufgaben-pfeil:hover { color: var(--text-main); background-color: rgba(0, 0, 0, 0.05); }
[data-theme="dark"] .menu-aufgaben-pfeil:hover { background-color: rgba(255, 255, 255, 0.06); }
.menu-aufgaben-pfeil .material-icons { font-size: 18px; }
.menu-aufgaben > .menu-subitem[style*="display: none"] ~ .menu-aufgaben-pfeil { display: none; }
.menu-aufgaben.zugeklappt .menu-kategorien { display: none; }
.menu-aufgaben-pfeil:focus-visible, .menu-gruppe-kopf:focus-visible, .menu-subitem:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

/* --- STABILE KANJI WASSERZEICHEN --- */
.kanji-left, .kanji-right {
    position: fixed;
    font-weight: 900;
    color: var(--kanji-color);
    z-index: 0;
    pointer-events: none;
    user-select: none;
    transition: color 0.3s;
    font-size: 40vh;
}

.kanji-left { left: -2%; top: 20%; }
.kanji-right { right: -2%; bottom: 5%; }

/* --- EINHEITLICHER CONTAINER FÜR ALLE CARD-MASKEN --- */
.mdc-card {
    width: 100%;
    max-width: 680px;         /* Absolut deckungsgleiche Breite für jede Maske */
    padding: 36px;            /* Identischer Innenabstand */
    background-color: var(--bg-card);
    border-radius: 4px;       /* Traditionell gerade Dojo-Kanten */
    box-shadow: var(--shadow);
    border: 2px solid var(--border);
    z-index: 1;
    transition: background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
}

/* --- STRUKTURIERTE TITELZEILE DER KARTEN --- */
.form-title-area {
    display: flex;
    align-items: center;
    justify-content: space-between; /* Treibt die beiden Pokale bündig an die Außenränder */
    width: 100%;
    margin-bottom: 14px;     /* kompakt und auf allen Seiten gleich */
    border-bottom: 2px solid var(--border);
    padding-bottom: 8px;
    box-sizing: border-box;
}

.form-title-area h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    flex-grow: 1;            /* Drückt den Text unbeweglich in die geometrische Mitte */
}

.form-title-area .material-icons {
    font-size: 32px;
    color: var(--primary);
    transition: color 0.3s;
    flex-shrink: 0;
}

/* --- KOMPAKTE AKTIONS-ICONS IN DER TITELZEILE (z.B. matten.html, pools.html) --- */
.title-action-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.title-icon-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 50%;
    background: none;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, opacity 0.2s;
}

/* Zähl-Badge für Icon-Buttons mit dynamischer Anzahl (z.B. Anzahl markierter Zeilen).
   Bewusst kein "currentColor" für den Hintergrund — der würde die eigene (weiße)
   Textfarbe des Badges statt der Button-Farbe aufgreifen, daher explizit pro Variante. */
.title-icon-btn-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    line-height: 16px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--bg-card);
}

.title-icon-btn-danger .title-icon-btn-badge {
    background-color: #c62828;
}

.title-icon-btn-primary .title-icon-btn-badge {
    background-color: var(--primary);
}

.title-icon-btn-success .title-icon-btn-badge {
    background-color: #28a745;
}

.title-icon-btn .material-icons {
    font-size: 20px;
    color: inherit;
}

.title-icon-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.title-icon-btn-danger {
    color: #c62828;
    border-color: rgba(198, 40, 40, 0.3);
}

.title-icon-btn-danger:hover:not(:disabled) {
    background-color: rgba(198, 40, 40, 0.08);
}

.title-icon-btn-primary {
    color: var(--primary);
    border-color: rgba(30, 58, 138, 0.3);
}

.title-icon-btn-primary:hover:not(:disabled) {
    background-color: rgba(30, 58, 138, 0.08);
}

.title-icon-btn-success {
    color: #28a745;
    border-color: rgba(40, 167, 69, 0.3);
}

.title-icon-btn-success:hover:not(:disabled) {
    background-color: rgba(40, 167, 69, 0.08);
}

/* --- BESCHRIFTETE TOOLBAR-BUTTONS (Icon + Text, z.B. Aktionsleiste über Tabellen) --- */
.toolbar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 14px;
    border-radius: 4px;
    border: 2px solid var(--border);
    background: transparent;
    color: var(--text-main);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.toolbar-btn .material-icons {
    font-size: 18px;
}

.toolbar-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background-color: rgba(30, 58, 138, 0.05);
}

[data-theme="dark"] .toolbar-btn:hover:not(:disabled) {
    background-color: rgba(59, 130, 246, 0.1);
}

.toolbar-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.toolbar-btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.toolbar-btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #ffffff;
}

.toolbar-btn-akzent {
    border-color: var(--primary);
    color: var(--primary);
}

.toolbar-btn-danger {
    border-color: rgba(198, 40, 40, 0.4);
    color: #c62828;
}

.toolbar-btn-danger:hover:not(:disabled) {
    background-color: rgba(198, 40, 40, 0.08);
    border-color: #c62828;
    color: #c62828;
}

/* --- ICON-LEISTE RECHTS IN DER TITELZEILE (pools.html, teilnehmer.html) ---
   Die Buttons behalten ihre beschrifteten Markups (Icon + Text); die Beschriftung wird hier
   ausgeblendet und als Tooltip (data-tooltip) angezeigt. In der Android-App (modus-app) bleiben
   sie beschriftet, siehe handy.css. */
.titel-icons {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

html:not(.modus-app) .titel-icons .toolbar-btn {
    position: relative;
    width: 38px;
    height: 38px;
    padding: 0;
    justify-content: center;
}

html:not(.modus-app) .titel-icons .toolbar-btn .material-icons {
    font-size: 20px;
}

html:not(.modus-app) .titel-icons .toolbar-btn > span:not(.material-icons) {
    display: none;
}

html:not(.modus-app) .titel-icons .toolbar-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: #333;
    color: #fff;
    font-size: 12px;
    font-weight: normal;
    text-transform: none;
    letter-spacing: normal;
    line-height: 1.3;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s;
    z-index: 20;
}

html:not(.modus-app) .titel-icons .toolbar-btn:hover::after,
html:not(.modus-app) .titel-icons .toolbar-btn:focus-visible::after {
    opacity: 1;
}

/* Titelzeile mit exakt zentrierter Überschrift: links Icon/Suche, rechts Icon-Leiste, beide Seiten
   gleich breit. Erwartet genau drei sichtbare Kinder (links, h1, rechts). */
.form-title-area.titel-zentriert {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    column-gap: 16px;
}

.form-title-area.titel-zentriert > :first-child {
    justify-self: start;
}

.form-title-area.titel-zentriert > :last-child {
    justify-self: end;
}

/* Auf schmalen Bildschirmen rutscht eine größere Aktions-Icon-Gruppe unter den Titel, statt
   die Titelzeile horizontal zum Scrollen zu zwingen. */
@media (max-width: 480px) {
    .form-title-area,
    .form-title-area.titel-zentriert {
        display: flex;
        flex-wrap: wrap;
        row-gap: 8px;
    }

    .form-title-area h1 {
        flex-basis: 100%;
        order: 1;
    }

    .form-title-area .title-action-group,
    .form-title-area .titel-icons {
        order: 2;
        width: 100%;
        justify-content: center;
    }
}

[data-theme="dark"] .title-icon-btn-primary:hover:not(:disabled) {
    background-color: rgba(59, 130, 246, 0.1);
}

/* --- DESIGN FÜR FORMULARFELDER, WÄHLBOXEN & TEXT --- */
.form-group {
    width: 100%;
}

label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.75px;
}

input[type="text"], input[type="date"], input[type="number"], select {
    width: 100%;
    height: 28px;
    padding: 2px 6px;
    border: 2px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
    background-color: var(--bg-card);
    color: var(--text-main);
    box-sizing: border-box;
    transition: all 0.2s;
}

/* Aufklappliste der Dropdowns: eigene Farben, sonst steht im Dunkelmodus helle Schrift auf dem weißen Standardgrund */
select option, select optgroup {
    background-color: var(--bg-card);
    color: var(--text-main);
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
}

/* --- VERTIVAL AUSGERICHTETER CHECKBOX-CONTAINER --- */
.checkbox-container {
    display: flex;
    align-items: center;      /* Sichert die exakte mathematische Linie zwischen Haken und Text */
    justify-content: flex-start;
    height: 100%;
    cursor: pointer;
    user-select: none;
}

.checkbox-container input {
    width: 20px;
    height: 20px;
    margin: 0 12px 0 0;
    cursor: pointer;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.checkbox-container label {
    display: inline-block;
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.75px;
    cursor: pointer;
}

/* --- ABSCHLUSS-AKTIONEN & SCHALTKNÖPFE --- */
.actions {
    display: flex;
    justify-content: flex-end;
    gap: 14px;
    padding-top: 24px;
    border-top: 2px solid var(--border);
}

.btn {
    height: 28px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    letter-spacing: 1.2px;
    transition: all 0.2s;
}
.btn-outlined { background: transparent; color: var(--text-main); border: 2px solid var(--border); }
.btn-outlined:hover { background: var(--border); }
.btn-raised { background-color: var(--primary); color: #ffffff; border: none; }
.btn-raised:hover { background-color: var(--primary-hover); }

@keyframes modalPulse {
    0% { transform: scale(0.96); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes icon-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.icon-spin {
    display: inline-block;
    animation: icon-spin 0.9s linear infinite;
}

@keyframes snackbarFadeIn {
    0% { bottom: 0px; opacity: 0; }
    100% { bottom: 24px; opacity: 1; }
}

/* --- FLÜSSIGE RESPONSIVE ANPASSUNGEN --- */
/* Auf schmalen Bildschirmen kollabiert die Sidebar zu einer reinen Icon-Leiste, statt
   horizontal Platz zu verlieren. */
@media (max-width: 850px) {
    .app-sidebar { width: 72px; }
    .sidebar-brand { justify-content: center; padding: 18px 8px; }
    .sidebar-brand .brand-text { display: none; }
    .sidebar-nav, .sidebar-nav-unten { padding: 16px 8px; }
    .menu-text { display: none; }
    .menu-item { justify-content: center; padding: 10px 8px; gap: 0; }
    .menu-untermenue, .menu-gruppe-pfeil { display: none; }
    .menu-sektion-titel { font-size: 0; gap: 0; padding: 0 6px; }
    .menu-sektion-titel::before { display: none; }
    .sidebar-collapse-btn { left: 20px; }
    .top-header-bar { left: 72px; }
    body { padding-left: calc(72px + 24px); }
}

/* Manueller Ein-/Ausklapp-Zustand über den Umschalter unten in der Sidebar (unabhängig von der
   Bildschirmbreite oben — wirkt auch auf breiten Bildschirmen). */
body.sidebar-collapsed {
    padding-left: calc(72px + 24px);
}

body.sidebar-collapsed .app-sidebar {
    width: 72px;
}

body.sidebar-collapsed .sidebar-brand {
    justify-content: center;
    padding: 18px 8px;
}

body.sidebar-collapsed .sidebar-nav,
body.sidebar-collapsed .sidebar-nav-unten {
    padding: 16px 8px;
}

body.sidebar-collapsed .menu-text {
    display: none;
}

body.sidebar-collapsed .menu-item {
    justify-content: center;
    padding: 10px 8px;
    gap: 0;
}

body.sidebar-collapsed .menu-untermenue,
body.sidebar-collapsed .menu-gruppe-pfeil {
    display: none;
}

/* Eingeklappt bleibt von jedem Sektionstitel nur die Trennlinie */
body.sidebar-collapsed .menu-sektion-titel {
    font-size: 0;
    gap: 0;
    padding: 0 6px;
}

body.sidebar-collapsed .menu-sektion-titel::before {
    display: none;
}

body.sidebar-collapsed .sidebar-collapse-btn {
    left: 20px;
}

body.sidebar-collapsed .top-header-bar {
    left: 72px;
}

@media (max-width: 600px) {
    .kanji-left, .kanji-right { font-size: 25vh; }
    .top-header-bar { padding: 0 12px; }
}

@keyframes snackbarFadeInTop {
    0% { top: 60px; opacity: 0; }
    100% { top: 90px; opacity: 1; }
}
/* --- ICON-BUTTON MIT TOOLTIP (z. B. Duplizieren in turniere.html) ---
   Nur das Icon, die Beschriftung steht als Tooltip (data-tooltip) und als aria-label am Button. */
.btn-icon-aktion {
    flex: 0 0 38px;
    position: relative;
    width: 38px;
    height: 38px;
    min-width: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-aktion .material-icons {
    font-size: 20px;
}

.btn-icon-aktion::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    right: 0;
    background: #333;
    color: #fff;
    font-size: 12px;
    font-weight: normal;
    text-transform: none;
    letter-spacing: normal;
    line-height: 1.3;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 20;
}

.btn-icon-aktion:hover::after,
.btn-icon-aktion:focus-visible::after {
    opacity: 1;
}

/* Teilnehmer-App (public/js/teilnehmerApp.js): Dialog mit den Theme-Variablen, damit er in Hell und Dunkel lesbar bleibt */
.ta-overlay { position: fixed; inset: 0; z-index: 10001; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.45); padding: 16px; }
.ta-overlay[hidden] { display: none; }
.ta-dialog { background: var(--bg-card); color: var(--text-main); border: 2px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 24px; width: 100%; max-width: 460px; box-sizing: border-box; }
.ta-dialog h3 { margin: 0 0 12px; color: var(--text-main); }
.ta-dialog p { margin: 0 0 12px; font-size: 14px; line-height: 1.45; }
.ta-status { display: flex; align-items: center; gap: 8px; color: var(--text-main); }
.ta-punkt { width: 12px; height: 12px; border-radius: 50%; background: #9e9e9e; flex: 0 0 auto; }
.ta-schalter { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; color: var(--text-main); font-weight: 600; cursor: pointer; }
.ta-hinweis { color: var(--text-muted); }
.ta-warnung, .ta-grund { color: var(--text-main); border-left: 4px solid #f9a825; padding-left: 10px; }
.ta-fehler { color: #c62828; font-weight: 600; }
[data-theme="dark"] .ta-fehler { color: #ef9a9a; }
.ta-aktionen { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.ta-zugang { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.ta-zugang h4 { margin: 0 0 6px; font-size: 14px; }
.ta-zugang-knoepfe { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ta-zugang-knoepfe .btn { text-decoration: none; text-align: center; }

/* Roter Kreis mit Anzahl offener Anträge hinter einem Menütext (z. B. Mitglieder) */
.menu-badge {
    display: inline-block;
    margin-left: 6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: #ef4444;
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    line-height: 16px;
    text-align: center;
    box-sizing: border-box;
    vertical-align: middle;
}

/* Hochgestellte Anzahl offener Anträge hinter einem Menütext (z. B. Erstregistrierungen) */
.menu-sup {
    margin-left: 3px;
    font-size: 10px;
    font-weight: 800;
    color: #ef4444;
    line-height: 1;
}

/* Trenner zwischen den allgemeinen Menüpunkten und den Super-Admin-Punkten */
.menu-trenner {
    height: 0;
    margin: 10px 14px;
    border-top: 2px solid var(--border);
}

/* Profil-Icon: roter Kreis mit Anzahl ungelesener Nachrichten, kleines Auswahlmenü */
.profil-menue-huelle { position: relative; }
.profil-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: #ef4444;
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    line-height: 16px;
    text-align: center;
    box-sizing: border-box;
}
.profil-menue { min-width: 180px; }
.profil-menue .verein-switcher-item { text-decoration: none; color: var(--text-main); flex-direction: row; align-items: center; }

/* Ausgeschaltete Funktionen des Turniers (menu.js setzt fkt-aus-<Schluessel> am body, siehe src/shared/turnierFunktionen.js) */
body.fkt-aus-wettkampfplaene [data-funktion~="wettkampfplaene"],
body.fkt-aus-teilnehmer_app #teilnehmerAppBtn { display: none !important; }
