/* =========================================================
   ŘSD – doprava.css
   Lišta je vizuálně sladěná se skutečnou CHMÚ lištou.
   Rozbalený obsah mapy a detail události zůstává zachován.
   ========================================================= */

.traffic-test,
.traffic-panel {
    width: 100%;
    box-sizing: border-box;
    font-family: Arial, Helvetica, sans-serif;
}

/* ---------------------------------------------------------
   ŘSD lišta
   Stejné základní proporce jako CHMÚ:
   výška 36 px, stejné odsazení, typografie a zarovnání.
   --------------------------------------------------------- */

.traffic-bar {
    width: 100%;
    height: 36px;
    min-height: 36px;
    box-sizing: border-box;

    display: flex;
    align-items: center;
    gap: 0;

    margin: 6px 0 0;
    padding: 0 10px;

    border: 1px solid #cfd7df;
    border-radius: 4px;

    background: #eef7fb;
    color: #222;

    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    line-height: 36px;

    text-align: left;
    cursor: pointer;
}

.traffic-bar:hover {
    background: #e8f3f8;
}

/* ---------------------------------------------------------
   Zdroj – ikona + ŘSD
   --------------------------------------------------------- */

.traffic-bar__title {
    position: relative;
    z-index: 2;

    flex: 0 0 80px;
    width: 80px;
    box-sizing: border-box;

    display: inline-flex;
    align-items: center;

    height: 100%;
    padding: 0;

    gap: 7px;

    border-right: 1px solid #d7d7d7;

    font-size: 14px;
    font-weight: 700;
    line-height: 1;

    white-space: nowrap;
}

/* Původní text DOPRAVNÍ INFORMACE vizuálně nahradíme ŘSD. */
.traffic-bar__title > span:last-child {
    font-size: 0;
}

.traffic-bar__title > span:last-child::after {
    content: "ŘSD";
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}

/* Malá dopravní výstražná ikona – stejná vizuální váha
   jako 19×19 px ikona v CHMÚ liště. */
.traffic-bar__icon {
    flex: 0 0 auto;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 19px;
    min-width: 19px;
    height: 19px;

    box-sizing: border-box;

    font-size: 0;
    line-height: 1;

    position: relative;

    border: 1px solid #333;
    border-radius: 2px;

    background:
        repeating-linear-gradient(
            135deg,
            #ffd83d 0,
            #ffd83d 3px,
            #333 3px,
            #333 6px
        );

    box-shadow: 0 1px 1px rgba(0,0,0,.18);
}

.traffic-bar__icon::after {
    content: "";
    position: absolute;

    left: 3px;
    right: 3px;
    top: 4px;

    height: 1px;

    background: rgba(255,255,255,.7);
}

/* ---------------------------------------------------------
   Souhrn událostí
   --------------------------------------------------------- */

.traffic-bar__summary {
    flex: 1 1 auto;
    min-width: 0;

    display: inline-flex;
    align-items: center;
    flex-wrap: nowrap;

    margin-left: 8px;
    gap: 13px;

    color: #222;

    font-size: 14px;
    font-weight: 400;
    line-height: 36px;

    white-space: nowrap;
    overflow: hidden;
}

.traffic-bar__summary span {
    display: inline-block;
    flex: 0 0 auto;
}

/* ---------------------------------------------------------
   Pravá rozbalovací šipka
   --------------------------------------------------------- */

.traffic-bar__arrow {
    flex: 0 0 auto;

    position: relative;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 24px;
    min-width: 24px;
    height: 24px;

    margin-left: auto;

    border: 1px solid #b9cbd5;
    border-radius: 50%;

    background: #e7f1f6;
    color: #34444f;

    font-size: 0;
    line-height: 1;

    transition:
        transform .15s ease,
        background-color .15s ease,
        border-color .15s ease;
}

.traffic-bar__arrow::before {
    content: "";

    width: 6px;
    height: 6px;

    border-right: 1.8px solid #34444f;
    border-bottom: 1.8px solid #34444f;

    transform: rotate(45deg);
    margin-top: -3px;
}

