/* elwnet.css - Layout & Farben für ELWNet Übersicht */

/* Basis */
body {
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 0.9rem;
    background-color: #f5f5f5;
}

.page-header h1 {
    font-size: 1.4rem;
    margin: 0;
}

.card-header {
    font-size: 0.95rem;
}

/* Löschbezirk-Dropdown etwas breiter */
.lb-form {}

.lb-form .input-group {
    max-width: 260px;
}

/* Navbar User */
.navbar-user .text-truncate {
    max-width: 190px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tooltip */
.elwnet-tooltip {
    --bs-tooltip-bg: #111827;
    --bs-tooltip-color: #f8fafc;
}
.elwnet-tooltip .tooltip-inner {
    text-align: left;
    max-width: 360px;
    padding: 0.45rem 0.6rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    font-size: 0.78rem;
    line-height: 1.25;
}
.elwnet-tooltip .tt-row {
    display: flex;
    gap: 0.45rem;
}
.elwnet-tooltip .tt-row + .tt-row {
    margin-top: 0.2rem;
}
.elwnet-tooltip .tt-label {
    flex: 0 0 5.8rem;
    font-weight: 700;
    color: #e5e7eb;
    white-space: nowrap;
}
.elwnet-tooltip .tt-value {
    flex: 1 1 auto;
    min-width: 0;
    color: #f8fafc;
}

/* ----------------- */
/* Navbar-Meldungen  */
/* ----------------- */

.navbar-meldungen {
    gap: 0.75rem;
}

.meldung-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 3.5rem;
}

.meldung-label {
    font-size: 0.7rem;
    color: #e5e5e5;
}

