/* ========================================
   Header Styles
   Based on Figma Design
   ======================================== */

.header {
    position: relative;
    width: 100%;
    height: 64px;
    background: var(--color-white);
    box-shadow: 0 1px 0 var(--color-border);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.header-container {
    max-width: var(--content-max-width);
    height: 100%;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-xl);
    justify-content: flex-end;
}

/* Logo */
.header-logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-primary);
    text-decoration: none;
}

.header-logo img {
    height: 32px;
    width: auto;
}

/* Navigation */
.header-nav {
    display: flex;
    align-items: center;
    gap: var(--spacing-xl);
    flex: 1;
    flex-direction: row;
    justify-content: flex-end;
}

.header-nav-link {
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
}

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

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

/* Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex-direction: row;
    justify-content: flex-end;
}

/* User Dropdown */
.header-user-dropdown {
    position: relative;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 var(--spacing-md);
    height: 40px;
    background: var(--color-background);
    border-radius: var(--radius-round);
    cursor: pointer;
    transition: background 0.3s ease;
}

.header-user:hover {
    background: var(--color-border);
}

.header-user-name {
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--color-text-secondary);
    text-align: right;
}

.header-user-icon {
    font-size: 10px;
    line-height: 12px;
    color: var(--color-text-muted);
    transition: transform 0.3s ease;
}

.header-user-dropdown .header-user:hover .header-user-icon {
    transform: rotate(180deg);
}

/* User Dropdown Menu */
.header-user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.header-user-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.header-user-menu-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--color-text-primary);
    text-decoration: none;
    transition: background 0.2s ease;
}

.header-user-menu-item:hover {
    background: var(--color-background);
}

.header-user-menu-item svg {
    width: 16px;
    height: 16px;
    color: var(--color-text-secondary);
}

/* Balance Display */
.header-balance {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    transition: all 0.3s ease;
}

.header-balance:hover {
    /*background: var(--color-white);*/
}

.header-balance-label {
    font-size: var(--font-size-xs);
    line-height: var(--line-height-xs);
    color: var(--color-text-muted);
    font-weight: var(--font-weight-medium);
}

.header-balance-amount {
    display: flex;
    align-items: center;
    flex-direction: column;
}

.header-balance-usd {
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    font-weight: var(--font-weight-semibold);
    color: #13AE70;
}

.header-balance-rub {
    font-size: var(--font-size-sm);
    line-height: var(--line-height-sm);
    color: var(--color-text-secondary);
}

/* Language Selector */
.header-lang {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.header-lang-text {
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--color-text-secondary);
}

.header-lang-icon {
    font-size: 10px;
    line-height: 12px;
    color: var(--color-text-muted);
    transition: transform 0.3s ease;
}

.header-lang:hover .header-lang-icon {
    transform: rotate(180deg);
}

/* Language Dropdown */
.header-lang-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 160px;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.header-lang-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.header-lang-option {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--color-text-primary);
    cursor: pointer;
    transition: background 0.2s ease;
}

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

.header-lang-option.active {
    background: rgba(19, 174, 112, 0.08);
    color: #13AE70;
}

.header-lang-flag {
    font-size: 18px;
    line-height: 1;
}

/* Theme Toggle Button */
.header-theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: var(--radius-round);
    cursor: pointer;
    transition: background 0.3s ease;
    padding: 0;
}

.header-theme-toggle:hover {
    background: var(--color-background);
}

.theme-icon {
    width: 17px;
    height: 17px;
    color: var(--color-text-secondary);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.theme-icon-dark {
    display: none;
}

/* Dark theme active state */
body.dark-theme .theme-icon-light {
    display: none;
}

body.dark-theme .theme-icon-dark {
    display: block;
}

/* Header Buttons */
.header-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-sm);
    height: 40px;
    min-width: auto;
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    border-radius: var(--radius-round);
    transition: all 0.3s ease;
}

.header-btn-primary {
    background: var(--color-white);
    color: var(--color-primary);
}

.header-btn-primary:hover {
    background: var(--color-background);
    transform: none;
    box-shadow: none;
}

.header-btn-outline {
    background: transparent;
    color: var(--color-primary);
}

.header-btn-outline:hover {
    background: var(--color-background);
    transform: none;
    box-shadow: none;
}

/* Mobile Menu Toggle */
.header-mobile-toggle {
    display: none;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

.header-mobile-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--color-text-primary);
    margin: 5px auto;
    transition: all 0.3s ease;
}

/* Responsive */
@media (max-width: 1024px) {
    .header-nav {
        gap: var(--spacing-md);
    }
    
    .header-lang-dropdown {
        right: auto;
        left: 0;
    }
}

@media (max-width: 1000px) {
    .header-container {
        padding: 0 var(--spacing-md);
        gap: var(--spacing-md);
        justify-content: space-around;
    }

    .header-user-menu.active {
        transform: translateX(110px);
    }

    .header-nav {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        background: var(--color-white);
        padding: var(--spacing-lg);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 1000;
    }

    .header-nav.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .header-nav-link {
        width: 100%;
        padding: var(--spacing-md) 0;
        border-bottom: 1px solid var(--color-border);
    }

    .header-mobile-toggle {
        display: block;
    }

    .header-actions {
        gap: var(--spacing-sm);
    }
    
    .header-btn {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: var(--font-size-sm);
    }
    
    .header-balance-label {
        display: none;
    }
    
    .header-balance-rub {
        font-size: var(--font-size-xs);
    }
    
    .header-user-name {
        max-width: 60px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: var(--font-size-sm);
    }
    
    .header-user {
        padding: 0 var(--spacing-sm);
        height: 36px;
        margin-top: var(--spacing-md);
    }
}

@media (max-width: 630px) {
    .header-container {
        padding: 0 var(--spacing-sm);
        gap: var(--spacing-sm);
    }
    
    .header-logo span {
        display: none;
    }
    
    .header-balance {
        display: none;
    }
    
    .header-actions {
        gap: 8px;
    }
    
    .header-user {
        padding: 0 8px;
        height: 32px;
    }
    
    .header-user-name {
        max-width: 50px;
        font-size: 13px;
    }

    .header-btn {
        padding: var(--spacing-xs) var(--spacing-sm);
    }
}
