/* Projektspezifische Ergänzungen zu Bootstrap.
   Bewusst schlank – nur Feinschliff, keine eigene Komponenten-Bibliothek. */

:root {
    --ww-bg: #f4f5f7;
    --ww-brand: #4f46e5;
    --ww-brand-dark: #3f37c9;
    /* Grundton auch ohne eingestellte Farben (sonst Bootstrap-Blau);
       eingestellte Farben ueberschreibt layout.twig per <style>. */
    --bs-primary: #4f46e5;
    --bs-primary-rgb: 79, 70, 229;
    --bs-link-color: #4f46e5;
    --bs-link-color-rgb: 79, 70, 229;
    --bs-link-hover-color: #3f37c9;
}

/* Dunkel-Modus (Bootstrap 5.3 [data-bs-theme=dark] auf <html>, siehe
   layout.twig + Mein Profil). Bootstraps eigene Komponenten passen sich
   selbst an - hier nur die projekteigenen, fest verdrahteten Farben. */
[data-bs-theme="dark"] {
    --ww-bg: var(--bs-body-bg);
}
/* Links im Dunkel-Modus aufhellen (html[...] schlaegt auch das :root aus layout.twig) */
html[data-bs-theme="dark"] {
    --bs-link-color: #a5b4fc;
    --bs-link-color-rgb: 165, 180, 252;
    --bs-link-hover-color: #c7d2fe;
}
[data-bs-theme="dark"] .navbar.ww-navbar {
    background-color: var(--bs-body-bg);
    border-bottom-color: var(--bs-border-color);
}
[data-bs-theme="dark"] .card {
    border-color: var(--bs-border-color);
    box-shadow: none;
}
[data-bs-theme="dark"] .ww-hilfe-btn {
    border-color: #2a4a6b;
    background-color: #17324d;
    color: #8ecbff;
}
[data-bs-theme="dark"] .ww-hilfe-btn:hover,
[data-bs-theme="dark"] .ww-hilfe-btn:focus-visible {
    background-color: #1d3f60;
    color: #aedaff;
}

body {
    background-color: var(--ww-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1 0 auto;
}

/* Marken-Akzent für die Navbar */
.navbar.ww-navbar {
    background-color: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, .08);
}

.navbar.ww-navbar .navbar-brand {
    font-weight: 600;
    color: var(--ww-brand);
}

.navbar.ww-navbar .navbar-brand:hover {
    color: var(--ww-brand-dark);
}

/* Karten etwas weicher als der Bootstrap-Standard */
.card {
    border: 1px solid rgba(0, 0, 0, .06);
    border-radius: .75rem;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .06);
}

.btn-primary {
    --bs-btn-bg: var(--ww-brand);
    --bs-btn-border-color: var(--ww-brand);
    --bs-btn-hover-bg: var(--ww-brand-dark);
    --bs-btn-hover-border-color: var(--ww-brand-dark);
    --bs-btn-active-bg: var(--ww-brand-dark);
    --bs-btn-active-border-color: var(--ww-brand-dark);
}

/* Login-Seite: vertikal zentrierte, schmale Spalte */
.ww-auth {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
}

.ww-auth .card {
    width: 100%;
    max-width: 26rem;
}

/* Mitgeliefertes Logo (public/assets/logo.svg) und Bildzeichen (favicon.svg) */
.ww-logo {
    display: block;
    width: 100%;
    max-width: 17rem;
    height: auto;
    margin: 0 auto;
}
.ww-zeichen {
    height: 1.7rem;
    width: 1.7rem;
}
.ww-zeichen-gross {
    height: 3.5rem;
    width: 3.5rem;
}

.ww-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: .9rem;
    background: linear-gradient(135deg, var(--ww-brand), #0ea5e9);
    color: #fff;
}
.ww-brand-mark svg {
    width: 1.5rem;
    height: 1.5rem;
}

