:root {
    --header-top-h: 120px;
    --nav-bar-h: 56px;
    --header-h: 178px; /* 120 (top) + 58 (info, nav inside) */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Header System --- */
header {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1100;
    background: #ffffff;
}

.header-top {
    min-height: var(--header-top-h);
    background: url("../images/banner-ukr-isr.webp") no-repeat center center;
    background-size: cover;
    position: relative;
    z-index: 20;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.header-top::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.6);
    pointer-events: none;
    z-index: 0;
}

.header-top-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 10;
    min-height: var(--header-top-h);
    padding-top: 10px;
    padding-bottom: 10px;
}

.header-top-inner .menu-toggle {
    display: none;
}

@media (max-width: 991px) {
    .header-top-inner .menu-toggle {
        display: flex;
    }
}

/* Права частина header-top: пошук + юзер */
.header-top-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* user-auth в info-bar — прихований (юзер завжди в header-top-right) */
.user-auth--desktop {
    display: none;
}

/* COMPACT HEADER — TODO later */

/* --- Logo System --- */
.logo-block {
    display: flex;
    align-items: center;
}

/* --- Info Bar (між header і меню) --- */
.header-info-bar {
    background: var(--bg-light, #f5f5f7);
    border-bottom: 1px solid rgba(0,0,0,0.06);
    display: none;
}

@media (min-width: 992px) {
    .header-info-bar {
        display: block;
    }
}

.header-info-bar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 58px;
    gap: 20px;
}
.header-left {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    min-width: 160px;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

/* --- Info Widget --- */
.header-info-widget {
    display: flex;
    align-items: center;
    gap: 20px;
    background: transparent;
    padding: 0;
    border: none;
    font-family: var(--font-ui);
}

.widget-time-block {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding-right: 16px;
    padding-top: 4px;
    padding-bottom: 4px;
    border-right: 1px solid rgba(0,0,0,0.12);
}

@media (max-width: 600px) {
    .widget-time-block { display: none; }
    .header-info-bar-inner { min-height: 40px; }
}

#current-time {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-blue);
    line-height: 1;
    letter-spacing: -0.5px;
}

#current-date {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.widget-meta-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.holiday-wrap {
    overflow: hidden;
    width: 100%;
    max-width: 320px;
}
.holiday-wrap:has(#current-holiday:empty) { display: none; }

#current-holiday {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    font-family: var(--font-ui, 'Inter', sans-serif);
    color: #005eb8;
    white-space: nowrap;
}
#current-holiday:empty { display: none; }

#current-holiday.h-scrolling {
    animation: h-scroll var(--h-dur, 10s) linear infinite;
}
@keyframes h-scroll {
    0%,  18% { transform: translateX(0); }
    82%, 100% { transform: translateX(var(--h-dist, -100px)); }
}

/* --- Weather Cities Widget --- */
.weather-cities {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
}

