/* KI-Analyse – Dashboard-Layout */

.bs-analysis-page {
    max-width: 1600px;
}

.bs-scope-summary {
    border-left: 3px solid var(--primary, #0d6efd);
    background: var(--bg-secondary, #f8f9fa);
}

.bs-scope-summary .card-body {
    background: transparent;
}

.bs-analysis-filters .card-header {
    background: var(--bg-secondary, #f8f9fa);
}

.bs-analysis-form .form-label {
    font-weight: 600;
    color: var(--text-muted, #6c757d);
}

.bs-filter-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.35rem;
}

.bs-filter-suggestion {
    border: 1px solid var(--border-color, #dee2e6);
    background: var(--bg-secondary, #f8f9fa);
    color: inherit;
    border-radius: 999px;
    padding: 0.1rem 0.55rem;
    font-size: 0.72rem;
    line-height: 1.4;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.bs-filter-suggestion:hover,
.bs-filter-suggestion:focus {
    background: var(--primary, #0d6efd);
    border-color: var(--primary, #0d6efd);
    color: #fff;
    outline: none;
}

.bs-active-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}

.bs-active-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid var(--primary, #0d6efd);
    background: rgba(13, 110, 253, 0.08);
    color: var(--primary, #0d6efd);
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
    font-size: 0.75rem;
    line-height: 1.4;
    cursor: pointer;
}

.bs-active-filter-chip:hover,
.bs-active-filter-chip:focus {
    background: var(--primary, #0d6efd);
    color: #fff;
    outline: none;
}

.bs-active-filter-clear {
    border: none;
    background: transparent;
    color: var(--text-muted, #6c757d);
    font-size: 0.75rem;
    text-decoration: underline;
    padding: 0.15rem 0.35rem;
    cursor: pointer;
}

.bs-active-filter-clear:hover,
.bs-active-filter-clear:focus {
    color: var(--primary, #0d6efd);
    outline: none;
}

.bs-autosuggest {
    position: relative;
}

.bs-autosuggest__list {
    position: absolute;
    z-index: 1050;
    left: 0;
    right: 0;
    top: calc(100% + 2px);
    max-height: 240px;
    overflow-y: auto;
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    -webkit-overflow-scrolling: touch;
}

.bs-autosuggest__item {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    padding: 0.45rem 0.65rem;
    border: none;
    border-bottom: 1px solid var(--border-color, #eee);
    background: transparent;
    text-align: left;
    cursor: pointer;
    font-size: 0.85rem;
}

.bs-autosuggest__item:last-child {
    border-bottom: none;
}

.bs-autosuggest__item:hover,
.bs-autosuggest__item:focus {
    background: var(--bg-secondary, #f8f9fa);
    outline: none;
}

.bs-autosuggest__label {
    font-weight: 500;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
}

.bs-autosuggest__type {
    flex-shrink: 0;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    padding: 0.12rem 0.4rem;
    border-radius: 999px;
    background: var(--bg-secondary, #eef1f4);
    color: var(--text-muted, #6c757d);
}

.bs-autosuggest__item[data-type="bundesland"] .bs-autosuggest__type {
    background: rgba(13, 110, 253, 0.12);
    color: #0d6efd;
}

.bs-autosuggest__item[data-type="kreis"] .bs-autosuggest__type {
    background: rgba(25, 135, 84, 0.12);
    color: #198754;
}

.bs-autosuggest__item[data-type="stadt"] .bs-autosuggest__type {
    background: rgba(255, 193, 7, 0.2);
    color: #997404;
}

.bs-stat-card {
    border-radius: 10px;
    border: 1px solid var(--border-color, #dee2e6);
}

.bs-analysis-main {
    align-items: stretch;
}

.bs-analysis-lagebild .lagebild-card,
.bs-analysis-lagebild .row.mb-3 {
    margin-bottom: 0 !important;
}

.bs-analysis-lagebild .lagebild-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.bs-analysis-lagebild .card-body {
    flex: 1;
    overflow-y: auto;
    max-height: min(62vh, 520px);
}

.bs-analysis-map-col .bs-hotspot-widget {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.bs-analysis-map-wrap {
    flex: 1;
    height: auto !important;
    min-height: 320px;
    max-height: min(52vh, 480px);
}

.bs-event-chip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    margin-bottom: 0.35rem;
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 8px;
    background: var(--bg-primary, #fff);
    text-align: left;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.bs-event-chip:hover {
    background: var(--bg-secondary, #f8f9fa);
    border-color: var(--primary, #0d6efd);
}

.bs-sev-extreme { background-color: #dc3545 !important; }
.bs-sev-severe { background-color: #fd7e14 !important; }
.bs-sev-moderate { background-color: #ffc107 !important; }
.bs-sev-minor { background-color: #20c997 !important; }
.bs-sev-unknown { background-color: #6c757d !important; }

.bs-daily-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 140px;
    padding-top: 0.5rem;
    overflow-x: auto;
}

.bs-daily-bar {
    flex: 1 0 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    min-width: 28px;
    height: 100%;
}

.bs-daily-bar__fill {
    width: 100%;
    max-width: 24px;
    background: linear-gradient(180deg, #0d6efd, #6ea8fe);
    border-radius: 4px 4px 0 0;
    min-height: 4px;
}

.bs-daily-bar small {
    font-size: 0.65rem;
    color: var(--text-muted, #6c757d);
    margin-top: 4px;
    white-space: nowrap;
}

.bs-warnings-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.bs-warning-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color, #dee2e6);
}

.bs-warning-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.bs-warning-item__head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.bs-warning-item__title {
    color: inherit;
    text-decoration: none;
}

.bs-warning-item__title:hover {
    text-decoration: underline;
}

.tagesueberblick-teaser {
    background: linear-gradient(135deg, var(--bg-primary, #fff) 0%, var(--bg-secondary, #f8f9fa) 100%);
}

@media (max-width: 991.98px) {
    .bs-analysis-lagebild .card-body {
        max-height: none;
    }

    .bs-analysis-map-wrap {
        max-height: 360px;
    }
}

/* ── Tablet ── */
@media (max-width: 991.98px) {
    .bs-analysis-page .bs-page-actions {
        width: 100%;
    }
}

/* ── Smartphone ── */
@media (max-width: 767.98px) {
    .bs-analysis-page {
        overflow-x: hidden;
    }

    .bs-analysis-page.container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .bs-analysis-page .page-intro,
    .bs-analysis-page h1.h3 {
        font-size: 1.25rem;
    }

    .bs-analysis-page .bs-page-actions {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    .bs-analysis-page .bs-page-actions .btn {
        width: 100%;
    }

    .bs-filter-suggestions {
        max-height: 5.5rem;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.15rem;
    }

    .bs-filter-suggestion {
        min-height: 2rem;
        font-size: 0.78rem;
        padding: 0.3rem 0.7rem;
        touch-action: manipulation;
    }

    .bs-filter-actions {
        position: sticky;
        bottom: 0;
        z-index: 20;
        background: var(--bg-primary, #fff);
        border-top: 1px solid var(--border-color, #dee2e6);
        margin: 0 -0.75rem;
        padding: 0.65rem 0.75rem calc(0.65rem + env(safe-area-inset-bottom, 0px));
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
    }

    .bs-filter-actions .btn {
        flex: 1 1 calc(50% - 0.25rem);
        min-height: 2.5rem;
    }

    .bs-filter-submit-label {
        display: none;
    }

    .bs-filter-actions .btn-primary::after {
        content: 'Aktualisieren';
    }

    .bs-stat-card .h5 {
        font-size: 1.1rem;
    }

    .bs-stat-card small {
        font-size: 0.68rem;
        line-height: 1.2;
    }

    .bs-analysis-map-wrap {
        min-height: 240px;
        max-height: min(48vh, 340px);
    }

    .bs-hotspot-widget__header h5 {
        font-size: 1rem;
    }

    .bs-warning-item__head {
        flex-direction: column;
        align-items: flex-start;
    }

    .bs-warning-item__title {
        font-size: 0.95rem;
        line-height: 1.35;
    }

    .bs-warning-item__cta {
        display: none;
    }

    .bs-warning-item__preview {
        -webkit-line-clamp: 3;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .tagesueberblick-teaser .d-flex.gap-2 {
        flex-direction: column;
    }

    .tagesueberblick-teaser .btn {
        width: 100%;
    }
}

@media (max-width: 575.98px) {
    #bs-stats-row {
        --bs-gutter-x: 0.35rem;
    }

    .bs-hotspot-widget__controls {
        flex-direction: column;
        align-items: stretch;
    }

    .bs-hotspot-widget__presets {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr);
        width: 100%;
    }

    .bs-hotspot-widget__presets .btn {
        min-width: 0;
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }

    .bs-hotspot-widget__play {
        width: 100%;
        justify-content: center;
    }

    .bs-hotspot-legend {
        font-size: 10px;
        padding: 4px 6px;
        max-width: 120px;
    }
}

@media (pointer: coarse) {
    .bs-filter-suggestion,
    .bs-event-chip,
    .bs-hotspot-widget__controls .btn {
        min-height: 2.75rem;
    }

    .bs-hotspot-widget .noUi-handle {
        width: 26px !important;
        height: 26px !important;
        right: -13px !important;
        top: -9px !important;
    }

    .bs-hotspot-widget__slider {
        height: 44px;
        margin-bottom: 1rem;
    }
}