footer.ww-footer {
    flex-shrink: 0;
    padding: 1.25rem 0;
    color: #6b7280;
    font-size: .875rem;
}

/* Hilfe-Button: hellblaue Pill. Standard = fixe Notlage-Position oben rechts;
   app.js verschiebt die Pill in den Seitenkopf und setzt .im-kopf. */
.ww-hilfe-btn {
    position: fixed;
    top: 4.5rem;
    right: 1rem;
    z-index: 1050;
    flex: 0 0 auto;
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    padding: .25rem .8rem;
    border: 1px solid #a9d3f5;
    border-radius: 50rem;
    background-color: #d7ecff;
    color: #0b5ed7;
    font-size: .875rem;
    font-weight: 700;
    line-height: 1.4;
    cursor: pointer;
}
.ww-hilfe-btn.im-kopf {
    position: static;
    z-index: auto;
}
.ww-hilfe-btn:hover,
.ww-hilfe-btn:focus-visible {
    background-color: #bfe0ff;
    color: #094db5;
}

@media print {
    .ww-hilfe-btn,
    #wwHilfeModal { display: none !important; }
}

.ww-hilfe-text > :first-child { margin-top: 0; }
.ww-hilfe-text > :last-child { margin-bottom: 0; }
.ww-hilfe-text h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 1rem 0 .35rem;
}
.ww-hilfe-text ol,
.ww-hilfe-text ul {
    padding-left: 1.25rem;
    margin-bottom: .5rem;
}
.ww-hilfe-text li { margin-bottom: .2rem; }

/* Startseite: klickbare Bereichs-Kacheln (ganze Karte ist der Link, kein
   separater "oeffnen"-Button). */