.w-city {
    display: flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

.w-city i {
    color: var(--accent-orange);
    font-size: 0.85rem;
}

.w-name {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.w-temp {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
}

.w-sep {
    color: rgba(0,0,0,0.2);
    font-size: 0.7rem;
    padding: 0 3px;
    user-select: none;
}

/* User's city highlighted slightly */
.w-city--user .w-name {
    color: var(--primary-blue, #1a73e8);
}

/* Mobile: hide city names to save space */
@media (max-width: 900px) {
    .w-name { display: none; }
}
@media (max-width: 600px) {
    .w-city--user { display: none; }
}
.logo-icon {
    background: url("../images/logo-final.webp") no-repeat center center;
    background-size: contain;
    margin-left: 0;
    /* width/height — адаптивні через clamp() в HEADER MOBILE PATCH */
}

/* --- Mobile Nav --- */
/* .menu-toggle — визначено у HEADER MOBILE PATCH в кінці файлу */

.header-nav-bar {
    height: var(--nav-bar-h);
    background: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
    border-top: 1px solid rgba(0,0,0,0.03);
    position: relative; 
    z-index: 10; /* Нижче ніж header-top */
}

.header-nav-bar .container {
    height: 100%;
    display: flex;
    justify-content: flex-start; /* Меню починається зліва під логотипом */
    align-items: center;
}

@media (max-width: 991px) {
    header { z-index: 11000; } /* Above backdrop (10000) so nav-menu inside (10005) beats it */
    .header-nav-bar { height: 0; border: none; box-shadow: none; display: block !important; overflow: visible !important; } /* Allow fixed child to show */
    .header-right { gap: 10px; }
    .widget-time-block { border-right: none; }
}

@media (min-width: 992px) {
    .menu-toggle { display: none; }
    .header-nav-bar { display: none; }
    .nav-list {
        display: flex;
        list-style: none;
        padding: 0;
        margin: 0;
        gap: 2rem;
        font-weight: 700;
        text-transform: uppercase;
        font-size: 0.82rem;
        letter-spacing: 0.5px;
    }
    .menu-item {
        position: relative;
        display: flex;
        align-items: center;
    }
    .menu-item a {
        display: flex;
        align-items: center;
        transition: 0.2s;
        white-space: nowrap;
    }
    .menu-item a:hover { color: var(--primary-blue); }

    /* Nav centered between left and right blocks */
    .nav-menu { margin-left: 0; }

    /* Desktop caret buttons */
    .dropdown-toggle {
        display: inline-flex;
        align-items: center;
        background: none;
        border: none;
        padding: 0;
        margin-left: 3px;
        cursor: pointer;
        color: inherit;
        width: 16px;
        height: 16px;
        transition: transform 0.25s ease, color 0.2s;
        flex-shrink: 0;
    }
    .dropdown-toggle svg {
        fill: currentColor;
        width: 100%;
        height: 100%;
    }
    /* Double chevron: right→down by rotating 90deg */
    .caret-down { transform: rotate(90deg); }
    .menu-item:hover > .caret-down { transform: rotate(270deg); color: var(--primary-blue); }
    /* Right chevron: already points right */
    .caret-right { transform: rotate(0deg); }
    .dropdown-menu .menu-item:hover > .caret-right { color: var(--primary-blue); }

    /* Dropdown logic */
    /* Dropdown Enhancements */
    .dropdown-menu {
        position: absolute;
        top: 100%;
        left: 0;
        min-width: 260px;
        background: white;
        border-radius: 16px;
        box-shadow: 0 10px 40px rgba(0,0,0,0.12);
        border: 1px solid rgba(0,0,0,0.05);
        padding: 10px 0;
        list-style: none;
        z-index: 1000;
        
        /* Плавна анімація */
        opacity: 0;
        visibility: hidden;
        transform: translateY(10px);
        transition: 0.3s var(--ease);
        margin-top: 10px;
    }

    .has-dropdown:hover > .dropdown-menu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .dropdown-menu li {
        position: relative; /* Для позиціонування вкладених меню */
        padding: 0;
    }

    .dropdown-menu li a {
        padding: 12px 25px;
        color: var(--text-dark);
        font-size: 14px;
        font-weight: 500;
        text-transform: none;
        display: flex;
        width: 100%;
        box-sizing: border-box;
        justify-content: space-between;
        align-items: center;
        transition: background 0.2s, color 0.2s;
    }

    .dropdown-menu li:hover {
        background: rgba(0, 94, 184, 0.07);
    }

    .dropdown-menu li:hover > a {
        background: transparent;
        color: var(--primary-blue);
    }

    .dropdown-menu .has-dropdown > a {
        padding-right: 40px;
    }

    .dropdown-menu li:hover > .caret-right {
        background: transparent;
        color: var(--primary-blue) !important;
    }
    .dropdown-menu li:hover > .caret-right svg {
        fill: var(--primary-blue) !important;
    }

    .dropdown-menu .caret-right {
        padding: 0 12px 0 0;
        width: auto;
        height: 100%;
        position: absolute;
        right: 0;
        top: 0;
        display: flex;
        align-items: center;
        background: transparent;
        border: none;
        outline: none;
        cursor: pointer;
        pointer-events: none;
        color: var(--text-dark);
        appearance: none;
        -webkit-appearance: none;
    }
    .dropdown-menu .caret-right:hover,
    .dropdown-menu .caret-right:focus,
    .dropdown-menu .caret-right:active {
        background: transparent !important;
        box-shadow: none !important;
        outline: none !important;
        color: var(--primary-blue) !important;
    }

    .dropdown-menu .caret-right svg {
        width: 14px;
        height: 14px;
    }

    .dropdown-menu li {
        position: relative;
    }

    /* 3-й рівень меню */
    .dropdown-menu .dropdown-menu {
        top: 0;
        left: 100%;
        margin-top: 0;
        margin-left: 10px;
    }

    .dropdown-menu::before {
        content: '';
        position: absolute;
        top: -10px;
        left: 0;
        width: 100%;
        height: 10px;
        background: transparent;
    }

    /* Invisible bridge for nested dropdown to avoid hover loss */
    .dropdown-menu .dropdown-menu::before {
        top: 0;
        left: -10px;
        width: 10px;
        height: 100%;
    }

    .dropdown-menu .menu-caret {
        transform: rotate(0deg);
    }
    
    .dropdown-menu .has-dropdown:hover > a .menu-caret {
        transform: rotate(-90deg);
    }
}

.header-widgets {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* --- Search Bar --- */
.header-search-bar {
    position: absolute;
    top: var(--header-h);
    left: 0;
    width: 100%;
    background: var(--bg-white);
    padding: 15px 0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transform: translateY(-20px);
    opacity: 0;
    visibility: hidden;
    transition: 0.3s var(--ease);
    z-index: 999;
}
.header-search-bar.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.h-search-form {
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
}
.h-search-form i { font-size: 1.5rem; color: var(--primary-blue); }
.h-search-form input {
    flex-grow: 1;
    border: none;
    background: none;
    font-size: 1.2rem;
    font-weight: 600;
    outline: none;
    font-family: var(--font-main);
}

.search-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: auto;
    padding-right: 40px;
}

.user-auth {
    position: relative;
    z-index: 1010;
    margin-top: 8px;
}

/* .menu-toggle display:none на десктопі — в HEADER MOBILE PATCH */

.search-dropdown-wrapper {
    position: relative;
}

/* Dropdown пошуку в header-top-right */
#search-dropdown {
    display: none;
    position: fixed;
    top: var(--header-h, 96px);
    left: 0;
    right: 0;
    width: 100%;
    background: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    padding: 12px 16px;
    z-index: 1200;
}

#search-dropdown.active {
    display: block;
}

@media (min-width: 992px) {
    #search-dropdown {
        position: absolute;
        top: calc(100% + 8px);
        left: auto;
        right: 0;
        width: min(320px, 90vw);
        border-radius: 12px;
    }
}