.meldung-value {
    margin-top: 0.15rem;
    padding: 0.15rem 0.7rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Farben wie in der ursprünglichen elwnet.php */
.meldung-low { background-color: lightgreen; }
.meldung-mid { background-color: yellow; }
.meldung-high { background-color: orange; }
.meldung-critical { background-color: red; color: #fff; }

/* Einsatzzähler im Top-Menü */
.navbar-einsatz-counter {
    display: flex;
    gap: 0.75rem;
    margin-left: 2rem; /* Abstand zu den bestehenden Meldungs-Badges */
}

.einsatz-counter-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 4.5rem;
}

.einsatz-counter-label {
    font-size: 0.7rem;
    color: #e5e5e5;
}

.einsatz-counter-value {
    margin-top: 0.15rem;
    padding: 0.15rem 0.9rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    background-color: #dbeafe; /* hellblau */
    border: 1px solid #93c5fd;
    color: #1e3a8a; /* dunkelblau */
}

/* ----------------- */
/* WebPopup Box      */
/* ----------------- */

.webpopup-wrapper { max-width: 2000px; margin: 0 auto; }

.webpopup {
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    border-width: 1px;
}

/* Priority: 1 = rot, 2 = orange, 3 = gelb, 4 = hellgrün, sonst = hellgrau */
.webpopup.popup-prio-1 { background-color: #ffdddd !important; border-color: #e74c3c !important; color: #7b241c !important; }
.webpopup.popup-prio-2 { background-color: #ffe6cc !important; border-color: #e67e22 !important; color: #7e5109 !important; }
.webpopup.popup-prio-3 { background-color: #fff7cc !important; border-color: #f1c40f !important; color: #7d6608 !important; }
.webpopup.popup-prio-4 { background-color: #e6ffdd !important; border-color: #27ae60 !important; color: #145a32 !important; }
.webpopup.popup-prio-0 { background-color: #f2f4f4 !important; border-color: #b3b6b7 !important; color: #424949 !important; }

/* ---------------------------- */
/* Fahrzeug- & Einsatzkarten    */
/* ---------------------------- */

.fz-card, .einsatz-card {
    cursor: pointer;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}
.fz-card:hover, .einsatz-card:hover { background-color: #f8fafc; box-shadow: 0 0 0 1px #e2e8f0; }
.meldung-card {
    cursor: pointer;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}
.meldung-card:hover { box-shadow: 0 0 0 1px #e2e8f0; }

/* Fahrzeug-Liste im Kartenstil */
.fz-list .list-group-item { border: none; border-bottom: 1px solid #eee; }
.fz-list .fz-card { padding-top: 0.6rem; padding-bottom: 0.6rem; }

/* Fahrzeug-Grid nach LB */
.fz-groups { display: flex; flex-direction: column; gap: 0.6rem; }
.fz-group-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
    text-transform: none;
    letter-spacing: 0.01em;
    margin-bottom: 0.2rem;
}
.fz-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem;
}
@media (min-width: 1200px) and (max-width: 1399.98px) {
    .fz-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (min-width: 1400px) {
    .fz-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}
@media (max-width: 1199.98px) {
    .fz-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 575.98px) {
    .fz-grid { grid-template-columns: 1fr; }
}

.fz-grid.fz-grid-modal {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.35rem;
}
@media (max-width: 767.98px) {
    .fz-grid.fz-grid-modal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.fz-tile {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.55rem;
    padding: 0.35rem 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 2.75rem;
}
.fz-tile-left { min-width: 0; }
.fz-tile .fz-funkname { font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fz-status-box {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 0.45rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.15rem;
    border: 2px solid #cbd5e1;
    background-color: #f1f5f9;
    color: #0f172a;
    flex: 0 0 auto;
    margin-left: 0.45rem;
}

/* Status-Badge links (nur Zahl) */
.fz-status-badge {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    border: 2px solid transparent;
}

/* Fahrzeugstatus-Farben (1: grün, 2: dunkelgrün, 3: gelb, 4: orange, 6: grau) */
.fz-status-badge.status-1, .fz-status-box.status-1, .einsatz-fz-badge.status-1 { background-color: lightgreen; border-color: #7acb6b; color: #2e7d32; }
.fz-status-badge.status-2, .fz-status-box.status-2, .einsatz-fz-badge.status-2 { background-color: darkgreen; border-color: #2e7d32; color: #fff; }
.fz-status-badge.status-3, .fz-status-box.status-3, .einsatz-fz-badge.status-3 { background-color: yellow; border-color: #f1c40f; color: #a67c00; }
.fz-status-badge.status-4, .fz-status-box.status-4, .einsatz-fz-badge.status-4 { background-color: orange; border-color: #e67e22; color: #8c4b11; }
.fz-status-badge.status-6, .fz-status-box.status-6, .einsatz-fz-badge.status-6 { background-color: lightgrey; border-color: #b0b0b0; color: #555; }
.fz-status-badge.status-10, .fz-status-box.status-10, .einsatz-fz-badge.status-10 { background-color: #e2e8f0; border-color: #94a3b8; color: #0f172a; }

/* Fahrzeugtexte */
.fz-funkname { font-size: 0.95rem; }
.fz-typ { font-size: 0.8rem; }
.fz-eort, .fz-stichwort { font-size: 0.8rem; }
.fz-staerke { font-size: 0.8rem; }

/* ---------------------------- */
/* Einsatz-Liste (Karten)       */
/* ---------------------------- */

.einsatz-list .list-group-item { border: none; border-bottom: 1px solid #eee; }
.einsatz-card { padding-top: 0.6rem; padding-bottom: 0.6rem; border-radius: 0; }
.einsatz-right { min-width: 9rem; }

/* Desktop: Liste scrollt, Card wächst nicht endlos */
@media (min-width: 992px) {
    .einsatz-list {
        max-height: calc(100vh - 320px);
        overflow-y: auto;
        overscroll-behavior: contain;
    }
}

/* Prio-Hintergründe leicht einfärben */
.einsatz-card.prio-hoch { background-color: #ffecec; }
.einsatz-card.prio-sofort { background-color: #f5e9ff; }
.einsatz-card.prio-blitz { background-color: #f2e6ff; }

/* Einsatz-Status-Badge (voller Text) */
.einsatz-status-badge {
    display: inline-block;
    padding: 0.25rem 0.9rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    border: 1px solid #ddd;
    background-color: #f4f4f4;
    color: #333;
    white-space: nowrap;
}
.einsatz-status-badge.estatus-3 { background-color: lightgreen; border-color: #7acb6b; color: #2e7d32; }
.einsatz-status-badge.estatus-4 { background-color: lightgrey; border-color: #b0b0b0; color: #555; }

.einsatz-stichwort { font-size: 0.95rem; }
.einsatz-ort, .einsatz-zusatz { font-size: 0.8rem; }
.einsatz-ids { font-size: 0.75rem; }

/* Fahrzeug-Badges in der Einsatzliste */
.einsatz-fhz-badges { display: flex; flex-wrap: wrap; gap: 0.25rem; }

/* Basis-Style für ALLE Fahrzeug-Badges (auch ohne Status-Farbe) */
.einsatz-fz-badge {
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    border: 1px solid #ddd;
    background-color: #f7f7f7;
    color: #555;
}

/* ---------------------------- */
/* Aufträge & Meldungen         */
/* ---------------------------- */

.meldung-list .list-group-item { border: none; border-bottom: 1px solid #eee; }
.meldung-card { padding-top: 0.55rem; padding-bottom: 0.55rem; border-radius: 0; }

.meldung-layout {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}

.meldung-meta { flex: 0 1 38%; min-width: 0; }
.meldung-topline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: baseline;
    line-height: 1.1;
}

.meldung-badges { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.meldung-badge {
    padding: 0.12rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    border: 1px solid #ddd;
    background-color: #f1f5f9;
    color: #475569;
}
.meldung-badge.on {
    background-color: #dcfce7;
    border-color: #86efac;
    color: #166534;
}
.meldung-badge.off {
    background-color: #f1f5f9;
    border-color: #e2e8f0;
    color: #94a3b8;
}

.meldung-text {
    flex: 1 1 52%;
    min-width: 0;
    font-size: 0.85rem;
    line-height: 1.25;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.meldung-actions {
    flex: 0 0 auto;
    display: flex;
    gap: 0.25rem;
}
.meldung-actions .btn {
    padding: 0.25rem 0.35rem;
    line-height: 1;
}
.meldung-actions svg {
    width: 16px;
    height: 16px;
    display: block;
}

.meldung-art-badge {
    display: inline-block;
    padding: 0.12rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    border: 1px solid #dbeafe;
    background-color: #eff6ff;
    color: #1e3a8a;
}

/* Prio-Hintergründe (wie Einsatz-Prio: ganze Zeile) */
.meldung-card.meldung-prio-1 { background-color: transparent; }
.meldung-card.meldung-prio-2 { background-color: rgba(239, 68, 68, 0.08); }
.meldung-card.meldung-prio-3 { background-color: rgba(239, 68, 68, 0.22); }
.meldung-card.meldung-prio-4 { background-color: rgba(168, 85, 247, 0.18); }

@media (max-width: 767.98px) {
    .meldung-layout { flex-direction: column; align-items: stretch; gap: 0.35rem; }
    .meldung-meta { flex: 1 1 auto; }
    .meldung-text { white-space: normal; }
    .meldung-actions { justify-content: flex-end; }
}

/* Fahrzeugliste in Einsatzdetails (Modal) */
.einsatz-fhz-list { display: flex; flex-direction: column; gap: 0.15rem; }
.einsatz-fhz-row { display: flex; align-items: center; gap: 0.4rem; }

/* Modal-Animation */
.modal.fade .detail-dialog { transform: translateY(-10px) scale(0.96); opacity: 0; }
.modal.show .detail-dialog { transform: translateY(0) scale(1); opacity: 1; transition: transform 0.18s ease-out, opacity 0.18s ease-out; }

/* Größeres Modal */
.detail-dialog { max-width: 95vw; }
@media (min-width: 1400px) {
    .detail-dialog { max-width: 1700px; }
}
@media (min-width: 992px) {
    .detail-dialog .modal-content { height: calc(100vh - 4rem); }
    .detail-dialog .modal-body { overflow: auto; }
}

/* Kartenbereich im Modal */
.einsatz-detail-row { align-items: stretch; }
.einsatz-map-col { display: flex; flex-direction: column; }
.einsatz-map-wrapper {
    width: 100%;
    min-height: 260px;
    height: clamp(260px, 55vh, 700px);
    border-radius: 0.6rem;
    overflow: hidden;
    box-shadow: 0 0 0 1px #e2e8f0;
    background: #e5e7eb;
}
.einsatz-map-wrapper #einsatz-map { width: 100%; height: 100%; }
.einsatz-map-col .einsatz-map-wrapper { flex: 1 1 auto; }

/* Kompaktere Cards im Modal */
.einsatz-detail .card-body.py-3 { padding-top: 0.8rem !important; padding-bottom: 0.8rem !important; }
.einsatz-detail .card.shadow-sm.mb-3 { margin-bottom: 0.6rem !important; }
.einsatz-detail .card-header.py-2 { padding-top: 0.45rem !important; padding-bottom: 0.45rem !important; }

/* Responsive Tweaks */
@media (max-width: 767.98px) {
    body { font-size: 0.85rem; }
    .page-header h1 { font-size: 1.2rem; }
    .navbar-brand { font-size: 1rem; }
    .navbar-meldungen { display: none; }
    .lb-form .input-group { max-width: 100%; }
    .detail-dialog { max-width: 100%; }
    .einsatz-map-wrapper { min-height: 200px; height: 240px; margin-top: 0.5rem; }
}

/* Extra Platz auf sehr breiten Monitoren */
@media (min-width: 1400px) {
    .container-fluid { max-width: 2000px; }
}
@media (min-width: 1800px) {
    .container-fluid { max-width: 2400px; }
}