.dash-card {
    transition: box-shadow .12s ease, transform .12s ease;
}
.dash-card:hover {
    box-shadow: 0 2px 6px rgba(16, 24, 40, .08), 0 12px 28px rgba(16, 24, 40, .12);
    transform: translateY(-1px);
}
.dash-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: .625rem;
    background: rgba(var(--bs-primary-rgb, 79, 70, 229), .12);
    color: var(--ww-brand, var(--bs-primary, #4f46e5));
}
.dash-icon svg {
    width: 1.4rem;
    height: 1.4rem;
}

/* Platzhalter-Karten (noch leere Bereiche) */
.ww-leer { border-style: dashed; }

/* Sortierbare Tabellen (app.js, table[data-sortierbar]) */
th.ww-sortierbar { cursor: pointer; user-select: none; white-space: nowrap; }
th.ww-sortierbar::after { content: "\2195"; margin-left: .3em; opacity: .3; font-weight: normal; }
th.ww-sortierbar[aria-sort="ascending"]::after { content: "\25B2"; opacity: .7; font-size: .75em; }
th.ww-sortierbar[aria-sort="descending"]::after { content: "\25BC"; opacity: .7; font-size: .75em; }

/* ---------------- Ereignisse ---------------- */

/* Selbsterweiterndes Auswahlfeld: Chips + Eingabe in einer Zeile (app.js, [data-auswahl]) */
.ww-auswahl-feld {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .3rem;
    min-height: calc(1.5em + .75rem + 2px);
    padding: .3rem .5rem;
    cursor: text;
}
.ww-auswahl-feld:focus-within {
    border-color: var(--ww-brand);
    box-shadow: 0 0 0 .25rem rgba(var(--bs-primary-rgb), .25);
}
.ww-auswahl-eingabe {
    flex: 1 1 8rem;
    min-width: 6rem;
    border: 0;
    outline: 0;
    padding: .15rem .2rem;
    background: transparent;
    color: inherit;
}
.ww-chip {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    padding: .15rem .25rem .15rem .6rem;
    border-radius: 50rem;
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    font-size: .875rem;
    line-height: 1.4;
}
.ww-chip-x {
    border: 0;
    background: transparent;
    color: inherit;
    opacity: .6;
    padding: 0 .3rem;
    line-height: 1;
    font-size: 1.1rem;
    border-radius: 50rem;
}
.ww-chip-x:hover,
.ww-chip-x:focus-visible { opacity: 1; background: rgba(0, 0, 0, .08); }

/* Vorschlagsliste unter Eingabefeldern (wwVorschlagsliste) */
.ww-vorschlaege {
    width: 100%;
    max-height: 16rem;
    overflow-y: auto;
    top: 100%;
    left: 0;
    margin-top: .15rem;
}
.ww-vorschlaege .dropdown-item { white-space: normal; }
.ww-vorschlaege .dropdown-item.active small,
.ww-vorschlaege .dropdown-item:active small { color: inherit !important; }
.ww-vorschlag-neu { font-style: italic; }

/* Badges der Ereignisse */
.ww-badge-tag        { background: var(--bs-primary-bg-subtle);   color: var(--bs-primary-text-emphasis); font-weight: 500; }
.ww-badge-person     { background: var(--bs-success-bg-subtle);   color: var(--bs-success-text-emphasis); font-weight: 500; }
.ww-badge-gegenstand { background: var(--bs-warning-bg-subtle);   color: var(--bs-warning-text-emphasis); font-weight: 500; }
.ww-badge-ort        { background: var(--bs-info-bg-subtle);      color: var(--bs-info-text-emphasis);    font-weight: 500; }
a.badge.ww-badge-tag:hover, a.badge.ww-badge-person:hover,
a.badge.ww-badge-gegenstand:hover, a.badge.ww-badge-ort:hover { filter: brightness(.95); }

/* Vorschaubild in Listen (Bild oder Uhr-Zeichen) */
.ww-vorschau {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: .6rem;
    overflow: hidden;
    background: rgba(var(--bs-primary-rgb), .1);
    color: var(--ww-brand);
}
.ww-vorschau img { width: 100%; height: 100%; object-fit: cover; }
.ww-vorschau svg { width: 1.4rem; height: 1.4rem; }
.ww-vorschau-klein { width: 2.75rem; height: 2.75rem; }
.ww-min-0 { min-width: 0; }

/* Bilder auf Detailseite und im Formular */
.ww-bild {
    display: block;
    width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: .75rem;
    background: var(--bs-tertiary-bg);
}
.ww-bild-klein { height: 4rem; width: auto; border-radius: .4rem; }

/* Webcam-Livebild im Kamerafenster */
.ww-kamera-video {
    display: block;
    width: 100%;
    max-height: 65vh;
    border-radius: .5rem;
    background: #000;
}
[data-bild-neu]:not(.d-none) { display: flex; }

/* Kleine Karte (Google Maps oder OpenStreetMap-iframe) */
.ww-karte {
    display: block;
    width: 100%;
    height: 14rem;
    border: 0;
    border-radius: .6rem;
    overflow: hidden;
    background: var(--bs-tertiary-bg);
}
.ww-karte iframe { width: 100%; height: 100%; border: 0; display: block; }

/* Google-Ortssuche (Web-Komponente der Places API) */
.ww-ort-suche { min-width: 14rem; }
.ww-ort-suche gmp-place-autocomplete,
.ww-ort-suche gmp-placeautocomplete { width: 100%; }

.ww-felder dt { font-weight: 500; color: var(--bs-secondary-color); }
.ww-felder dd .badge { margin: 0 .15rem .2rem 0; }

/* ---------------- Gruppen ---------------- */

/* Freigabe-Pills im Ereignis-Formular (input.btn-check + label.ww-pill) */
.ww-pill {
    --bs-btn-color: var(--bs-body-color);
    --bs-btn-border-color: var(--ww-brand);
    --bs-btn-hover-color: var(--bs-body-color);
    --bs-btn-hover-bg: rgba(var(--bs-primary-rgb), .08);
    --bs-btn-hover-border-color: var(--ww-brand);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--ww-brand);
    --bs-btn-active-border-color: var(--ww-brand);
    padding-left: .9rem;
    padding-right: .9rem;
}
.btn-check:checked + .ww-pill::before { content: "\2713\00a0"; }
.btn-check:focus-visible + .ww-pill { box-shadow: 0 0 0 .25rem rgba(var(--bs-primary-rgb), .3); }

