/* Header */
.header {
    height: var(--header-height);
    background-color: var(--primary-color);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: relative;
    z-index: 10;
}

/* Высота шапки задана жёстко, поэтому переносить строки в ней нельзя: при
   нехватке места подпись обрезается многоточием, а ниже 1100px убирается
   совсем (бренд уже назван логотипом). */
.header-title {
    margin: 0;
    font-size: 1.2rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-left {
    display: flex;
    align-items: center;
    gap: clamp(10px, 1.5vw, 20px);
    min-width: 0;
}

.logo {
    flex-shrink: 0;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.user-name {
    font-size: 0.9rem;
    white-space: nowrap;
}

.login-link {
    color: var(--text-color);
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.login-link:hover {
    background-color: var(--hover-color);
}

/* User Dropdown */
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 5px;
    border-radius: 20px;
    transition: background-color 0.3s;
}

.user-info:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.theme-toggle {
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    cursor: pointer;
    padding: 5px 15px;
    border-radius: 20px;
    transition: background-color 0.3s;
}

.theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.dropdown-arrow {
    transition: transform 0.3s ease;
}

.user-dropdown {
    position: absolute;
    top: calc(var(--header-height) + 5px);
    right: 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 10px 0;
    min-width: 180px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    color: var(--primary-color);
    text-decoration: none;
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background-color: #f5f5f5;
}

/* Burger button */
.burger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 100;
    position: relative;
}

.burger-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

.burger-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.burger-btn.active span:nth-child(2) {
    opacity: 0;
}

.burger-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Заголовок пропадает раньше остального: между 769 и 1100px он вставал в две
   строки и вылезал за 60px высоты шапки. */
@media (max-width: 1100px) {
    .header-title {
        display: none;
    }
}

/* Mobile header */
@media (max-width: 768px) {
    .burger-btn {
        display: flex;
    }

    .header {
        height: 50px;
        padding: 0 12px;
        position: sticky;
        top: 0;
        z-index: 1000;
    }

    .user-name {
        display: none;
    }

    .theme-toggle span {
        display: none;
    }
}

/* Language switcher */
.lang-switch {
    position: relative;
}

.lang-switch-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: white;
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 5px 12px;
    border-radius: 20px;
    transition: background-color 0.3s;
}

.lang-switch-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.lang-switch-current {
    font-weight: 600;
    letter-spacing: 0.03em;
}

.lang-switch-arrow {
    transition: transform 0.3s ease;
}

.lang-switch-btn[aria-expanded="true"] .lang-switch-arrow {
    transform: rotate(180deg);
}

.lang-switch-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 6px 0;
    min-width: 160px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.lang-switch-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-switch-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: none;
    border: none;
    font: inherit;
    font-size: 0.9rem;
    text-align: left;
    color: var(--text-color);
    padding: 8px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.lang-switch-option:hover {
    background-color: var(--hover-color);
}

.lang-switch-option.active {
    font-weight: 600;
}

.lang-switch-code {
    display: inline-block;
    min-width: 24px;
    font-weight: 600;
    opacity: 0.7;
}

@media (max-width: 768px) {
    .lang-switch-btn {
        padding: 5px 8px;
    }

    .lang-switch-arrow {
        display: none;
    }
}