#search-dropdown .top-search-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

#search-dropdown .top-search-form i {
    color: var(--primary-blue);
    font-size: 1rem;
    flex-shrink: 0;
}

#search-dropdown .top-search-form input[type="text"] {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    background: none;
    color: var(--text-dark);
}

.search-toggle {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--text-main);
    transition: 0.2s;
    position: relative;
    z-index: 9999;
}
.search-toggle:hover { color: var(--primary-blue); }

/* FOOTER MODERN STYLES */
.footer-v2 {
    background: url("../images/header-bg.webp") no-repeat center;
    background-size: cover;
    border-top: 1px solid var(--border-color);
    padding: 32px 0 24px;
    margin-top: 32px;
    position: relative;
}

@media (min-width: 768px) {
    .footer-v2 { padding: 60px 0 40px; margin-top: 60px; }
}

.footer-v2::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    pointer-events: none;
}

.footer-v2 .container {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
}

@media (min-width: 768px) {
    .footer-v2 .container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        text-align: left;
        gap: 20px;
    }
}

.footer-v2 .logo-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

@media (min-width: 768px) {
    .footer-v2 .logo-block { align-items: flex-start; }
}

.footer-v2 .logo-block span {
    color: var(--text-dark);
    font-weight: 700;
}

.footer-copy {
    font-size: 0.8rem;
    opacity: 0.55;
    font-weight: 500;
    color: var(--text-dark);
}

