/**
 * Niktel Realty — single nemovitost detail rows + filter popups + loop card layout fixy.
 *
 * Layout fix v2 (2026-04-26):
 *   1. Detail rows ve fialovém sloupci (.radky-bg): gap mezi label/value, word-wrap dlouhých hodnot
 *   2. Filter popups (1130/1444/1456/1459/1467/1470): max-height + scroll, sticky VYHLEDAT button
 *   3. Loop card lokalita: truncate dlouhého textu na 1 řádek (ellipsis)
 */

/* ==========================================================================
   1) Detail rows — fialový sloupec na single nemovitost
   ========================================================================== */

/* Container 'radky-bg' obsahuje 30+ row containerů, každý se 2 widgety
   (label heading + value heading/shortcode). Defaultní flex justify-content: space-between
   tlačí widgety na okraje bez gap → label a value se lepí dohromady, dlouhé hodnoty
   přetékají. Přidáváme gap a controlled flex-basis. */

.radky-bg > .e-con.e-child {
    column-gap: 24px;
    align-items: start;
    flex-wrap: nowrap;
}

/* Label widget — vždy min-content (label se nikdy nezalamuje vertikálně),
   max 50% aby zbylo místo pro value */
.radky-bg > .e-con.e-child > .elementor-widget-heading:first-child {
    flex: 0 1 auto;
    min-width: max-content;
    max-width: 50%;
    word-break: normal;
    overflow-wrap: normal;
    white-space: normal;
}

/* Pokud má label víc slov (např. "Energetika — detail" 2 slova),
   povolit zalamování mezi slovy ale ne uvnitř slova */
.radky-bg > .e-con.e-child > .elementor-widget-heading:first-child p {
    word-break: normal;
    overflow-wrap: normal;
    hyphens: none;
}

/* Value widget — zabere zbylý prostor, dlouhé hodnoty se zalamují */
.radky-bg > .e-con.e-child > .elementor-widget-heading:not(:first-child),
.radky-bg > .e-con.e-child > .elementor-widget-shortcode {
    flex: 1 1 0;
    min-width: 0;
    word-break: normal;
    overflow-wrap: anywhere;
}

/* Layout fix v3 (2026-05-01) — konzistentní text-align: right na desktopu.
   Před fixem: 7 řádků (rows 9-15: Příslušenství..Orientace) mělo per-widget Elementor
   align=right (desktop) + align_mobile=left override; ostatních 34 řádků default left.
   Důsledek: fialový sloupec nekonzistentní (Topení/Parkování vpravo, Dispozice/Stav/Sklep
   vlevo). Klient si zvolil A) Hodnoty vpravo (real-estate look). Tří úrovní selektorů
   přebijí Elementor frontend.css default specificitu (.elementor-widget-heading
   .elementor-heading-title) a libovolný HTML uvnitř shortcode widget containeru. */
@media (min-width: 768px) {
    .radky-bg > .e-con.e-child > .elementor-widget-heading:not(:first-child),
    .radky-bg > .e-con.e-child > .elementor-widget-heading:not(:first-child) .elementor-widget-container,
    .radky-bg > .e-con.e-child > .elementor-widget-heading:not(:first-child) .elementor-heading-title,
    .radky-bg > .e-con.e-child > .elementor-widget-shortcode,
    .radky-bg > .e-con.e-child > .elementor-widget-shortcode .elementor-widget-container,
    .radky-bg > .e-con.e-child > .elementor-widget-shortcode > .elementor-widget-container > * {
        text-align: right;
    }
}

/* Mobile — vertikální stack pro úzké viewporty (Energetika—detail, Zabezpečení s prvky) */
@media (max-width: 767px) {
    .radky-bg > .e-con.e-child {
        flex-direction: column;
        gap: 4px;
    }
    .radky-bg > .e-con.e-child > .elementor-widget-heading,
    .radky-bg > .e-con.e-child > .elementor-widget-shortcode {
        flex: 1 1 100%;
        text-align: left;
    }
}

/* ==========================================================================
   2) Filter popups — max-height + scrollable + sticky submit button
   ========================================================================== */

/* Popups 1130 (Byty), 1444 (Domy), 1456 (Pozemky), 1459 (Komerční),
   1467 (Rekreační), 1470 (Ostatní) mají v _elementor_data 'width:640px;height:auto'.
   Když je formulář delší než viewport, VYHLEDAT button je pod fold.
   Fix: omezit max-height popupu, content scroll, button sticky bottom. */

#elementor-popup-modal-1130 .dialog-message,
#elementor-popup-modal-1444 .dialog-message,
#elementor-popup-modal-1456 .dialog-message,
#elementor-popup-modal-1459 .dialog-message,
#elementor-popup-modal-1467 .dialog-message,
#elementor-popup-modal-1470 .dialog-message {
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: stable;
}

/* Sticky VYHLEDAT button — drží na dně popup viewport i při scrollu
   (Elementor Pro form button class: .elementor-button) */
.elementor-popup-modal .elementor-form .elementor-field-type-submit,
.elementor-popup-modal .elementor-form .elementor-button[type="submit"] {
    position: sticky;
    bottom: 0;
    background: inherit;
    z-index: 10;
    padding-top: 8px;
}

/* Mobile — max-height menší (kvůli mobile toolbarům), sticky button vypnut
   protože může způsobit "stick to page bottom" bug (#29849) */
@media (max-width: 767px) {
    #elementor-popup-modal-1130 .dialog-message,
    #elementor-popup-modal-1444 .dialog-message,
    #elementor-popup-modal-1456 .dialog-message,
    #elementor-popup-modal-1459 .dialog-message,
    #elementor-popup-modal-1467 .dialog-message,
    #elementor-popup-modal-1470 .dialog-message {
        max-height: calc(100vh - 40px);
    }
    .elementor-popup-modal .elementor-form .elementor-field-type-submit,
    .elementor-popup-modal .elementor-form .elementor-button[type="submit"] {
        position: static;
    }
}

/* ==========================================================================
   3) Loop card lokalita — truncate dlouhého textu na 1 řádek
   ========================================================================== */

/* Template 415 (dlaždice) má icon-list widget s lokalitou (např. "Hlavní, Mělník,
   „Pod Lesem"") která se zalamuje na 3 řádky → karty mají nestejnou výšku.
   Fix: každá item má pevný 1 řádek + ellipsis. */

/* Allow grid items to shrink below content size — bez tohoto se max-width: 100% nedrží */
.elementor-loop-container .elementor-icon-list-items {
    grid-auto-rows: minmax(min-content, max-content);
}

.elementor-loop-container .elementor-icon-list-items > .elementor-icon-list-item {
    min-width: 0;
    overflow: hidden;
}

/* Item link/span musí mít flex layout aby ikona neutekla a text se ořezal */
.elementor-loop-container .elementor-icon-list-item > a,
.elementor-loop-container .elementor-icon-list-item > span {
    display: flex;
    align-items: center;
    min-width: 0;
    width: 100%;
    overflow: hidden;
}

.elementor-loop-container .elementor-icon-list-item .elementor-icon-list-icon {
    flex-shrink: 0;
}

.elementor-loop-container .elementor-icon-list-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1 1 auto;
    display: block;
}
