@font-face {
    font-family: "Montserrat";
    src: url("/fonts/Montserrat-Regular.ttf") format("truetype");
    font-weight: 400;
}

@font-face {
    font-family: "Montserrat";
    src: url("/fonts/Montserrat-Bold.ttf") format("truetype");
    font-weight: 700;
}

:root {
    --bg: #ffffff;
    --card: #ffffff;
    --border: #e5e7eb;
    --text: #111827;
    --muted: #6b7280;
    --primary: #2f4d85;
    --primary-2: #4a7db5;
    --primary-3: #315083;
    --btn-bg: #2f4d85;
    --btn-text: #f5fbfc;
    --btn-hover: #1f3a66;
    --link: #2f4d85;
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;
    --focus: rgba(47, 77, 133, 0.35);
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    font-family: "Inter", sans-serif;
    font-size: 1rem;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

h1,
h2,
h3,
h4 {
    font-family: "Montserrat", sans-serif;
}

ul,
ol {
    list-style: none;
}

a {
    color: #f5fbfc;
    text-decoration: none;
}

header {
    width: 100%;
    background-color: var(--primary);
}

.container {
    max-width: 1440px;
    width: 100%;
    height: 100%;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}


/* ===== Строка 1: лого + контакты ===== */

.header-main {
    background: #fff;
    width: 100%;
}

.header-main-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80px;
}

.logo img {
    height: 48px;
    width: auto;
    display: block;
}

.header-contacts {
    display: flex;
    align-items: center;
    gap: 24px;
}

.header-contact-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 0.9rem;
    text-decoration: none;
    transition: color 0.2s;
}

.header-contact-item:nth-child(even) {
    font-size: 0.95rem;
    font-weight: bold;
    color: #000;
}

.header-contact-item:hover {
    color: var(--primary-2);
}

.header-contact-item svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}


/* ===== Мобильные контакты (видны только на телефонах) ===== */

.mobile-contacts {
    display: none;
    background: #fff;
    padding: 6px 20px 10px;
    gap: 16px;
    align-items: center;
    justify-content: flex-start;
}

.mobile-contacts a {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--muted);
    font-size: 0.75rem;
    text-decoration: none;
    transition: color 0.2s;
}

.mobile-contacts a:hover {
    color: var(--primary-2);
}

.mobile-contacts a svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.mobile-contacts .mobile-phone {
    font-weight: 600;
    color: #000;
}

.mobile-contacts .mobile-phone:hover {
    color: var(--primary-2);
}


/* ===== Строка 2: каталог + поиск + вход ===== */

.header-nav {
    background: #fff;
    width: 100%;
}

.nav-container {
    display: flex;
    align-items: center;
    height: 64px;
    gap: 16px;
}

.catalog-menu-wrap {
    position: relative;
}

.catalog-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--primary-3);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    transition: background 0.2s;
    white-space: nowrap;
    text-decoration: none;
}

.catalog-btn:hover {
    background: #1f3a66;
}

.catalog-btn svg {
    width: 18px;
    height: 18px;
}

.catalog-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    min-width: 260px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 200;
    animation: modalFadeIn 0.15s ease;
}

.catalog-dropdown.active {
    display: flex;
    flex-direction: column;
}

.catalog-dropdown-item {
    padding: 11px 16px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s, color 0.15s;
}

.catalog-dropdown-item:last-child {
    border-bottom: none;
}

.catalog-dropdown-item:hover {
    background: var(--bg);
    color: var(--primary-2);
}


/* Подкатегории */

.catalog-dropdown-wrap {
    position: relative;
}

.catalog-dropdown-wrap .catalog-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.arrow-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: var(--muted);
}

.catalog-subdropdown {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    min-width: 220px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 300;
}

.catalog-dropdown-wrap.has-sub:hover .catalog-subdropdown {
    display: flex;
    flex-direction: column;
}


/* ===== Поиск ===== */

.search-wrap {
    flex: 1;
}

.search-form {
    display: flex;
    align-items: center;
    background: #f5f6f8;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.search-form:focus-within {
    border-color: var(--primary-2);
    background: #fff;
    box-shadow: 0px 0px 3px 3px #d7d7d7b2;
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 12px 14px;
    color: #828282;
    font-size: 1rem;
    font-family: inherit;
}

.search-input::placeholder {
    color: var(--muted);
}

.search-btn {
    background: transparent;
    border: none;
    padding: 12px;
    cursor: pointer;
    color: var(--muted);
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.search-btn:hover {
    color: var(--primary-2);
}

.search-btn svg {
    width: 18px;
    height: 18px;
}


/* ===== Авторизация ===== */

.auth-area {
    display: flex;
}

.auth-btn {
    background: var(--primary-2);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.auth-btn:hover {
    background: #187883;
    transform: scale(1.05);
}

.user-icon-img {
    width: 24px;
    height: 24px;
    display: block;
}

.user-menu {
    position: relative;
}

.user-avatar-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-2);
    color: white;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar-btn:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 8px;
    min-width: 160px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 100;
    animation: modalFadeIn 0.15s ease;
}

.user-dropdown.active {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-dropdown-name {
    padding: 8px 12px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}

.user-dropdown-item {
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text);
    text-decoration: none;
    transition: background 0.15s;
}

.user-dropdown-item:hover {
    background: var(--bg);
}

.user-dropdown-logout {
    color: var(--danger);
}

.user-dropdown-logout:hover {
    background: rgba(220, 38, 38, 0.08);
}


/* ===== Inline редактирование ===== */

.editable {
    display: inline-block;
    outline: none;
    border-radius: 0;
    transition: border-bottom 0.2s;
    cursor: text;
    border-bottom: 1px dashed transparent;
    padding: 0 2px;
}

.editable:hover {
    border-bottom: 1px dashed var(--primary-2);
    background: none;
}

.editable:focus {
    border-bottom: 1px solid var(--primary-2);
    background: none;
    box-shadow: none;
}


/* ===== Хотбар (мобильная навигация внизу) ===== */

.mobile-hotbar {
    display: none;
}

@media (max-width: 768px) {
    .header-contacts {
        display: none;
    }
    .mobile-contacts {
        display: flex !important;
    }
    .header-main-container {
        height: 60px;
    }
    .logo img {
        height: 36px;
    }
    .nav-container {
        flex-wrap: wrap;
        height: auto;
        padding: 8px 20px;
        gap: 8px;
    }
    .search-wrap {
        order: -1;
        width: 100%;
        flex: none;
    }
    .catalog-btn {
        flex: 1;
        justify-content: center;
        font-size: 0.85rem;
        padding: 8px 12px;
    }
    .auth-area {
        margin-left: auto;
    }
    .user-dropdown {
        right: 0;
    }
    /* Хотбар внизу */
    .mobile-hotbar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #fff;
        border-top: 1px solid var(--border);
        z-index: 500;
        padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    }
    .hotbar-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        color: var(--muted);
        text-decoration: none;
        font-size: 0.7rem;
        background: none;
        border: none;
        cursor: pointer;
        padding: 4px 0;
        transition: color 0.2s;
        font-family: inherit;
    }
    .hotbar-item:hover,
    .hotbar-item.active {
        color: var(--primary-2);
    }
    .hotbar-item svg {
        width: 22px;
        height: 22px;
    }
    .hotbar-logout {
        color: var(--danger);
    }
    .hidden {
        display: none;
    }
    body {
        padding-bottom: 70px;
    }
    /* Скрываем кнопку каталога и вход из навбара на мобилке */
    .catalog-menu-wrap,
    .auth-area {
        display: none;
    }
}