/* ====== Хедер v3 — светлый стиль ====== */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap');
@import url('/css/strela-brand-font.css');

.custom-header,
.dropdown-menu,
.dropdown-menu .nav-menu,
.dropdown-menu .nav-menu a,
.menu-button,
.menu-controls-row {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}

.custom-header {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 56px;
    background: rgba(13, 21, 32, 0.96);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 14px;
    z-index: 2000;
    transition: background 0.3s ease;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    box-sizing: border-box;
    isolation: auto !important;
}

.custom-header * { box-sizing: border-box; margin: 0; padding: 0; }

.custom-header.scrolled {
    background: rgba(13, 21, 32, 0.99);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* ====== Бренд-блок ====== */
.hdr-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}

.hdr-logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #e8a920;
    flex-shrink: 0;
    /* без фона и бордера — чистый логотип */
}

.hdr-logo-icon svg {
    width: 38px;
    height: auto;
    display: block;
    /* SVG масштабируется векторно, качество не теряется */
}

/* Две фигуры лого: в тёмной теме — светлый бежево-серый #e6e6e6 */
.hdr-logo-icon .hdr-logo-part--upper,
.hdr-logo-icon .hdr-logo-part--lower {
    fill: #e6e6e6;
}

[data-theme="light"] .hdr-logo-icon .hdr-logo-part--upper {
    fill: #000000;
}

[data-theme="light"] .hdr-logo-icon .hdr-logo-part--lower {
    fill: #2c3e50;
}

.hdr-brand-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.hdr-brand-name {
    font-size: 14px;
    color: #f8fafc;
    letter-spacing: 0.06em;
    line-height: 1.05;
    text-transform: uppercase;
}

/* Подзаголовок: по умолчанию "ЭКОСИСТЕМА СПЕЦТЕХНИКИ".
   На конкретной странице можно переопределить JS-ом:
   document.querySelector('.hdr-page-subtitle').textContent = 'СИСТЕМА ДОВЕРИЯ'; */
.hdr-page-subtitle {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 9px;
    font-weight: 500;
    color: #4d5e7a;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    line-height: 1.15;
    margin-top: 1px;
}

/* ====== Кнопки действий ====== */
.header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.header-action-btn {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #8292b0;
    transition: background 0.18s, color 0.18s;
    cursor: pointer;
    font-size: 15px;
    -webkit-tap-highlight-color: transparent;
}

.header-action-btn svg {
    width: 20px; height: 20px;
    min-width: 20px; min-height: 20px;
    fill: currentColor;
    display: block;
}

.header-action-btn svg path,
.header-action-btn svg g,
.header-action-btn svg circle,
.header-action-btn svg rect { fill: currentColor; }