.footer-nav a {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 600;
    transition: 0.3s;
}

.footer-nav a:hover {
    color: var(--primary-blue);
}

.footer-nav__sep {
    color: var(--text-muted);
    font-weight: 400;
    opacity: 0.5;
}

.social-links {
    display: flex;
    align-items: center;
    gap: 14px;
}

.social-links a {
    color: var(--primary-blue);
    font-size: 1.6rem;
    transition: transform 0.2s, opacity 0.2s;
    line-height: 1;
}

.social-links a:hover {
    opacity: 0.75;
    transform: scale(1.15);
}

.footer-bottom {
    display: block !important;
    width: 100%;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(0,0,0,0.05);
    text-align: center;
    font-size: 0.85rem;
    opacity: 0.6;
    font-weight: 600;
}

/* --- Speedbar (Breadcrumbs) --- */
.speedbar-nav {
    background: transparent;
    border-bottom: none;
    padding: 10px 0;
    margin-top: 0;
    margin-bottom: 15px;
    position: relative; /* Не липне до екрану */
    z-index: 10;
    box-shadow: none;
}

.speedbar-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.speedbar-inner a {
    color: var(--primary-blue);
    text-decoration: none;
    transition: 0.2s;
}

.speedbar-inner i {
    color: var(--primary-blue);
    font-size: 1rem;
    margin-right: 5px;
}

.speedbar-inner span {
    margin: 0 5px;
    opacity: 0.5;
    font-weight: 400;
}

/* =============================================
   DESKTOP NAV (replaces old .nav-menu on desktop)
   ============================================= */
.nav-desktop {
    display: none; /* hidden on mobile */
}
@media (min-width: 992px) {
    .nav-desktop {
        display: flex;
        align-items: center;
        flex: 1;
        justify-content: flex-start;
    }
}

/* =============================================
   MOBILE NAV — independent slide-in panel
   ============================================= */
.nav-mobile {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    max-width: 85vw;
    height: 100vh;
    background: #fff;
    z-index: 20005;
    transform: translateX(-105%);
    transition: transform 0.3s var(--ease);
    overflow-y: auto;
    box-shadow: 4px 0 30px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
}
.nav-mobile.active {
    transform: translateX(0);
}
@media (min-width: 992px) {
    .nav-mobile { display: none !important; }
}

/* Backdrop — raised above header on mobile */
@media (max-width: 991px) {
    .menu-backdrop {
        z-index: 20000; /* above header (11000) */
    }
}

