/* ==========================================================================
   app-header.css — Универсальная шапка «Город Едет»
   Подключается автоматически через app_header.js на старых страницах,
   или вручную <link> на новых.
   ========================================================================== */

/* Убираем псевдо-логотип из style.css (тот что был через ::before) */
body > header::before,
header.has-own-logo::before {
    display: none !important;
    content: none !important;
}

/* === Шапка === */
body > header.app-header {
    padding: 0 !important;
    padding-top: env(safe-area-inset-top, 0px) !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-bottom: 0 !important;
    display: block !important;
    max-width: none !important;
    width: 100% !important;
    background: transparent !important;
    margin: 0 !important;
}

.app-header__inner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* === Логотип === */
.app-logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    text-decoration: none;
}
.app-logo__img {
    height: 36px;
    width: auto;
    max-width: 130px;
    object-fit: contain;
    display: block;
    mix-blend-mode: multiply;
}
.brand-lockup {
    display: block;
    position: relative;
    flex: none;
    width: var(--brand-width, clamp(118px, 24vw, 175px));
    aspect-ratio: 2152 / 731;
}
.brand-lockup > img,
[data-theme="dark"] .brand-lockup > img {
    display: block;
    width: 100%;
    height: auto;
    max-width: none;
    background: none;
    border-radius: 0;
    padding: 0;
    mix-blend-mode: normal;
}
[data-theme="dark"] .brand-lockup::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: #eef5ff;
    mask: url("/static/brand-lockup-v1.png") center / 100% 100% no-repeat;
    clip-path: inset(0 0 0 44%);
}
[data-theme="dark"] .app-logo__img {
    background: #FFFFFF;
    padding: 3px 6px;
    border-radius: 8px;
    mix-blend-mode: normal;
    box-sizing: content-box;
    height: 34px;
}

/* === Заголовок + подзаголовок === */
.app-header__titles {
    flex: 1;
    min-width: 0;
    text-align: center;
}

.app-header__title {
    font-size: 16px !important;
    font-weight: 700 !important;
    color: var(--ds-text, #0F172A) !important;
    margin: 0 !important;
    padding: 0 !important;
    letter-spacing: -0.01em;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-header__subtitle {
    font-size: 12px !important;
    color: var(--ds-text-soft, #475569) !important;
    margin: 2px 0 0 !important;
    padding: 0 !important;
    line-height: 1.3;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* === Кнопка темы — статичная, не перекрывает ничего === */
header.app-header .theme-toggle {
    position: static !important;
    flex-shrink: 0;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 18px !important;
    background: var(--ds-bg-soft, #F1F3F6) !important;
    border: 1.5px solid var(--ds-border, #E5E7EB) !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    transform: none !important;
    transition: all 150ms ease !important;
}
header.app-header .theme-toggle:hover {
    background: var(--ds-border, #E5E7EB) !important;
    transform: none !important;
}

/* === Правая группа (город + тема) === */
.app-header__actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* === Пилюля выбора города === */
.app-city-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: var(--ds-bg-soft, #F1F3F6);
    border: 1.5px solid var(--ds-border, #E5E7EB);
    border-radius: 999px;
    color: var(--ds-text, #0F172A);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    min-height: 40px;
    max-width: 140px;
    transition: all 150ms ease;
}
.app-city-btn:hover { border-color: var(--ds-border-strong, #CBD5E1); }
.app-city-btn__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.app-city-btn svg { width: 14px; height: 14px; flex-shrink: 0; }

/* === Мобилка === */
@media (max-width: 420px) {
    .app-header__inner { padding: 8px 10px; gap: 6px; }
    .app-logo__img { height: 28px; max-width: 90px; }
    [data-theme="dark"] .app-logo__img { height: 26px; }
    .app-header__title { font-size: 14px !important; }
    .app-header__subtitle { font-size: 10px !important; }
    header.app-header .theme-toggle {
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
        font-size: 15px !important;
    }
    .app-city-btn {
        max-width: 90px;
        padding: 5px 8px;
        font-size: 11px;
        min-height: 34px;
        gap: 2px;
    }
    .app-city-btn svg { width: 11px; height: 11px; }
    .app-city-btn__name {
        max-width: 60px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* Совсем маленькие экраны (iPhone SE и др.) */
@media (max-width: 360px) {
    .app-header__inner { padding: 6px 8px; gap: 4px; }
    .app-logo__img { height: 24px; max-width: 70px; }
    [data-theme="dark"] .app-logo__img { height: 22px; padding: 2px 4px; }
    .app-header__title { font-size: 13px !important; }
    .app-header__subtitle { display: none !important; }
    header.app-header .theme-toggle {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        font-size: 14px !important;
    }
    .app-city-btn {
        max-width: 75px;
        padding: 4px 6px;
        font-size: 10px;
        min-height: 32px;
    }
    .app-city-btn__name { max-width: 45px; }
}
