/* Dashboard – Klíšťata ve městě – VŠB-TUO */

/* Barevná paleta */
:root {
    --vsb-primary: #003366;
    --vsb-secondary: #0052a3;
    --vsb-light: #4a90e2;
    --vsb-lighter: #7ab8f5;
    --vsb-success: #28a745;
    --vsb-warning: #ffc107;
    --vsb-info: #17a2b8;
    --font-main: 'Inter', 'Segoe UI', 'Helvetica', sans-serif;
}

/* Globální písmo */
.card-app,
.card-app * {
    font-family: var(--font-main);
}

/* Přepínač roku */
#year-selector .btn.active {
    background-color: var(--vsb-primary) !important;
    border-color: var(--vsb-primary) !important;
    color: white !important;
}

/* Karty */
.card-app {
    background: #ffffff;
    border-radius: 10px;
}

.card {
    animation: fadeIn 0.5s ease-in-out;
}

/* KPI karty */
#kpi-section .card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(0, 51, 102, 0.1);
}

#kpi-section .card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 51, 102, 0.2) !important;
}

#kpi-section .card-body h3,
#kpi-section .card-body h5 {
    color: var(--vsb-primary);
    font-weight: bold;
    font-size: clamp(0.875rem, 4vw, 2rem);
    overflow-wrap: break-word;
    word-break: break-word;
}

#kpi-section .card-body h5 {
    font-size: 1.25rem;
}

#kpi-section .text-primary {
    color: var(--vsb-primary) !important;
}

#kpi-section .text-success {
    color: var(--vsb-success) !important;
}

#kpi-section .text-warning {
    color: var(--vsb-warning) !important;
}

#kpi-section .text-info {
    color: var(--vsb-info) !important;
}

/* Filtry */
.form-select:focus,
.form-control:focus {
    border-color: var(--vsb-primary);
    box-shadow: 0 0 0 0.25rem rgba(0, 51, 102, 0.25);
}

.btn-primary {
    background-color: var(--vsb-primary);
    border-color: var(--vsb-primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--vsb-secondary);
    border-color: var(--vsb-secondary);
}

.btn-outline-primary {
    color: var(--vsb-primary);
    border-color: var(--vsb-primary);
}

.btn-outline-primary:hover,
.btn-outline-primary.active {
    background-color: var(--vsb-primary);
    border-color: var(--vsb-primary);
    color: white;
}

.btn-outline-secondary {
    color: #6c757d;
    border-color: #6c757d;
}

.btn-outline-secondary:hover {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
}

#filter-toggle {
    cursor: pointer;
    user-select: none;
}

.filter-chevron {
    transition: transform 0.3s ease;
    font-size: 0.9rem;
    color: #6c757d;
}

#active-filters-badge {
    font-size: 0.65rem;
    padding: 0.25em 0.5em;
    vertical-align: middle;
}

/* Flatpickr */
.flatpickr-calendar {
    box-shadow: 0 0.5rem 1rem rgba(0, 51, 102, 0.15);
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected.inRange,
.flatpickr-day.startRange.inRange,
.flatpickr-day.endRange.inRange,
.flatpickr-day.selected:focus,
.flatpickr-day.startRange:focus,
.flatpickr-day.endRange:focus,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover {
    background: var(--vsb-primary);
    border-color: var(--vsb-primary);
}

/* Grafy a nadpisy */
canvas {
    max-height: 400px;
    font-weight: 600 !important;
}

#location-chart {
    cursor: default;
}

.card-title {
    color: #333;
    font-weight: 600;
    border-bottom: 2px solid var(--vsb-primary);
    padding-bottom: 0.5rem;
}

.card-title i {
    color: var(--vsb-primary);
}

.map-popup strong {
    color: var(--vsb-primary);
}

/* Načítací overlay */
#dashboard-loading {
    z-index: 9999;
}

#dashboard-loading .spinner-border {
    color: var(--vsb-primary) !important;
}

/* Animace */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Clusterové značky */
.marker-cluster-small {
    background-color: rgba(0, 51, 102, 0.6);
}

.marker-cluster-small div {
    background-color: rgba(0, 51, 102, 0.8);
    color: white;
}

.marker-cluster-medium {
    background-color: rgba(0, 82, 163, 0.6);
}

.marker-cluster-medium div {
    background-color: rgba(0, 82, 163, 0.8);
    color: white;
}

.marker-cluster-large {
    background-color: rgba(74, 144, 226, 0.6);
}

.marker-cluster-large div {
    background-color: rgba(74, 144, 226, 0.8);
    color: white;
}

/* Tlačítka filtrů */
#apply-filters,
#reset-filters {
    transition: all 0.3s ease;
}

#apply-filters:active,
#reset-filters:active {
    transform: scale(0.95);
}

.btn-group .btn-check:checked+.btn-outline-primary {
    background-color: var(--vsb-primary);
    border-color: var(--vsb-primary);
}

/* Malé texty a ikony */
small.text-muted {
    font-size: 0.75rem;
    display: block;
    margin-top: 0.25rem;
}

.bi-bug {
    color: var(--vsb-primary);
}

.bi-geo-alt {
    color: var(--vsb-success);
}

.bi-calendar-week {
    color: var(--vsb-warning);
}

.bi-calendar-month {
    color: var(--vsb-info);
}

.form-select,
.form-control,
.btn {
    transition: all 0.2s ease-in-out;
}

