:root {
    --mini-capsule-bg: rgba(255, 255, 255, 0.08);
    --mini-capsule-hover: rgba(255, 255, 255, 0.2);
}

/* HEADER CONTAINER */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    margin-bottom: var(--gap);
    position: relative;
    z-index: 100;
}

/* ОБЩИЙ СТИЛЬ КАПСУЛ */
header .capsule {
    border-radius: 999px;
    display: flex;
    align-items: center;
    height: 100%;
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    background: var(--capsule-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--capsule-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    color: var(--text-color);
}

/* 1. ЛЕВАЯ СЕКЦИЯ */
.left-section {
    display: flex;
    align-items: center;
    gap: 20px;
    height: 100%;
}

.logo-capsule {
    padding: 0 8px 0 24px;
    cursor: pointer;
    max-width: 210px; 
    white-space: nowrap;
    z-index: 10;
    overflow: hidden; /* Логотип скрывает лишнее при сворачивании */
}

.logo-capsule.expanded {
    max-width: 950px;
    background: rgba(40, 40, 40, 0.8);
    border-color: rgba(255, 255, 255, 0.2);
}

.logo-main {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    margin-right: 10px;
}

.icon-main { font-size: 1.1rem; color: #fff; }

.hidden-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-10px);
    transition: opacity 0.3s ease 0.1s, transform 0.3s ease 0.1s;
    padding-right: 10px;
}

.logo-capsule.expanded .hidden-menu {
    opacity: 1;
    pointer-events: all;
    transform: translateX(0);
}

.nav-links { display: flex; gap: 8px; }

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    font-size: 0.8rem;
    background: var(--mini-capsule-bg);
    border: 1px solid rgba(255,255,255,0.05);
    padding: 8px 16px;
    border-radius: 20px;
    white-space: nowrap;
    transition: all 0.2s;
}

.nav-links a:hover {
    background: var(--mini-capsule-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    color: #fff;
}

.social-icons {
    display: flex;
    gap: 8px;
    border-left: 1px solid rgba(255,255,255,0.1);
    padding-left: 15px;
    margin-left: 5px;
}

.social-icons a {
    text-decoration: none !important;
    border: 1px solid rgba(255,255,255,0.05);
    color: var(--text-muted);
    font-size: 0.9rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--mini-capsule-bg);
    border-radius: 50%;
    transition: all 0.2s;
}

.social-icons a:hover {
    background: var(--mini-capsule-hover);
    color: #fff;
    transform: scale(1.1);
    border-color: rgba(255,255,255,0.2);
}

.date-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    transition: all 0.4s ease;
    opacity: 1;
}

/* 2. ПРАВАЯ СЕКЦИЯ */
.right-section {
    display: flex;
    gap: 15px;
    align-items: center;
    height: 100%;
}

.search-capsule {
    width: var(--header-height);
    padding: 0;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
}

.search-capsule.active {
    width: 260px;
    padding: 0 20px;
    justify-content: flex-start;
    cursor: text;
    background: rgba(40, 40, 40, 0.6);
}

.search-icon-btn {
    font-size: 1rem;
    color: #fff;
    min-width: var(--header-height);
    text-align: center;
}

.search-input {
    width: 0;
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.9rem;
    color: #fff;
    opacity: 0;
}
.search-input::placeholder { color: rgba(255,255,255,0.3); }
.search-capsule.active .search-input { width: 100%; opacity: 1; }

.news-capsule {
    padding: 0 16px 0 24px;
    gap: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-color);
    transition: background 0.3s;
    position: relative;
    overflow: hidden;
}

.news-capsule:hover { background: rgba(255, 255, 255, 0.08); }
.news-capsule i { font-size: 1.1rem; }

.news-badge {
    background: #ff4757;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 2px;
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.4);
}

/* --- ПРОФИЛЬ И DROPDOWN --- */
.profile-capsule {
    padding: 0 8px 0 20px;
    gap: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    
    /* ВАЖНО: Разрешаем выпадающему меню выходить за границы */
    overflow: visible !important; 
    position: relative; 
}

.profile-capsule img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.3);
}

/* Стили выпадающего меню */
.profile-dropdown {
    position: absolute;
    top: 75px; /* Отступ сверху */
    right: 0;
    width: 220px;
    
    background: rgba(30, 30, 30, 0.8); /* Темное стекло */
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    border-radius: 20px;
    
    padding: 10px;
    
    display: flex;
    flex-direction: column;
    gap: 5px;
    
    /* Анимация появления */
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    z-index: 999;
}

/* Класс для открытия */
.profile-capsule.active .profile-dropdown {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

/* Ссылки в меню */
.profile-dropdown a {
    text-decoration: none;
    color: #eee;
    padding: 10px 15px;
    border-radius: 12px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.2s;
}

.profile-dropdown a i {
    width: 20px;
    text-align: center;
    color: rgba(255,255,255,0.5);
}

.profile-dropdown a:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}
.profile-dropdown a:hover i { color: #fff; }

/* Разделитель */
.menu-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 5px 10px;
}

/* Смена языка */
.lang-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    font-size: 0.85rem;
    color: #ccc;
}

.lang-toggles {
    display: flex;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    padding: 2px;
}

.lang-btn {
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 700;
}

.lang-btn.active {
    background: #fff;
    color: #000;
}

/* Кнопка выход (Красная при наведении) */
.logout-link:hover {
    background: rgba(255, 71, 87, 0.15) !important;
    color: #ff4757 !important;
}
.logout-link:hover i { color: #ff4757 !important; }