/**
 * TOP HEADER COMPONENT STYLES
 * Верхний колонтитул с логотипом и названием проекта
 */

/* === ОСНОВНОЙ КОНТЕЙНЕР === */
.top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: linear-gradient(135deg, #2481cc 0%, #1c5aa8 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(36, 129, 204, 0.2);
    
    /* СКРЫВАЕМ ДО ИНИЦИАЛИЗАЦИИ JS - избегаем мигания */
    opacity: 0;
    visibility: hidden;
}

/* ПОКАЗЫВАЕМ ПОСЛЕ ИНИЦИАЛИЗАЦИИ JS */
body.header-initialized .top-header {
    opacity: 1 !important;
    visibility: visible !important;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* === КОНТЕНТ HEADER === */
.top-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 1200px;
    width: 100%;
}

a.top-header-content {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

a.top-header-content:hover .top-header-logo {
    transform: scale(1.05);
    transition: transform 0.2s ease;
}

a.top-header-content:hover .top-header-title {
    opacity: 0.9;
    transition: opacity 0.2s ease;
}

/* === ЛОГОТИП === */
.top-header-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

/* === НАЗВАНИЕ ПРОЕКТА === */
.top-header-title {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 0.3px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* === КНОПКА ПРОФИЛЯ (legacy) === */
.profile-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.profile-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.profile-btn:active {
    background: rgba(255, 255, 255, 0.35);
}

/* === ПРАВАЯ ЧАСТЬ HEADER (приветствие + аватар / кнопка входа) === */
.top-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.top-header-greeting {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.95);
    white-space: nowrap;
}

.top-header-login-btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 16px;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease;
    white-space: nowrap;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
}

.top-header-login-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.top-header-login-btn:active {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0.97);
}

/* === АВАТАР ПРОФИЛЯ С БЕЙДЖЕМ === */
.profile-avatar-wrapper {
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
}

.top-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.profile-avatar-wrapper:hover .top-header-avatar {
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.05);
}

.profile-avatar-wrapper:active .top-header-avatar {
    transform: scale(0.95);
}

/* Бейдж настроек (шестерёнка) - серый и чёткий */
.avatar-settings-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 19px;
    height: 19px;
    background: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    border: 1.5px solid #e5e7eb;
    line-height: 1;
}

/* Инициалы в аватаре header */
.top-header-avatar-initials {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c084fc, #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

@media (max-width: 480px) {
    .top-header-avatar {
        width: 36px;
        height: 36px;
    }
    
    .top-header-avatar-initials {
        width: 36px;
        height: 36px;
        font-size: 12px;
    }
    
    .avatar-settings-badge {
        width: 17px;
        height: 17px;
        font-size: 12px;
        top: -2px;
        right: -2px;
    }

    .top-header-greeting {
        display: none;
    }

    .top-header-login-btn {
        padding: 5px 12px;
        font-size: 13px;
    }
}

/* === ОТСТУП ДЛЯ КОНТЕНТА (чтобы не перекрывался header) === */
body {
    padding-top: 56px; /* высота header */
}

/* === АДАПТИВНОСТЬ === */
@media (max-width: 480px) {
    .top-header {
        height: 50px;
        padding: 0 12px;
    }
    
    .top-header-logo {
        width: 36px;
        height: 36px;
    }
    
    .top-header-title {
        font-size: 16px;
    }
    
    body {
        padding-top: 50px;
    }
}

/* === АНИМАЦИЯ ПОЯВЛЕНИЯ === */
.top-header {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