.traffic-bar:hover .traffic-bar__arrow {
    background: #dcecf4;
    border-color: #aebfc9;
}

.traffic-bar[aria-expanded="true"] .traffic-bar__arrow {
    transform: rotate(180deg);
}

/* ---------------------------------------------------------
   Rozbalený obsah
   Desktop: mapa 60 % + detail 40 % vedle sebe.
   --------------------------------------------------------- */

.traffic-content {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 8px;

    padding: 8px 8px 10px;
    box-sizing: border-box;

    border: 1px solid #d7dee4;
    border-top: 0;
    border-radius: 0 0 5px 5px;

    background: #f7f9fa;
}

.traffic-map-wrap {
    width: 100%;
    min-width: 0;
}

.traffic-map {
    width: 100%;
    height: 390px;

    border-radius: 5px;
    overflow: hidden;
    background: #dceff5;
}

/* Leaflet ovládání */
.traffic-map .leaflet-control-zoom {
    margin-top: 8px;
    margin-left: 8px;
}

.traffic-map .leaflet-control-zoom a {
    width: 30px;
    height: 30px;
    line-height: 30px;
    font-size: 18px;
}

/* ---------------------------------------------------------
   Detail události vedle mapy
   --------------------------------------------------------- */

.traffic-detail {
    margin-top: 0;
    padding: 14px 14px 16px;

    min-height: 390px;
    max-height: 390px;
    box-sizing: border-box;

    overflow-y: auto;

    border-radius: 5px;
    background: #fff;

    color: #1e252b;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    line-height: 1.45;
}

.traffic-detail__placeholder {
    text-align: center;
    color: #697680;
    padding: 10px 4px;
}

.traffic-detail__title {
    margin: 0 0 5px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
}

.traffic-detail__meta {
    margin: 0 0 10px;
    color: #587080;
    font-size: 11px;
}

.traffic-detail__type {
    margin: 0 0 14px;
    font-size: 13px;
    font-weight: 700;
}

.traffic-detail__text {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
}

/* ---------------------------------------------------------
   Menší obrazovky
   --------------------------------------------------------- */

@media (max-width: 800px) {
    .traffic-bar {
        height: 34px;
        min-height: 34px;
        padding: 0 8px;
    }

    .traffic-bar__title {
        padding-right: 9px;
        gap: 5px;
        line-height: 34px;
    }

    .traffic-bar__summary {
        gap: 8px;
        font-size: 13px;
        line-height: 34px;
    }

    .traffic-map {
        height: 340px;
    }
}

@media (max-width: 800px) {
    .traffic-content {
        display: block;
    }

    .traffic-detail {
        margin-top: 8px;
        min-height: 72px;
        max-height: 300px;
    }
}

@media (max-width: 600px) {
    /*
     * Mobilní lišta:
     * necháme vždy viditelný název ŘSD, souhrn může zabrat
     * zbytek dostupné šířky a pravá šipka zůstane na místě.
     */
    .traffic-bar {
        padding: 0 6px;
        overflow: hidden;
    }

    .traffic-bar__title {
        flex: 0 0 83.5px;
        width: 83.5px;
        padding-right: 6px;
        gap: 4px;
        font-size: 13px;
        line-height: 1;
    }

    .traffic-bar__title > span:last-child::after {
        font-size: 13px;
        line-height: 1;
    }

    .traffic-bar__icon {
        width: 18px;
        min-width: 18px;
        height: 18px;
    }

    .traffic-bar__summary {
        min-width: 0;
        margin-left: 6px;
        gap: 7px;
        font-size: 12px;
        line-height: 34px;
        overflow: hidden;
        white-space: nowrap;
    }

    .traffic-bar__summary span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Na mobilu zobrazíme pouze celkový počet událostí. */
    .traffic-bar__summary span:not(:first-child) {
        display: none;
    }

    .traffic-bar__arrow {
        width: 24px;
        min-width: 24px;
        height: 24px;
        margin-left: 5px;
    }

    .traffic-map {
        height: 300px;
    }
}

.traffic-content[hidden] {
    display: none !important;
}