.nav-mobile-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(0,0,0,0.07);
    min-height: 52px;
}
.nav-mobile-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: var(--text-muted);
    border-radius: 50%;
    display: flex;
    align-items: center;
    transition: background 0.2s, color 0.2s;
}
.nav-mobile-close:hover { background: #f0f4f8; color: var(--primary-blue); }
.nav-mobile-close svg { width: 22px; height: 22px; }

/* Mobile nav list */
.nav-mobile-list {
    list-style: none;
    padding: 8px 0;
    margin: 0;
    flex: 1;
}
.nm-item { border-bottom: 1px solid rgba(0,0,0,0.06); }

/* Each row: link + toggle button */
.nm-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nm-row > a {
    flex: 1;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    text-decoration: none;
    transition: color 0.2s;
}
.nm-row > a:hover, .nm-row > a:active { color: var(--primary-blue); }
/* Non-parent items (no toggle button) */
.nav-mobile-list > li:not(.nm-parent) > a,
.nm-sub > li:not(.nm-parent) > a {
    display: block;
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
    text-decoration: none;
    transition: color 0.2s;
}
.nm-sub > li:not(.nm-parent) > a { padding-left: 28px; color: var(--text-muted); }
.nm-sub .nm-sub > li > a { padding-left: 40px; }

/* Toggle button */
.nm-toggle {
    background: none;
    border: none;
    padding: 12px 16px;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: color 0.2s;
}
.nm-toggle svg { width: 18px; height: 18px; transition: transform 0.25s var(--ease); }
.nm-item.open > .nm-row > .nm-toggle { color: var(--primary-blue); }
.nm-item.open > .nm-row > .nm-toggle svg { transform: rotate(180deg); }

/* Submenu */
.nm-sub {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    background: #f7f9fc;
    transition: max-height 0.3s var(--ease);
}
.nm-item.open > .nm-sub { max-height: 600px; }
.nm-sub .nm-item { border-bottom: 1px solid rgba(0,0,0,0.05); border-top: none; }
.nm-sub .nm-sub { background: #eef2f8; }


/* ============================================================
   HEADER MOBILE PATCH — israel.in.ua
   Версія: 2026-05
   ============================================================ */

/* ── 1. LOGO — адаптивний розмір ───────────────────────────*/
.logo-icon {
    width: clamp(160px, 45vw, 280px);
    height: clamp(42px, 12vw, 74px);
    background-size: contain;
    background-position: left center;
    flex-shrink: 0;
}

@media (min-width: 600px) {
    .logo-icon {
        width: clamp(200px, 35vw, 300px);
        height: clamp(53px, 9vw, 80px);
    }
}

@media (min-width: 992px) {
    .logo-icon {
        width: 320px;
        height: 85px;
    }
}


/* ── 2. MENU-TOGGLE — один чистий стан ─────────────────────*/
.menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    max-height: 44px;
    padding: 0 8px;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--primary-blue);
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    transition: background var(--transition-fast, 150ms ease);
    -webkit-tap-highlight-color: transparent;
}

.menu-toggle:hover,
.menu-toggle:focus-visible {
    background: rgba(26, 54, 93, 0.08);
    outline: none;
}

@media (min-width: 992px) {
    .menu-toggle {
        display: none !important;
    }
}


/* ── 3. HEADER-RIGHT — прибираємо захардкожений padding ────*/
.header-right {
    padding-right: 0;
    gap: 12px;
}

@media (min-width: 992px) {
    .header-right {
        gap: 20px;
    }
}


/* ── 4. HEADER-TOP-INNER — мобільний layout ────────────────*/
@media (max-width: 991px) {
    .header-top-inner {
        justify-content: space-between;
        padding-top: 8px;
        padding-bottom: 8px;
        min-height: 64px;
        gap: 8px;
    }

    .header-top {
        min-height: 64px;
    }
}

@media (max-width: 599px) {
    .header-top-inner {
        min-height: 56px;
    }
    .header-top {
        min-height: 56px;
    }
}


/* ── 5. --header-h — динамічне значення на мобільному ──────*/
@media (max-width: 599px) {
    :root {
        --header-top-h: 56px;
        --header-h: 96px;
    }
}

@media (min-width: 600px) and (max-width: 991px) {
    :root {
        --header-top-h: 64px;
        --header-h: 104px;
    }
}


/* ── 6. HEADER-SEARCH-BAR — мобільний padding ──────────────*/
@media (max-width: 991px) {
    .header-search-bar {
        padding: 12px 16px;
    }

    .h-search-form input {
        font-size: 1rem;
    }
}


/* ── 7. HEADER INFO-BAR — compact на дуже малих екранах ────*/
@media (max-width: 479px) {
    .weather-cities {
        display: none;
    }

    .header-info-bar-inner {
        min-height: 36px;
        gap: 8px;
    }
}


/* ── 8. TOUCH TARGETS — мінімум 44×44px ────────────────────*/
.search-toggle,
.nav-mobile-close,
.nm-toggle {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}


/* ── 9. PILL-NAV — малі екрани ─────────────────────────────*/
@media (max-width: 399px) {
    .pill-nav {
        padding: 6px 8px 6px 16px;
        gap: 5px;
    }
    .pill-nav a {
        padding: 4px 10px;
        font-size: 0.72rem;
    }
}

/* ── END HEADER MOBILE PATCH ────────────────────────────── */
