/* ============================================
   ШАПКА И НАВИГАЦИЯ
   ============================================ */

/* === ШАПКА === */
.site-header {
    background: #ffffff;
    color: #1951A0;
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.header-container {
    width: 100%;
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

/* === КОЛОНКА 1: Логотип + Название (СЛЕВА) === */
.header-left {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.logo {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

.logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo-img {
    height: 70px;
    width: auto;
    display: block;
}

.site-title {
    flex: 0 0 auto;
    text-align: left;
    padding: 0 0 0 15px;
}

.title-link {
    text-decoration: none !important;
    color: inherit;
    display: inline-block;
    transition: color 0.3s ease;
    position: relative;
}

.title-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: #E4003A;
    transition: width 0.3s ease;
}

.title-link:hover {
    color: #E4003A;
}

.title-link:hover::after {
    width: 100%;
}

.title-text {
    font-size: 22px;
    font-weight: 700;
    font-family: 'Open Sans', 'Arial', 'Helvetica Neue', sans-serif;
    color: #1951A0;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* === КОЛОНКА 2: Меню (ПО ЦЕНТРУ) === */
.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.main-nav {
    display: flex;
    justify-content: center;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 45px;
    margin: 0;
    padding: 0;
}

.nav-menu a {
    color: #1951A0;
    text-decoration: none;
    font-size: 20px;
    font-weight: normal;
    font-family: 'Open Sans', 'Arial', 'Helvetica Neue', sans-serif;
    transition: color 0.3s, border-bottom 0.3s;
    padding: 5px 0;
    border-bottom: 2px solid transparent;
}

.nav-menu a:hover {
    color: #E4003A;
    border-bottom-color: #E4003A;
}

/* ============================================
   ВЫПАДАЮЩЕЕ МЕНЮ (ПО КЛИКУ)
   ============================================ */

.menu-item-has-children {
    position: relative;
    cursor: pointer;
}

.menu-item-has-children .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    min-width: 200px;
    padding: 10px 0;
    border-radius: 7px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    z-index: 999;
    list-style: none;
    border-top: 3px solid #E4003A;
}

.menu-item-has-children .sub-menu li {
    display: block;
    width: 100%;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
}

.menu-item-has-children .sub-menu li:last-child {
    border-bottom: none;
}

.menu-item-has-children .sub-menu a {
    display: block;
    padding: 10px 20px;
    color: #1951A0;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.3s, color 0.3s;
    border-bottom: none !important;
}

.menu-item-has-children .sub-menu a:hover {
    background: #f8f9fa;
    color: #E4003A;
}

.menu-item-has-children.open .sub-menu {
    display: block;
}

.menu-item-has-children > a::after {
    content: ' ▾';
    font-size: 12px;
    transition: transform 0.3s;
    display: inline-block;
}

.menu-item-has-children.open > a::after {
    transform: rotate(180deg);
}

/* ============================================
   ДЛЯ ТЕЛЕФОНОВ (подменю)
   ============================================ */
@media (max-width: 768px) {
    .menu-item-has-children .sub-menu {
        position: static;
        transform: none;
        background: rgba(255,255,255,0.05);
        box-shadow: none;
        border-top: none;
        min-width: auto;
        padding: 5px 0 5px 15px;
        margin: 0;
        border-radius: 0;
        border-left: 2px solid rgba(255,255,255,0.12);
    }

    .menu-item-has-children .sub-menu li {
        border-bottom: 1px solid rgba(255,255,255,0.06);
    }

    .menu-item-has-children .sub-menu li:last-child {
        border-bottom: none;
    }

    .menu-item-has-children .sub-menu li a {
        color: #d0d0d0;
        padding: 10px 20px 10px 30px;
        font-size: 14px;
        font-weight: 400;
        text-decoration: none;
        display: block;
        transition: background 0.3s, color 0.3s;
        position: relative;
    }

    .menu-item-has-children .sub-menu li a::before {
        content: '▸ ';
        color: #E4003A;
        font-size: 14px;
        font-weight: 700;
        position: absolute;
        left: 8px;
        top: 50%;
        transform: translateY(-50%);
    }

    .menu-item-has-children .sub-menu li a:hover {
        background: rgba(255,255,255,0.05);
        color: #ffffff;
    }

    .menu-item-has-children .sub-menu li a:hover::before {
        color: #ff3333;
    }
}

/* === КОЛОНКА 3: Контакты (СПРАВА) === */
.header-right {
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-end;
}

.header-contacts {
    text-align: right;
}

.header-contacts .phone {
    color: #1951A0;
    text-decoration: none;
    font-size: 18px;
    font-weight: 700;
    font-family: 'Open Sans', 'Arial', 'Helvetica Neue', sans-serif;
    display: block;
    transition: color 0.3s;
}

.header-contacts .phone:hover {
    color: #E4003A;
}

.header-contacts .address {
    color: #555555;
    font-size: 13px;
    font-family: 'Open Sans', 'Arial', 'Helvetica Neue', sans-serif;
    display: block;
    margin-top: 2px;
}

/* === БУРГЕР-КНОПКА === */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    margin-left: auto;
}

.menu-toggle span {
    display: block;
    width: 28px;
    height: 3px;
    background: #1951A0;
    border-radius: 3px;
    transition: all 0.3s;
}

/* === КРЕСТИК (скрыт по умолчанию) === */
.menu-close {
    display: none;
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 10000;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    flex-direction: column;
    gap: 5px;
}

.menu-close span {
    display: block;
    width: 30px;
    height: 3px;
    background: #1951A0;
    border-radius: 3px;
}

.menu-close span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-close span:nth-child(2) {
    opacity: 0;
}

.menu-close span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

.menu-close.active {
    display: flex !important;
}

.menu-toggle.hidden {
    display: none !important;
}

/* === ПЛАНШЕТЫ (768px - 1024px) === */
@media (max-width: 1024px) {
    .header-container {
        padding: 0 20px;
    }
    
    .title-text {
        font-size: 17px;
    }
    
    .logo-img {
        height: 50px;
    }
    
    .site-title {
        padding: 0 0 0 10px;
    }
    
    .nav-menu {
        gap: 25px;
    }
    
    .nav-menu a {
        font-size: 16px;
    }
    
    .header-contacts .phone {
        font-size: 16px;
    }
    
    .header-contacts .address {
        font-size: 12px;
    }
}

/* === ТЕЛЕФОНЫ (до 768px) === */
@media (max-width: 768px) {
    .site-header {
        padding: 10px 0;
        background: #ffffff;
    }

    .header-container {
        padding: 0 15px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: nowrap;
    }

    .header-left {
        flex: 0 0 auto;
        order: 1;
        display: flex;
        align-items: center;
    }
    
    .logo-img {
        height: 48px;
        width: auto;
    }

    .site-title {
        flex: 1;
        text-align: center;
        order: 2;
        padding: 0 8px;
    }
    
    .title-text {
        font-size: 17px;
        font-weight: 700;
        white-space: normal;
        color: #1951A0;
        display: block;
        line-height: 1.3;
    }

    .menu-toggle {
        display: flex;
        order: 3;
        flex: 0 0 auto;
        margin-left: 0;
        padding: 5px;
        gap: 4px;
        background: none;
        border: none;
        cursor: pointer;
    }

    .menu-toggle span {
        display: block;
        width: 26px;
        height: 3px;
        background: #1951A0;
        border-radius: 3px;
        transition: all 0.3s;
    }

    .header-right {
        display: none;
    }

    .header-center {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: #ffffff;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        z-index: 9999;
        padding: 80px 20px 40px;
        overflow-y: auto;
    }

    .header-center.active {
        display: flex !important;
    }

    .header-center .logo {
        display: block;
        margin-bottom: 15px;
    }

    .header-center .logo-img {
        display: block;
        height: 129px;
        width: 128px;
        margin: 0 auto;
    }

    .header-center .site-title {
        display: block;
        text-align: center;
        padding: 0;
        margin-bottom: 30px;
        flex: none;
        width: 100%;
    }

    .header-center .title-text {
        font-size: 20px;
        font-weight: 700;
        white-space: normal;
        color: #1951A0;
        display: block;
    }

    .header-center .main-nav {
        display: block;
        width: 100%;
        max-width: 300px;
    }

    .header-center .nav-menu {
        flex-direction: column;
        gap: 0;
        align-items: center;
        width: 100%;
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .header-center .nav-menu li {
        width: 100%;
        text-align: center;
        border-bottom: 1px solid rgba(25, 81, 160, 0.1);
    }

    .header-center .nav-menu li a {
        display: block;
        padding: 16px 0;
        font-size: 20px;
        font-weight: 500;
        color: #1951A0;
        border-bottom: none;
        text-decoration: none;
        transition: background 0.3s, color 0.3s;
    }

    .header-center .nav-menu li a:hover {
        background: rgba(228, 0, 58, 0.05);
        color: #E4003A;
    }

    .header-center .nav-menu li:last-child {
        border-bottom: none;
    }

    .menu-close span {
        background: #1951A0;
    }
}

/* === МАЛЕНЬКИЕ ТЕЛЕФОНЫ (до 480px) === */
@media (max-width: 480px) {
    .logo-img {
        height: 40px;
    }
    
    .title-text {
        font-size: 15px;
        font-weight: 700;
    }
    
    .menu-toggle span {
        width: 24px;
        height: 2.5px;
    }

    .header-center .nav-menu li a {
        font-size: 18px;
        padding: 14px 0;
    }

    .header-center .title-text {
        font-size: 18px;
    }
}