.shadow-sm {
    box-shadow: 0 0.125rem 0.5rem rgba(0, 51, 102, 0.1) !important;
}

.shadow-sm:hover {
    box-shadow: 0 0.25rem 0.75rem rgba(0, 51, 102, 0.15) !important;
}

/* Mapa */
.map-title-control {
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    border: 2px solid var(--vsb-primary);
    margin: 10px;
}

.map-title {
    color: var(--vsb-primary);
    font-weight: 600;
    font-size: 1.1rem;
    margin: 0;
    text-align: center;
}

.leaflet-control-attribution {
    background: rgba(255, 255, 255, 0.9) !important;
    font-size: 0.75rem;
}

/* Legenda teplotní mapy */
.heatmap-legend {
    background: white;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    line-height: 18px;
    color: #555;
}

.heatmap-legend i {
    width: 18px;
    height: 18px;
    float: left;
    margin-right: 8px;
    opacity: 0.7;
}

.heatmap-legend span {
    display: block;
    margin-bottom: 5px;
}

/* Oprava konfliktu Bootstrap–Leaflet */
#dashboard-map.leaflet-container canvas {
    max-width: none !important;
    max-height: none !important;
}

/* Odstranění focus outline u SVG polygonů krajů */
#dashboard-map .leaflet-interactive:focus {
    outline: none;
}

#dashboard-map.leaflet-container img {
    max-width: none !important;
}

/* Responzivní styly – tablet */
@media (max-width: 992px) {
    .col-lg-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    #dashboard-map {
        height: 420px !important;
    }

    .card-body canvas {
        max-height: 320px;
    }
}

/* Responzivní styly – mobil */
@media (max-width: 768px) {
    .card-app {
        width: 98% !important;
        padding: 0.75rem !important;
    }

    .hero {
        padding: 80px 0 10px 0 !important;
    }

    .section-header h1 {
        font-size: 1.4rem;
        line-height: 1.3;
    }

    #kpi-section .col-lg-3,
    #kpi-section .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    #kpi-section .card-body {
        padding: 0.75rem;
    }

    #kpi-section .card-body h3 {
        font-size: clamp(0.875rem, 4vw, 1.3rem);
    }

    #kpi-section .card-body p {
        font-size: 0.75rem;
        color: #2c3e50;
    }

    #kpi-section .card-body small {
        font-size: 0.65rem;
    }

    #kpi-section .card-body i {
        font-size: 1.5rem !important;
    }

    .card-body .row.g-3>div {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .card-body .row.g-3 .col-lg-3 {
        margin-bottom: 0.5rem;
    }

    #dashboard-map {
        height: 350px !important;
    }

    .d-flex.justify-content-between.align-items-center.mb-3 {
        flex-direction: column;
        gap: 0.75rem;
    }

    .d-flex.justify-content-between .card-title {
        font-size: 1rem;
    }

    .card-body canvas {
        max-height: 280px;
    }

    .card-title {
        font-size: 0.95rem;
    }

    .card-title i {
        font-size: 0.9rem;
    }

    .row.g-4 {
        --bs-gutter-y: 0.75rem;
        --bs-gutter-x: 0.75rem;
    }

    .card-body {
        padding: 0.75rem;
    }

    .btn {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
    }

    .btn-group-sm .btn {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    /* Zmenšení zoom tlačítek mapy */
    .leaflet-control-zoom a {
        width: 30px !important;
        height: 30px !important;
        line-height: 30px !important;
        font-size: 14px !important;
    }

    /* Legenda teplotní mapy – skrývatelná */
    .heatmap-legend {
        font-size: 0.75rem;
        padding: 6px 8px;
    }

    .heatmap-legend strong {
        cursor: pointer;
    }
}

/* Responzivní styly – malý mobil */
@media (max-width: 576px) {
    .container.py-3 {
        padding-left: 0.25rem !important;
        padding-right: 0.25rem !important;
    }

    .section-header h1 {
        font-size: 1.2rem;
    }

    #kpi-section .card-body h3 {
        font-size: clamp(0.875rem, 4vw, 1.1rem);
    }

    #kpi-section .card-body p {
        font-size: 0.7rem;
    }

    #kpi-section .card-body i {
        font-size: 1.25rem !important;
    }

    #dashboard-map {
        height: 300px !important;
    }

    .card-body canvas {
        max-height: 250px;
    }

    .card-body {
        padding: 0.5rem;
    }

    .mb-4 {
        margin-bottom: 0.75rem !important;
    }

    .leaflet-popup-content {
        max-width: 200px !important;
        font-size: 0.85rem;
    }

    .leaflet-popup-content p {
        margin: 0.25rem 0;
    }
}

/* Extra malý mobil – 1 sloupec KPI */
@media (max-width: 380px) {

    #kpi-section .col-lg-3,
    #kpi-section .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    #kpi-section .card-body h3 {
        font-size: 0.875rem;
    }
}

/* Na šířku */
@media (max-width: 768px) and (orientation: landscape) {
    #dashboard-map {
        height: 250px !important;
    }

    .card-body canvas {
        max-height: 200px;
    }
}

/* Dotykové prvky */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
    }

    .form-control,
    .form-select {
        min-height: 44px;
        font-size: 16px;
    }

    .leaflet-control-zoom a {
        width: 36px !important;
        height: 36px !important;
        line-height: 36px !important;
        font-size: 18px !important;
    }
}