.header-action-btn:hover { background: rgba(255,255,255,0.1); color: #f0f4ff; }
.header-action-btn.active-page { background: rgba(255,255,255,0.09); color: #f0f4ff; }

/* Роль-кнопка */
.header-role-btn {
    background: rgba(232, 169, 32, 0.08);
    border: 1px solid rgba(232, 169, 32, 0.18) !important;
    color: #e8a920;
}
.header-role-btn:hover { background: rgba(232,169,32,0.14); color: #e8a920; }
.header-role-btn.active-page { background: rgba(232,169,32,0.15); border-color: rgba(232,169,32,0.35) !important; color: #e8a920; }

.ha-role-icon { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; color: inherit; }
.ha-role-icon svg {
    width: 20px;
    height: 20px;
    /* override hardcoded attributes in SVG files */
    min-width: 20px;
    min-height: 20px;
    fill: currentColor !important;
    color: inherit;
    display: block;
}
.ha-role-icon svg *,
.ha-role-icon svg path,
.ha-role-icon svg g,
.ha-role-icon svg circle,
.ha-role-icon svg rect,
.ha-role-icon svg polygon,
.ha-role-icon svg polyline,
.ha-role-icon svg line,
.ha-role-icon svg ellipse,
.ha-role-icon svg use { fill: currentColor !important; }

/* Бейдж */
.ha-badge {
    position: absolute;
    top: -3px; right: -3px;
    min-width: 16px; height: 16px;
    padding: 0 4px;
    background: #ef4444;
    color: #fff;
    font-size: 9px; font-weight: 700;
    border-radius: 99px;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid rgba(13,21,32,0.9);
    line-height: 1;
}

/* ====== Бургер ====== */
.menu-button {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    color: #8292b0;
    cursor: pointer; z-index: 2001;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    transition: background 0.18s, color 0.18s;
    mix-blend-mode: normal; filter: none;
    -webkit-tap-highlight-color: transparent;
}
.menu-button svg { width: 20px; height: 20px; fill: currentColor; }
.menu-button svg path, .menu-button svg g { fill: currentColor; }
.menu-button:hover { background: rgba(255,255,255,0.1); color: #f0f4ff; }
.menu-button.is-dark { color: #2c3e50 !important; background: rgba(0,0,0,0.06) !important; }

/* ====== Старый логотип (совместимость) ====== */
.logo-svg-adaptive { display: block; height: 38px; width: auto; color: #f0f4ff; fill: currentColor; }
.logo-svg-adaptive path, .logo-svg-adaptive g { fill: currentColor !important; }
.logo-svg-adaptive.is-dark { color: #2c3e50 !important; }

/* ====== Dropdown ====== */
.dropdown-menu {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100vh;
    background: rgba(13, 21, 32, 0.99);
    display: flex; flex-direction: column;
    align-items: center; justify-content: flex-start;
    opacity: 0; visibility: hidden;
    transform: translateY(-100%);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1999;
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    padding-top: 80px; padding-bottom: 32px;
    overflow-y: auto;
}
.dropdown-menu.active { opacity: 1; visibility: visible; transform: translateY(0); }

.nav-menu { list-style: none; text-align: center; width: 100%; max-width: 360px; padding: 0 20px 80px; margin: 0; display: none; }
.nav-menu li { margin: 14px 0; }
.nav-menu li a { text-decoration: none; color: white; font-size: 24px; font-weight: 500; transition: color 0.3s ease; }
.nav-menu li a:hover { color: #e8a920; }

.close-button {
    position: absolute;
    top: max(12px, env(safe-area-inset-top, 0px));
    right: max(16px, env(safe-area-inset-right, 0px));
    z-index: 5;
    font-size: 0;
    color: #e8edf5; cursor: pointer;
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.08);
    transition: color 0.2s, background 0.2s, border-color 0.2s;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
}
.close-button i {
    font-size: 18px;
    line-height: 1;
    pointer-events: none;
}
.close-button:hover { color: #fff; background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.2); }
[data-theme="light"] .close-button {
    color: #92400e;
    background: #fff;
    border: 1px solid rgba(146, 64, 14, 0.22);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
}
[data-theme="light"] .close-button:hover {
    color: #7c2d12;
    background: #fffbeb;
    border-color: rgba(217, 119, 6, 0.35);
}

/* ====== Адаптивность ====== */
@media (max-width: 768px) {
    .custom-header { height: 52px; padding: 0 12px; }
    .hdr-brand-name { font-size: 13px; }
    .hdr-page-subtitle { font-size: 8px; }
    .dropdown-menu { padding-top: 60px; }
}

/* ====== Светлая тема ====== */
[data-theme="light"] .custom-header { background: rgba(255,255,255,0.96); border-bottom-color: rgba(0,0,0,0.08); }
[data-theme="light"] .hdr-brand-name { color: #0f172a; }
[data-theme="light"] .hdr-page-subtitle { color: #94a3b8; }
[data-theme="light"] .header-action-btn { background: rgba(0,0,0,0.05); color: #64748b; }
[data-theme="light"] .header-action-btn:hover { background: rgba(0,0,0,0.09); color: #1e293b; }
[data-theme="light"] .menu-button { background: rgba(0,0,0,0.05); color: #64748b; }
[data-theme="light"] .menu-button:hover { background: rgba(0,0,0,0.09); color: #1e293b; }
[data-theme="light"] .dropdown-menu { background: rgba(248,250,252,0.99); }
[data-theme="light"] .ha-badge { border-color: rgba(255,255,255,0.9); }

/* Вспомогательные */
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }
@media (min-width: 1025px) {
  .container {
    max-width: 40%;
  }
}
.admin-link { position: fixed; bottom: 10px; right: 10px; opacity: 0.35; font-size: 12px; z-index: 9999; }
.admin-link a { color: #999; text-decoration: none; }
button:focus, a:focus { outline: none !important; }
a, button, svg { -webkit-tap-highlight-color: transparent; }