/* === Хедер === */
.main-header {
    background-color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 12px 0;
    font-family: Inter, sans-serif;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

/* Логотип */
.logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.logo-img {
    height: 40px;
    width: auto;
    display: block;
}

/* Навигация десктоп */
.main-nav ul {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 20px;
}

.nav-link {
    text-decoration: none;
    color: #282828;
    font-size: 16px;
    font-weight: 400;
    transition: color 0.3s, background-color 0.3s;
    padding: 8px 10px;
    border-radius: 8px;
    white-space: nowrap;
}

.nav-link:hover {
    color: #34495e;
    background-color: #f9f9f9;
}

/* Кнопки авторизации (десктоп) */
.auth-buttons {
    display: flex;
    gap: 15px;
    flex-shrink: 0;
    align-items: center;
}

.btn-login, .btn-register {
    padding: 10px 16px;
    border-radius: 24px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    font-family: inherit;
}

.btn-login {
    background-color: #FFFFFF;
    color: #0076C9;
    border: 1px solid #e0e0e0;
    font-weight: 600;
}

.btn-login:hover {
    background-color: #f5f5f5;
}

.btn-register {
    background-color: #0D96F7;
    color: white;
    font-weight: 600;
}

.btn-register:hover {
    background-color: #0a7dd6;
}

/* === Аватар профиля (десктоп) === */
.user-avatar-trigger {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    border-radius: 50%;
    transition: transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar-trigger:hover {
    transform: scale(1.05);
}

.user-avatar-trigger .user-avatar {
    width: 44px;
    height: 44px;
    max-width: 44px;
    max-height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #0D96F7;
    display: block;
    flex-shrink: 0;
}

/* === Бургер-меню === */
.burger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    flex-shrink: 0;
}

.burger-menu span {
    width: 100%;
    height: 3px;
    background-color: #282828;
    border-radius: 3px;
    transition: all 0.3s ease;
    transform-origin: center center;
}

.burger-menu.active span:nth-child(1) {
    display: none;
}

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

.burger-menu.active span:nth-child(3) {
    display: none;
}

/* === Кнопка закрытия мобильного меню === */
.menu-close-btn {
    display: none;
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 8px;
    color: #282828;
    transition: background 0.2s, color 0.2s;
    z-index: 10;
}

.menu-close-btn:hover {
    background-color: #f0f0f0;
    color: #000;
}

.menu-close-btn svg {
    width: 24px;
    height: 24px;
    display: block;
}

/* === Мобильное меню профиля === */
.auth-buttons-mobile {
    display: none;
    flex-direction: column;
    gap: 15px;
    padding: 20px 30px 30px;
    border-top: 1px solid #eee;
    margin-top: 10px;
    width: 100%;
    box-sizing: border-box;
}

.auth-buttons-mobile .btn-login,
.auth-buttons-mobile .btn-register {
    width: 100%;
    padding: 14px;
    font-size: 18px;
    text-align: center;
}

.mobile-profile-menu {
    list-style: none;
    padding: 0;
    margin: 20px 0 0 0;
    width: 100%;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.mobile-profile-menu li {
    margin-bottom: 10px;
}

.mobile-profile-menu a {
    display: block;
    padding: 14px 16px;
    color: #282828;
    text-decoration: none;
    font-size: 16px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.mobile-profile-menu a:hover {
    background-color: #f5f7fa;
    color: #0D96F7;
}

.mobile-profile-menu .mobile-logout {
    color: #e74c3c;
    font-weight: 500;
}

.mobile-profile-menu .mobile-logout:hover {
    background-color: #fef2f2;
}

.user-avatar-trigger-mobile {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    border-radius: 50%;
    transition: transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.user-avatar-trigger-mobile:hover {
    transform: scale(1.05);
}

.user-avatar-trigger-mobile .user-avatar {
    width: 64px;
    height: 64px;
    max-width: 64px;
    max-height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #0D96F7;
    display: block;
    flex-shrink: 0;
}

.user-profile-mobile {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.user-profile-mobile .user-name {
    font-size: 16px;
    font-weight: 600;
    color: #282828;
    margin: 12px 0;
}

/* === Панель профиля с компонентом === */
.profile-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.profile-panel-overlay.active {
    opacity: 1;
    visibility: visible;
}

.profile-panel {
    position: fixed;
    top: 0;
    right: -1000px;
    width: 1000px;
    max-width: calc(100% - 100px);
    height: 100vh;
    background: #f5f5f5;
    z-index: 9999;
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.15);
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.profile-panel.active {
    right: 0;
}

.profile-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid #e0e0e0;
    background: #ffffff;
    flex-shrink: 0;
    z-index: 10;
    position: relative;
}

.profile-panel-title {
    font-size: 18px;
    font-weight: 500;
    color: #000000;
    margin: 0;
    flex: 1;
}

.profile-panel-close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 8px;
    color: #666;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: auto;
}

.profile-panel-close:hover {
    background-color: #f0f0f0;
    color: #000;
}

.profile-panel-close svg {
    width: 24px;
    height: 24px;
    display: block;
}

.profile-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.profile-panel-content .investor-profile {
    padding: 20px 24px !important;
}

.profile-panel-auth {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px 20px;
    text-align: center;
}

.profile-panel-auth p {
    font-size: 16px;
    color: #666;
    margin-bottom: 24px;
}

.profile-panel-auth .btn-login {
    padding: 10px 24px;
    background: #fff;
    color: #0076C9;
    border: 1px solid #0076C9;
    border-radius: 20px;
    font-size: 14px;
    text-decoration: none;
    transition: background 0.2s;
}

.profile-panel-auth .btn-login:hover {
    background: #f5f5f5;
}

/* === Адаптивность: Большие экраны (1201px+) === */
@media (min-width: 1201px) {
    .profile-panel {
        width: 1000px;
        right: -1000px;
        max-width: calc(100% - 100px);
    }
}

/* === Адаптивность: Планшеты и небольшие десктопы (769px - 1200px) === */
@media (min-width: 769px) and (max-width: 1200px) {
    .container {
        padding: 0 15px;
        gap: 12px;
    }
    
    .logo-img {
        height: 30px;
    }
    
    .main-nav ul {
        gap: 10px;
    }
    
    .nav-link {
        font-size: 12px;
        padding: 6px 6px;
    }
    
    .auth-buttons {
        gap: 8px;
    }
    
    .btn-login, .btn-register {
        padding: 8px 8px;
        font-size: 12px;
    }
    
    .user-avatar-trigger .user-avatar {
        width: 40px;
        height: 40px;
        max-width: 40px;
        max-height: 40px;
    }
    
    .profile-panel {
        width: calc(100% - 80px);
        max-width: 700px;
        right: -720px;
    }
    
    .profile-panel-header {
        padding: 14px 20px;
    }
    
    .profile-panel-title {
        font-size: 17px;
    }
    
    .profile-panel-content .investor-profile {
        padding: 16px 20px !important;
    }
}

/* === Адаптивность: Мобильные (до 768px) === */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .logo-img {
        height: 36px;
    }
    
    .auth-buttons {
        display: none;
    }
    
    .burger-menu {
        display: flex;
    }
    
    /* ← Кнопка закрытия видна только на мобильных */
    .menu-close-btn {
        display: block;
    }
    
    .main-nav {
        display: none;
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: white;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
        padding: 60px 20px 20px;
        z-index: 999;
        animation: slideDown 0.3s ease;
        
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .main-nav::-webkit-scrollbar {
        display: none;
    }
    
    .main-nav.active {
        display: block;
    }
    
    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    .main-nav ul {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        margin: 0;
        padding: 0;
    }
    
    .nav-link {
        font-size: 18px;
        font-weight: 500;
        padding: 14px 16px;
        width: 100%;
        text-align: left;
        border-radius: 8px;
        box-sizing: border-box;
        display: block;
    }
    
    .nav-link:hover {
        background-color: #f5f5f5;
    }
    
    .main-nav.active .auth-buttons-mobile {
        display: flex;
    }
    
    .auth-buttons-mobile {
        display: none;
        flex-direction: column;
        gap: 15px;
        padding: 20px 30px 40px;
        border-top: 1px solid #eee;
        margin-top: 15px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .profile-panel {
        width: 100%;
        max-width: 100%;
        right: -100%;
    }
    
    .profile-panel-header {
        padding: 12px 16px;
    }
    
    .profile-panel-title {
        font-size: 16px;
    }
    
    .profile-panel-close {
        padding: 6px;
    }
    
    .profile-panel-close svg {
        width: 22px;
        height: 22px;
    }
    
    .profile-panel-content .investor-profile {
        padding: 16px 20px !important;
    }
}

/* === Очень маленькие экраны (до 480px) === */
@media (max-width: 480px) {
    .logo-img {
        height: 32px;
    }
    
    .nav-link {
        font-size: 17px;
        padding: 12px 16px;
    }
    
    .auth-buttons-mobile .btn-login,
    .auth-buttons-mobile .btn-register {
        padding: 12px;
        font-size: 16px;
    }
    
    .user-avatar-trigger-mobile .user-avatar {
        width: 56px;
        height: 56px;
        max-width: 56px;
        max-height: 56px;
    }
    
    .user-profile-mobile .user-name {
        font-size: 15px;
    }
    
    .profile-panel-header {
        padding: 10px 16px;
    }
    
    .profile-panel-title {
        font-size: 15px;
    }
    
    .profile-panel-close {
        padding: 6px;
    }
    
    .profile-panel-close svg {
        width: 20px;
        height: 20px;
    }
    
    .profile-panel-content .investor-profile {
        padding: 12px 16px !important;
    }
}