.ww-badge-gruppe { background: var(--bs-secondary-bg-subtle); color: var(--bs-secondary-text-emphasis); font-weight: 500; border: 1px solid var(--bs-secondary-border-subtle); }
a.badge.ww-badge-gruppe:hover { filter: brightness(.95); }
.ww-nur-ich { color: var(--bs-secondary-color); font-weight: 500; }
.ww-von { font-style: italic; }

/* Reiter Alle / Meine / Mit mir geteilt */
.ww-reiter .nav-link { padding: .3rem .9rem; border-radius: 50rem; }
.ww-reiter .nav-link.active { background: var(--ww-brand); }

/* Tag-Leiste über der Ereignisliste */
.ww-tagleiste .badge { font-size: .8rem; }
.ww-tag-anzahl { opacity: .65; font-weight: 400; }
.ww-badge-tag.ww-tag-aktiv { background: var(--ww-brand); color: #fff; }


/* Monatskalender */
.ww-kal-monat { min-width: 9.5rem; }
.ww-kalender { overflow: hidden; }
.ww-kal-kopf, .ww-kal-woche { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.ww-kal-kopf > div {
    padding: .4rem .5rem;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
    border-bottom: 1px solid var(--bs-border-color);
}
.ww-kal-tag {
    min-height: 6.5rem;
    padding: .3rem .35rem .4rem;
    border-right: 1px solid var(--bs-border-color-translucent);
    border-bottom: 1px solid var(--bs-border-color-translucent);
    display: flex;
    flex-direction: column;
    gap: .15rem;
    min-width: 0;
}
.ww-kal-woche > .ww-kal-tag:last-child { border-right: 0; }
.ww-kal-woche:last-child > .ww-kal-tag { border-bottom: 0; }
.ww-kal-tag.ww-kal-we { background: rgba(var(--bs-secondary-rgb), .04); }
.ww-kal-ausser { background: rgba(var(--bs-secondary-rgb), .08); }
.ww-kal-ausser .ww-kal-zahl { color: var(--bs-secondary-color); }
.ww-kal-zahl {
    font-size: .8rem;
    font-weight: 600;
    min-width: 1.6rem;
    height: 1.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}
.ww-kal-heute .ww-kal-zahl { background: var(--ww-brand); color: #fff; }
.ww-kal-neu {
    color: var(--bs-secondary-color);
    text-decoration: none;
    font-weight: 600;
    line-height: 1;
    padding: 0 .3rem;
    border-radius: .25rem;
    opacity: 0;
}
.ww-kal-tag:hover .ww-kal-neu, .ww-kal-neu:focus-visible { opacity: 1; }
.ww-kal-neu:hover { background: rgba(var(--bs-primary-rgb), .1); color: var(--ww-brand); }
@media (hover: none) { .ww-kal-neu { opacity: .6; } }
.ww-kal-ereignis {
    display: block;
    font-size: .75rem;
    line-height: 1.3;
    padding: .1rem .35rem;
    border-radius: .25rem;
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ww-kal-ereignis:hover { filter: brightness(.95); color: var(--bs-primary-text-emphasis); }
.ww-kal-fremd { background: var(--bs-secondary-bg-subtle); color: var(--bs-secondary-text-emphasis); font-style: italic; }
.ww-kal-zeit { font-weight: 600; }
/* Schmal: nur Punkte statt Titel, die Liste steht unter dem Raster */
@media (max-width: 767.98px) {
    .ww-kal-kopf > div { padding: .3rem 0; text-align: center; }
    .ww-kal-tag { min-height: 3.6rem; padding: .2rem; align-items: center; flex-direction: row; flex-wrap: wrap; align-content: flex-start; justify-content: center; }
    .ww-kal-tag > .d-flex { width: 100%; justify-content: center !important; }
    .ww-kal-neu { display: none; }
    .ww-kal-ereignis { width: .45rem; height: .45rem; padding: 0; border-radius: 50%; font-size: 0; background: var(--ww-brand); }
    .ww-kal-fremd { background: var(--bs-secondary-color); }
}


/* Menü-Buttons in der Navbar (Icon; Beschriftung nur im aufgeklappten Handy-Menü) */
.ww-nav-btns { gap: .25rem; }
.ww-nav-btn {
    --bs-btn-color: var(--bs-secondary-color);
    --bs-btn-border-color: transparent;
    --bs-btn-hover-color: var(--ww-brand);
    --bs-btn-hover-bg: rgba(var(--bs-primary-rgb), .08);
    --bs-btn-hover-border-color: transparent;
    --bs-btn-active-color: var(--ww-brand);
    --bs-btn-active-bg: rgba(var(--bs-primary-rgb), .12);
    --bs-btn-active-border-color: transparent;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .4rem .55rem;
    border-radius: .5rem;
}
.ww-nav-btn svg { width: 1.1rem; height: 1.1rem; }
.ww-nav-btn.active { color: var(--ww-brand); background: rgba(var(--bs-primary-rgb), .12); }
.ww-nav-name { font-size: .875rem; }
@media (min-width: 992px) {
    .ww-nav-text { display: none; }
    .ww-nav-btns { flex-direction: row; align-items: center; }
}
@media (max-width: 991.98px) {
    .ww-nav-btns .ww-nav-btn { width: 100%; justify-content: flex-start; }
    .ww-nav-btns .dropdown-toggle::after { margin-left: auto; }
}
[data-bs-theme="dark"] .ww-nav-btn { --bs-btn-hover-color: #a5b4fc; --bs-btn-active-color: #a5b4fc; }
[data-bs-theme="dark"] .ww-nav-btn.active { color: #a5b4fc; }

/* Navbar-Buttons mit Farbverlauf wie das Logo (Systemfarbe → Himmelblau, diagonal).
   Inaktiv: beide Verlaufsfarben 20 % heller, aktiv (aktuelle Seite / offenes Menü): volle Farbe. */
:root { --ww-brand-2: #0ea5e9; }
.ww-navbar .ww-nav-btn {
    --ww-v1: color-mix(in srgb, var(--ww-brand) 80%, #fff);
    --ww-v2: color-mix(in srgb, var(--ww-brand-2) 80%, #fff);
    --bs-btn-color: #fff;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-color: #fff;
    --bs-btn-border-color: transparent;
    --bs-btn-hover-border-color: transparent;
    --bs-btn-active-border-color: transparent;
    background: linear-gradient(135deg, var(--ww-v1), var(--ww-v2));
    color: #fff;
    border-color: transparent;
}
.ww-navbar .ww-nav-btn:hover {
    --ww-v1: color-mix(in srgb, var(--ww-brand) 90%, #fff);
    --ww-v2: color-mix(in srgb, var(--ww-brand-2) 90%, #fff);
    color: #fff;
}
.ww-navbar .ww-nav-btn:active,
.ww-navbar .ww-nav-btn.active,
.ww-navbar .ww-nav-btn.show {
    --ww-v1: var(--ww-brand);
    --ww-v2: var(--ww-brand-2);
    color: #fff;
}
[data-bs-theme="dark"] .ww-navbar .ww-nav-btn,
[data-bs-theme="dark"] .ww-navbar .ww-nav-btn.active { color: #fff; --bs-btn-hover-color: #fff; --bs-btn-active-color: #fff; }

/* Jubiläen auf der Startseite */
.ww-jubilaeum { background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); font-weight: 600; }
.ww-jubilaeum-heute { background: linear-gradient(135deg, var(--ww-brand), var(--ww-brand-2)); color: #fff; }
