/**
 * Header Component Styles
 * Professional, responsive header with navigation
 * Uses brand colors from styles.css for consistency
 */

/* === HEADER-SPECIFIC VARIABLES ONLY === */
:root {
    --header-height: 76px;
    --header-shadow: 0 1px 3px 0 rgba(60, 64, 67, 0.08);
}

/* === HEADER STRUCTURE === */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--header-shadow);
    z-index: 1000;
    height: var(--header-height);
    transition: background-color 1s cubic-bezier(0.65, -0.05, 0.29, 1.2),
                border-color 1s cubic-bezier(0.65, -0.05, 0.29, 1.2);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

/* === LOGO === */
.header-left {
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: 600;
    transition: color 0.2s ease;
    border-radius: var(--border-radius);
    padding: 0px;
}

.logo:hover {
    color: var(--primary);
}

.logo:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Logo container for cross-fade */
.logo {
    position: relative;
    display: inline-block;
}

.logo-img {
    height: 55px;
    width: auto;
    transition: opacity 1s cubic-bezier(0.65, -0.05, 0.29, 1.2);
}

/* Logo switching for dark mode - cross-fade with opacity */
.logo-light {
    position: relative;
    top: 10px;
    opacity: 1;
}

.logo-dark {
    position: absolute;
    top: 10px;
    left: 0;
    opacity: 0;
}

[data-theme="dark"] .logo-light {
    opacity: 0;
}

[data-theme="dark"] .logo-dark {
    opacity: 1;
}

/* === SEARCH BAR === */
.header-center {
    flex: 1;
    max-width: 600px;
    min-width: 280px;
}

.search-form {
    width: 100%;
}

.search-container {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    height: 44px;
    padding: 0 50px 0 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 22px;
    color: var(--text-primary);
    font-size: 1rem;
    /* Theme transitions (background, color, border-color) handled globally */
    transition: box-shadow 0.2s ease;
    outline: none;
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(27, 54, 93, 0.1);
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: var(--primary);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Theme transitions handled globally, only animate transform */
    transition: transform 0.2s ease;
}

.search-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-50%) scale(1.05);
}

.search-btn:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.search-btn .icon {
    width: 18px;
    height: 18px;
}

/* === NAVIGATION === */
.header-right {
    flex-shrink: 0;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-link {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: var(--border-radius);
    /* Theme transitions handled globally */ transition: transform 0.2s ease, opacity 0.2s ease;
    white-space: nowrap;
    position: relative;
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

.nav-link.active {
    color: var(--primary);
    font-weight: 600;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 12px;
    right: 12px;
    height: 3px;
    background: var(--primary);
    border-radius: 2px 2px 0 0;
}

.nav-link:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* === MESSAGES LINK === */
.message-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-primary);
    text-decoration: none;
    /* Theme transitions handled globally */ transition: transform 0.2s ease, opacity 0.2s ease;
}

.message-link:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    color: var(--primary);
}

.message-link.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.message-link:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.message-icon {
    width: 20px;
    height: 20px;
}

.message-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #dc3545;
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-primary);
    transition: border-color 1s cubic-bezier(0.65, -0.05, 0.29, 1.2);
}

/* === USER DROPDOWN === */
.user-dropdown {
    position: relative;
}

.user-avatar-btn {
    width: 40px;
    height: 40px;
    background: transparent;
    border: 2px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    overflow: hidden;
    /* Theme transitions handled globally */ transition: transform 0.2s ease, opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar-btn:hover {
    border-color: var(--primary);
    transform: scale(1.05);
}

.user-avatar-btn:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.user-avatar-btn.active {
    border-color: var(--primary);
    background: var(--primary);
}

.user-avatar-btn.active .user-icon {
    color: white;
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-icon {
    width: 20px;
    height: 20px;
    color: var(--text-primary);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    padding: 8px 0;
    margin-top: 4px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    /* Theme transitions handled globally */ transition: transform 0.2s ease, opacity 0.2s ease;
    z-index: 100;
}

.user-dropdown[data-open] .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.2s ease;
    font-size: 0.95rem;
    position: relative;
}

.dropdown-item:hover {
    background: var(--bg-hover);
}

.dropdown-item:focus {
    outline: none;
    background: var(--bg-hover);
}

.dropdown-item .icon {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
}

.dropdown-badge {
    background: #dc3545;
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    border: none;
    margin: 8px 0;
}

/* === ICONS === */
.icon {
    width: 20px;
    height: 20px;
    display: inline-block;
    vertical-align: middle;
}

/* === BODY OFFSET === */
body {
    padding-top: var(--header-height);
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 1200px) {
    .header-content {
        gap: 16px;
    }

    .main-nav {
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .header-content {
        padding: 0 16px;
        gap: 12px;
    }

    .logo {
        font-size: 1.3rem;
    }

    .header-center {
        min-width: 200px;
    }

    .main-nav {
        gap: 12px;
    }

    .nav-link {
        padding: 6px 8px;
        font-size: 0.9rem;
    }

    .message-link,
    .user-avatar-btn {
        width: 36px;
        height: 36px;
    }
}

@media (max-width: 640px) {
    .main-nav {
        gap: 8px;
    }

    .nav-link span {
        display: none;
    }

    .nav-link {
        width: 40px;
        height: 40px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .message-link,
    .user-avatar-btn {
        width: 32px;
        height: 32px;
    }

    .message-icon {
        width: 18px;
        height: 18px;
    }
}
