/*
 * Ergänzungen zu Bootstrap 5.3 – Farbschema (Oliv/Feldgrau) und einige Komponenten.
 * Grundlayout, Raster und Formulare kommen vollständig aus Bootstrap.
 */
:root {
    --app-green: #36452b;
    --app-green-dark: #26311e;
    --app-accent: #c8a64b;
    --bs-primary: #4b5e3a;
    --bs-primary-rgb: 75, 94, 58;
    --bs-link-color: #3f5a2a;
    --bs-link-color-rgb: 63, 90, 42;
    --bs-link-hover-color: #26311e;
    --bs-border-radius: .6rem;
}
.btn-primary {
    --bs-btn-bg: #4b5e3a; --bs-btn-border-color: #4b5e3a;
    --bs-btn-hover-bg: #3c4c2e; --bs-btn-hover-border-color: #3c4c2e;
    --bs-btn-active-bg: #2f3c24; --bs-btn-active-border-color: #2f3c24;
    --bs-btn-disabled-bg: #4b5e3a; --bs-btn-disabled-border-color: #4b5e3a;
}
.btn-outline-primary {
    --bs-btn-color: #4b5e3a; --bs-btn-border-color: #4b5e3a;
    --bs-btn-hover-bg: #4b5e3a; --bs-btn-hover-border-color: #4b5e3a;
    --bs-btn-active-bg: #3c4c2e; --bs-btn-active-border-color: #3c4c2e;
}
.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: #8fa274; box-shadow: 0 0 0 .25rem rgba(75, 94, 58, .2);
}
.form-check-input:checked { background-color: #4b5e3a; border-color: #4b5e3a; }
.nav-pills .nav-link.active { background-color: #4b5e3a; }
.page-link { color: #3f5a2a; }
.active > .page-link, .page-link.active { background-color: #4b5e3a; border-color: #4b5e3a; }

.app-navbar { background: linear-gradient(90deg, var(--app-green-dark), var(--app-green)); }
.app-navbar .nav-link.active { color: #fff; border-bottom: 2px solid var(--app-accent); }

.card { border: 0; box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 2px 8px rgba(0, 0, 0, .04); }
.card-header { background: transparent; font-weight: 600; }
.stat-card .display-6 { font-weight: 700; }

/* Kennzeichen-Optik wie das echte Bundeswehr-Schild: weiß, schwarzer Doppelrand, Deutschlandfahne links */
.plate {
    --plate-font: "DIN 1451 Mittelschrift", "Bahnschrift SemiCondensed", "Bahnschrift", "Arial Narrow", "Roboto Condensed", sans-serif;
    display: inline-flex; align-items: center; gap: .4em;
    font-family: var(--plate-font); font-weight: 700; font-stretch: condensed; font-variant-numeric: tabular-nums;
    letter-spacing: .06em; line-height: 1.15; padding: .12em .55em .12em .3em;
    border: 2px solid #111; border-radius: .35em; box-shadow: inset 0 0 0 1.5px #fff, inset 0 0 0 2.5px #111;
    background: #fff; color: #111 !important; text-decoration: none; white-space: nowrap;
}
.plate::before {
    content: ""; flex: none; width: .5em; height: 1.05em;
    background: linear-gradient(#000 0 33.34%, #dd0000 33.34% 66.67%, #ffce00 66.67% 100%);
}
a.plate:hover { box-shadow: inset 0 0 0 1.5px #fff, inset 0 0 0 2.5px #111, 0 0 0 .2rem rgba(75, 94, 58, .25); }
.plate-lg { font-size: 1.6rem; padding: .15em .6em .15em .35em; }
.navbar-brand .brand-logo { height: 30px; width: auto; display: block; }
.plate-input .input-group-text {
    background: #fff; color: #111; font: 700 1.25rem "Bahnschrift", "Arial Narrow", sans-serif; gap: .4rem; border-color: #111;
}
.plate-input .input-group-text::before {
    content: ""; width: .55rem; height: 1.2rem; background: linear-gradient(#000 0 33.34%, #dd0000 33.34% 66.67%, #ffce00 66.67% 100%);
}
.plate-input .form-control { font: 700 1.25rem ui-monospace, monospace; letter-spacing: .08em; }

/* Große, gut tippbare Foto-Buttons */
.file-btn { position: relative; overflow: hidden; }
.file-btn .file-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 100px; }
.file-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: .5rem; }
.file-preview figure { margin: 0; font-size: .75rem; }
.file-preview .thumb { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: .4rem; background: #e5e7e1;
    display: flex; align-items: center; justify-content: center; color: #6c757d; }

/* Fotogalerie */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.photo-grid .photo-tile { position: relative; display: block; border-radius: .5rem; overflow: hidden; background: #e5e7e1; aspect-ratio: 4 / 3; }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.photo-grid .photo-tile:hover img { transform: scale(1.04); }
.photo-grid .photo-tile .placeholder-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 600; color: #6c757d; }

/* Lebenslauf-Zeitleiste */
.timeline { list-style: none; margin: 0; padding: 0 0 0 1.5rem; border-left: 3px solid #d7dccf; }
.timeline > li { position: relative; margin-bottom: 1.25rem; }
.timeline > li::before {
    content: ""; position: absolute; left: calc(-1.5rem - 8px); top: .45rem; width: 13px; height: 13px;
    border-radius: 50%; background: var(--bs-primary); border: 2px solid #fff; box-shadow: 0 0 0 2px #d7dccf;
}
.timeline > li.is-rejected::before { background: #adb5bd; }
.timeline > li.is-pending::before { background: #ffc107; }

.ki-box .progress { background-color: rgba(0, 0, 0, .08); }
.table > :not(caption) > * > * { vertical-align: middle; }
.text-prewrap { white-space: pre-wrap; }
.min-w-0 { min-width: 0; }

/* --- Fotos: Lightbox und Karten --- */
.photo-grid .photo-tile { cursor: zoom-in; }
.photo-badge { position: absolute; right: .35rem; bottom: .3rem; font-size: .85rem; line-height: 1;
    background: rgba(255, 255, 255, .85); border-radius: 999px; padding: .15rem .3rem; }

#lightbox .modal-content { overflow: hidden; }
.lb-stage { position: relative; background: #111; min-height: 55vh; display: flex; align-items: center; justify-content: center; touch-action: pan-y; }
.lb-stage img { max-width: 100%; max-height: 80vh; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.lb-heic { color: #ddd; padding: 2rem; }
.lb-spinner { position: absolute; top: 1rem; right: 1rem; width: 1.5rem; height: 1.5rem; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 2.75rem; height: 2.75rem; border: 0; border-radius: 50%;
    background: rgba(0, 0, 0, .45); color: #fff; font-size: 2rem; line-height: 1; display: flex; align-items: center; justify-content: center; }
.lb-nav:hover, .lb-nav:focus-visible { background: rgba(0, 0, 0, .7); }
.lb-prev { left: .75rem; }
.lb-next { right: .75rem; }
.lb-side { background: var(--bs-body-bg); }
@media (min-width: 992px) {
    .lb-side { max-height: 85vh; overflow-y: auto; }
    .lb-stage img { max-height: 85vh; }
}
@media (max-width: 991.98px) {
    .lb-stage { min-height: 50vh; }
    .lb-stage img { max-height: 60vh; }
}

.map-box { height: 220px; border-radius: .5rem; overflow: hidden; background: #e5e7e1; z-index: 0; }
.map-box-lg { height: 340px; border-radius: 0 0 .6rem .6rem; }
.map-box-error { display: flex; align-items: center; justify-content: center; color: #6c757d; font-size: .875rem; }
.card > .map-box { border-radius: 0 0 .6rem .6rem; }
.kz-pin { background: #4b5e3a; color: #fff; border: 2px solid #fff; border-radius: 50%; font: 700 12px/22px system-ui, sans-serif;
    text-align: center; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
.leaflet-popup-content { font-size: .875rem; }

/* --- Lebenslauf: ein Block je Datum --- */
.day-block { border-left: 5px solid var(--bs-primary); overflow: hidden; }
.day-block.is-pending { border-left-color: #ffc107; }
.day-block.is-rejected { border-left-color: #adb5bd; opacity: .75; }
.day-head { display: flex; align-items: center; gap: 1rem; padding: .75rem 1rem; background: #f1f3ec; border-bottom: 1px solid #e2e6da; }
.day-date { flex: 0 0 auto; width: 3.6rem; text-align: center; line-height: 1.05; background: #fff; border-radius: .5rem;
    padding: .3rem .2rem; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.day-num { display: block; font-size: 1.5rem; font-weight: 700; color: var(--app-green); }
.day-month, .day-year { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: #6c757d; }
.sighting-row { padding: .85rem 0; }
.sighting-row + .sighting-row { border-top: 1px dashed #d7dccf; }
.sighting-row:last-child { padding-bottom: .25rem; }
.day-gap { display: flex; align-items: center; justify-content: center; height: 2.25rem; position: relative; }
.day-gap::before { content: ""; position: absolute; left: 2.6rem; top: 0; bottom: 0; border-left: 3px dotted #c9cfbf; }
.day-gap span { font-size: .75rem; color: #6c757d; background: var(--bs-tertiary-bg); padding: 0 .5rem; position: relative; }

@media (max-width: 575.98px) {
    .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem; }
    .photo-grid .small { font-size: .7rem; }
    .day-head { gap: .6rem; padding: .6rem .75rem; }
}

/* --- Standort für Fotos setzen --- */
.photo-cell { position: relative; }
.photo-select { display: none; position: absolute; top: .4rem; left: .4rem; z-index: 2; width: 1.4rem; height: 1.4rem;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .9); cursor: pointer; }
.standort-modus .photo-select { display: block; }
.standort-modus .photo-cell.is-selected .photo-tile { outline: 3px solid var(--bs-primary); outline-offset: 2px; }
.map-box-picker { height: 300px; cursor: crosshair; }
.kz-pin-ziel { background: #c8a64b; width: 22px; height: 22px; cursor: grab; }
.standort-card { position: relative; z-index: 1; }
#standort-treffer .list-group-item { font-size: .8rem; }
.day-num-sm { font-size: 1.1rem; }

/* --- Fotodetails --- */
.photo-detail-stage { background: #111; display: flex; align-items: center; justify-content: center; min-height: 40vh; }
.photo-detail-stage img { max-width: 100%; max-height: 75vh; object-fit: contain; display: block; }
.fuzzy-date input[hidden] { display: none !important; }
.rights-matrix .table-group th { background: #f1f3ec; padding-top: .4rem; padding-bottom: .4rem; letter-spacing: .04em; }
.rights-matrix td { width: 7rem; }

/* --- Einheiten: Wappen --- */
.unit-wappen { width: 20px; height: 20px; object-fit: contain; vertical-align: -4px; }
.unit-wappen-md { width: 36px; height: 36px; object-fit: contain; }
.unit-wappen-lg { width: 96px; height: 96px; object-fit: contain; }
.unit-wappen-cell { width: 52px; text-align: center; }
.unit-wappen-leer { opacity: .25; font-size: 1.4rem; }
.unit-link { text-decoration: none; }
a.unit-link:hover { text-decoration: underline; }
.wappen-treffer { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .5rem; margin-top: .5rem; }
.wappen-option { display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: .4rem; border: 1px solid var(--bs-border-color);
    border-radius: .5rem; background: #fff; text-align: center; min-width: 0; }
.wappen-option:hover, .wappen-option:focus-visible { border-color: var(--bs-primary); box-shadow: 0 0 0 .2rem rgba(75, 94, 58, .2); }
.wappen-option img { width: 88px; height: 88px; object-fit: contain; }
.wappen-option-titel { font-size: .75rem; line-height: 1.2; max-width: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.wappen-option-lizenz { font-size: .65rem; color: var(--bs-secondary-color); }

/* --- Einheiten-Baum --- */
.unit-child td { background: #fbfcf9; }
.unit-child .unit-tree { color: var(--bs-secondary-color); margin-left: .25rem; }
.unit-wappen-geerbt { opacity: .55; }

/* --- Fahrzeugübersicht: Auswahl und Vorschau --- */
.vehicle-table .col-check { width: 2.25rem; }
.vehicle-table .col-toggle { width: 2rem; text-align: center; }
.vorschau-toggle { text-decoration: none; color: var(--bs-body-color); font-size: 1.1rem; line-height: 1; }
.vorschau-toggle:disabled { opacity: .25; }
.vorschau-toggle .toggle-icon { display: inline-block; transition: transform .15s ease; }
.vorschau-toggle[aria-expanded="true"] .toggle-icon { transform: rotate(90deg); }
.vehicle-table tr.is-open > td { border-bottom-color: transparent; }
.vorschau-row > td { background: #f6f7f3; padding: .75rem 1rem 1rem; }
.vorschau-grid .photo-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.bulk-type-bar { position: sticky; top: .5rem; z-index: 5; }
.bulk-type-bar.has-selection { border-color: var(--bs-primary); box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .08); }

/* --- Dashboard --- */
.dash-hero { background: linear-gradient(135deg, var(--app-green-dark) 0%, var(--app-green) 55%, #56693f 100%); color: #fff;
    border-radius: 1rem; padding: 1.5rem 1.75rem; box-shadow: 0 .5rem 1.5rem rgba(38, 49, 30, .18); position: relative; overflow: hidden; }
.dash-hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 220px; height: 220px; border-radius: 50%;
    background: radial-gradient(circle, rgba(200, 166, 75, .35), rgba(200, 166, 75, 0) 70%); pointer-events: none; }
.dash-hero > * { position: relative; z-index: 1; }
.dash-date { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--app-accent); font-weight: 600; }
.dash-stat { border: 0; box-shadow: 0 .125rem .5rem rgba(0, 0, 0, .06); transition: transform .12s ease, box-shadow .12s ease; }
.dash-stat:hover { transform: translateY(-2px); box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .1); }
.dash-stat-icon { font-size: 1.6rem; width: 2.75rem; height: 2.75rem; border-radius: .75rem; background: #eef1e8;
    display: inline-flex; align-items: center; justify-content: center; flex: none; }
.dash-stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1.1; color: var(--app-green-dark); }
.dash-todo-icon { width: 2.4rem; height: 2.4rem; border-radius: .6rem; display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.15rem; flex: none; }
.dash-progress { height: .6rem; }
.dash-progress-sm { height: .35rem; }
.dash-bar-gut { background-color: #4b7a3a; }
.dash-bar-mittel { background-color: var(--app-accent); }
.dash-bar-wenig { background-color: #c0623a; }
.dash-chart { display: flex; align-items: flex-end; gap: .3rem; height: 120px; }
.dash-chart-col { flex: 1 1 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-width: 0; }
.dash-chart-bar { width: 100%; max-width: 26px; background: linear-gradient(180deg, #6e8a52, var(--app-green)); border-radius: .3rem .3rem 0 0; min-height: 2px; }
.dash-chart-val { font-size: .65rem; color: var(--bs-secondary-color); line-height: 1.2; }
.dash-chart-lbl { font-size: .65rem; color: var(--bs-secondary-color); margin-top: .2rem; }
.dash-photos { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.dash-photo-plate { position: absolute; left: .35rem; bottom: .35rem; background: #fff; color: #111; border: 1.5px solid #111;
    border-radius: .25rem; font: 700 .7rem/1.3 "Bahnschrift", "Arial Narrow", sans-serif; padding: 0 .3rem; letter-spacing: .03em; }
@media (max-width: 575.98px) {
    .dash-hero { padding: 1.1rem 1.2rem; border-radius: .8rem; }
    .dash-stat-value { font-size: 1.35rem; }
    .dash-stat-icon { display: none; }
    .dash-photos { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.dash-hero h1 { color: #fff; }

/* --- Kennzeichen-Erkennung --- */
.plate-chip { font-family: "Bahnschrift", "Arial Narrow", sans-serif; font-weight: 700; letter-spacing: .04em; }

/* --- Aufräumen (spielerisch) --- */
.cleanup-rank { border: 0; box-shadow: 0 .125rem .5rem rgba(0, 0, 0, .08); min-width: 260px; }
.cleanup-rank-badge { font-size: 2rem; line-height: 1; }
.cleanup-rank-progress { height: .45rem; width: 180px; }
.cleanup-card .card-header { background: #fff; }
.cleanup-photos .photo-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.cleanup-photos .photo-cell:first-child { grid-column: 1 / -1; }
.cleanup-photos .photo-cell:first-child .photo-tile { aspect-ratio: 4 / 3; }
.cleanup-nophoto { background: #f1f3ec; border-radius: .75rem; text-align: center; padding: 3rem 1rem; font-size: 2.5rem; color: var(--bs-secondary-color); }
.cleanup-stat { font-size: 1.5rem; font-weight: 700; color: var(--app-green-dark); line-height: 1.2; }
.cleanup-feier { animation: kz-pop .45s ease-out; border: 0; box-shadow: 0 .25rem 1rem rgba(75, 122, 58, .25); }
.cleanup-feier-punkte { font-size: 2rem; font-weight: 800; color: #2f6b23; animation: kz-rise 1s ease-out; }
.cleanup-befoerdert { background: #fff6d6; border-radius: .5rem; padding: .35rem .75rem; animation: kz-pop .6s .2s ease-out both; }
@keyframes kz-pop { 0% { transform: scale(.85); opacity: 0; } 70% { transform: scale(1.03); opacity: 1; } 100% { transform: scale(1); } }
@keyframes kz-rise { 0% { transform: translateY(10px); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .cleanup-feier, .cleanup-feier-punkte, .cleanup-befoerdert { animation: none; } }
.app-navbar .nav-link { white-space: nowrap; }

/* --- Einstellungen --- */
.settings-num { max-width: 16rem; }
.settings-save { position: sticky; bottom: 0; padding: .75rem 0; background: linear-gradient(transparent, var(--bs-body-bg) 35%); z-index: 2; }

/* Hilfe */
.help-toc { position: sticky; top: 5rem; }
.help-section { scroll-margin-top: 5rem; transition: box-shadow .4s; }
.help-section.help-flash { box-shadow: 0 0 0 .25rem rgba(75, 83, 32, .45); }
.help-body h3, .help-body h4, .help-body h5 { scroll-margin-top: 5rem; }
.help-body table { width: auto; max-width: 100%; }
.help-body kbd { font-size: .8em; }
@media (max-width: 991.98px) { .help-toc { position: static; } }
.help-search { min-width: 16rem; }
.export-icon { width: 1.6em; }
