/* ========================================= */
/* LOGIN.CSS - Модуль авторизации */
/* ========================================= */

/* ========================================= */
/* ОБЩИЕ СТИЛИ */
/* ========================================= */

.turbo-user-menu,
.turbo-guest-menu {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
	margin-left: 20px;
}

/* ========================================= */
/* АВТОРИЗОВАННЫЙ ПОЛЬЗОВАТЕЛЬ */
/* ========================================= */

/* Триггер (кнопка с аватаром) */
.turbo-user-trigger {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    /*padding: 0.5rem 1rem;*/
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
}

.turbo-user-trigger:hover {
    background: var(--bg-light);
    border-color: var(--primary);
    box-shadow: 0 2px 8px var(--shadow);
}

.turbo-user-avatar {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: visible; /* ИЗМЕНЕНО! */
    flex-shrink: 0;
}

.turbo-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

/* Зелёное пульсирующее кольцо */
.turbo-user-avatar.online::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 3px solid var(--success);
    animation: pulse-ring 2s infinite;
    pointer-events: none;
}

@keyframes pulse-ring {
    0%, 100% { 
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }
    50% { 
        opacity: 0.8;
        box-shadow: 0 0 0 4px rgba(16, 185, 129, 0);
    }
}





.turbo-user-name {
    font-weight: 600;
    color: var(--text);
}

.turbo-chevron {
    transition: transform 0.2s;
    color: var(--text-light);
}

.turbo-user-trigger:hover .turbo-chevron {
    transform: rotate(180deg);
}

/* Кнопка уведомлений */
.turbo-notifications-btn {
    position: relative;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--text);
}

.turbo-notifications-btn:hover {
    background: var(--bg-light);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 2px 8px var(--shadow);
}

.turbo-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: #ef4444;
    color: white;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-body);
    animation: badge-pop 0.3s ease;
}

@keyframes badge-pop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Dropdown меню */
.turbo-user-dropdown {
    position: absolute;
    top: calc(100% + 0.75rem);
    right: 0;
    width: 320px;
    background: var(--bg-white);
    border-radius: 16px;
    box-shadow: 0 8px 32px var(--shadow);
    border: 1px solid var(--border);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    overflow: hidden;
}

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

/* Dropdown header */
.turbo-dropdown-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.turbo-dropdown-avatar {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    overflow: visible; /* ВАЖНО! */
    flex-shrink: 0;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.turbo-dropdown-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

/* Зелёное кольцо для большого аватара */
.turbo-dropdown-avatar.online::after {
/*    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 4px solid var(--success);
    animation: pulse-ring 2s infinite;
    pointer-events: none;*/
}

.turbo-dropdown-info {
    flex: 1;
    min-width: 0;
}

.turbo-dropdown-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.turbo-dropdown-role {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
}

/* Dropdown menu items */
.turbo-dropdown-menu {
    padding: 0.5rem;
}

.turbo-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 0.95rem;
    position: relative;
}

.turbo-dropdown-item:hover {
    background: var(--bg-light);
    color: var(--primary);
}

.turbo-dropdown-item svg {
    flex-shrink: 0;
    color: var(--text-light);
    transition: color 0.2s;
}

.turbo-dropdown-item:hover svg {
    color: var(--primary);
}

.turbo-dropdown-item span {
    flex: 1;
}

.turbo-item-badge {
    background: #ef4444;
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}

.turbo-item-count {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-left: auto;
}

/* Admin item */
.turbo-dropdown-item--admin {
    color: var(--primary);
}

.turbo-dropdown-item--admin:hover {
    background: rgba(59, 130, 246, 0.1);
}

/* Danger item (Выход) */
.turbo-dropdown-item--danger {
    color: #ef4444;
}

.turbo-dropdown-item--danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.turbo-dropdown-item--danger svg {
    color: #ef4444;
}

/* Theme toggle */
.turbo-theme-toggle {
    cursor: pointer;
}

.turbo-theme-icon {
    color: var(--text-light);
    transition: color 0.2s;
}

.turbo-theme-toggle:hover .turbo-theme-icon {
    color: var(--primary);
}

.turbo-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    margin-left: auto;
}

.turbo-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.turbo-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border);
    border-radius: 24px;
    transition: 0.3s;
}

.turbo-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.turbo-toggle input:checked + .turbo-toggle-slider {
    background: var(--primary);
}

.turbo-toggle input:checked + .turbo-toggle-slider:before {
    transform: translateX(20px);
}

/* Divider */
.turbo-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 0.5rem 0;
}

/* Footer */
.turbo-dropdown-footer {
    padding: 1rem;
    display: flex;
    gap: 0.75rem;
    background: var(--bg-light);
    border-top: 1px solid var(--border);
}

.turbo-btn-outline {
    flex: 1;
    padding: 0.75rem 1rem;
    background: transparent;
    border: 2px solid var(--primary);
    border-radius: 8px;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.turbo-btn-outline:hover {
    background: var(--primary);
    color: white;
}

.turbo-btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

/* ========================================= */
/* ГОСТЬ (форма входа) */
/* ========================================= */

/* Кнопка "Войти" */
.turbo-login-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s;
	margin-right: 55px;
}

.turbo-login-btn:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
}

.turbo-login-btn svg {
    flex-shrink: 0;
}

/* Login dropdown */
.turbo-login-dropdown {
    position: absolute;
    top: calc(100% + 0.75rem);
    right: 0;
    width: 360px;
    background: var(--bg-white);
    border-radius: 16px;
    box-shadow: 0 8px 32px var(--shadow);
    border: 1px solid var(--border);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    overflow: hidden;
}

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

/* Login header */
.turbo-login-header {
    padding: 2rem 2rem 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    text-align: center;
}

.turbo-login-header h3 {
    margin: 0;
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
}

/* Social login */
.turbo-social-login {
    padding: 1.5rem 1.5rem 0;
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.turbo-social-btn {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.turbo-social-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.turbo-social-vk {
    background: #0077ff;
    color: white;
}

.turbo-social-vk:hover {
    background: #0066dd;
    border-color: #0077ff;
}

.turbo-social-ya {
    background: #fc3f1d;
    color: white;
}

.turbo-social-ya:hover {
    background: #dd3619;
    border-color: #fc3f1d;
}

.turbo-social-tg {
    background: #0088cc;
    color: white;
}

.turbo-social-tg:hover {
    background: #0077b3;
    border-color: #0088cc;
}

.turbo-social-google {
    background: white;
    border: 2px solid var(--border);
}

.turbo-social-google:hover {
    border-color: #4285F4;
}

/* Divider */
.turbo-login-divider {
    padding: 1.5rem 1.5rem 0;
    text-align: center;
    position: relative;
    color: var(--text-light);
    font-size: 0.85rem;
}

.turbo-login-divider::before,
.turbo-login-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 35%;
    height: 1px;
    background: var(--border);
}

.turbo-login-divider::before {
    left: 0;
}

.turbo-login-divider::after {
    right: 0;
}

.turbo-login-divider span {
    background: var(--bg-white);
    padding: 0 0.75rem;
    position: relative;
}

/* Login form */
.turbo-login-form {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.turbo-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.turbo-form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--dark);
}

.turbo-input-wrapper {
    position: relative;
}

.turbo-input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    pointer-events: none;
}

.turbo-input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 3rem;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    background: var(--bg-light);
    transition: all 0.2s;
    font-family: inherit;
}

.turbo-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-white);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.turbo-input::placeholder {
    color: var(--text-light);
}

/* Submit button */
.turbo-btn-primary {
    padding: 1rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.2s;
    font-family: inherit;
}

.turbo-btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
}

.turbo-btn-block {
    width: 100%;
}

/* Login footer */
.turbo-login-footer {
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-light);
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
}

.turbo-login-footer a {
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s;
}

.turbo-login-footer a:hover {
    color: var(--primary);
}

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

/* ========================================= */
/* RESPONSIVE */
/* ========================================= */

@media (max-width: 768px) {
    .turbo-user-dropdown,
    .turbo-login-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
    }

    .turbo-user-dropdown.active,
    .turbo-login-dropdown.active {
        transform: translateY(0);
    }

    .turbo-user-trigger {
        padding: 0.4rem 0.75rem;
		margin-right: 55px;
    }

    .turbo-user-name {
        display: none;
    }

    .turbo-user-avatar {
        width: 32px;
        height: 32px;
    }

    .turbo-notifications-btn {
        width: 40px;
        height: 40px;
    }

    .turbo-social-login {
        padding: 1rem 1rem 0;
    }

    .turbo-social-btn {
        width: 44px;
        height: 44px;
    }

    .turbo-login-form {
        padding: 1rem 1.25rem;
    }

    .turbo-dropdown-footer {
        flex-direction: column;
    }

    .turbo-btn-outline {
        width: 100%;
    }
}

/* ========================================= */
/* DARK THEME */
/* ========================================= */

.turbo-badge:empty,
.turbo-item-badge:empty {
    display: none;
}


[data-theme="dark"] .turbo-user-trigger,
[data-theme="dark"] .turbo-notifications-btn {
    background: var(--dark-light);
    border-color: rgba(255, 255, 255, 0.1);
    color: white;
}

[data-theme="dark"] .turbo-user-trigger:hover,
[data-theme="dark"] .turbo-notifications-btn:hover {
     background: var(--dark-light);
    border-color: var(--primary);
}

[data-theme="dark"] .turbo-user-dropdown,
[data-theme="dark"] .turbo-login-dropdown {
    background: var(--dark-light);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .turbo-dropdown-item {
    color: white;
}

[data-theme="dark"] .turbo-dropdown-item:hover {
    background: var(--dark);
}

[data-theme="dark"] .turbo-dropdown-footer {
background: var(--dark-light);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .turbo-input {
    background: var(--dark);
    border-color: rgba(255, 255, 255, 0.1);
    color: white;
}

[data-theme="dark"] .turbo-input:focus {
    background: var(--dark-light);
    border-color: var(--primary);
}

[data-theme="dark"] .turbo-login-footer {
    background: var(--dark);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .turbo-login-divider span {
    background: var(--dark-light);
}

[data-theme="dark"] .turbo-online-badge {
    border-color: var(--dark-light);
}
[data-theme="dark"] .turbo-online-badge {
    border-color: var(--dark-light);
}

}

/* ========================================= */
/* LANDSCAPE MODE FIX (ГОРИЗОНТАЛЬНЫЙ РЕЖИМ) */
/* ========================================= */
/* Базовые стили для dropdown (чтобы точно работал скролл) */
.turbo-user-dropdown {
    display: flex;
    flex-direction: column;
}

.turbo-login-dropdown {
    display: flex;
    flex-direction: column;
}




/* ========================================= */
/* LANDSCAPE MODE FIX (ГОРИЗОНТАЛЬНЫЙ РЕЖИМ) */
/* ========================================= */

@media screen and (max-height: 500px) and (orientation: landscape) {
    
    /* БЛОКИРОВКА СКРОЛЛА BODY */
    body.menu-open {
        overflow: hidden !important;
        touch-action: none !important;
    }
    
    /* АВТОРИЗОВАННЫЙ ПОЛЬЗОВАТЕЛЬ */
    .turbo-user-dropdown {
        /* Позиционирование */
        position: absolute !important;
        
        /* КРИТИЧНО ДЛЯ СКРОЛЛА */
        display: flex !important;
        flex-direction: column !important;
        max-height: 85vh !important;
        height: auto !important;
        min-height: 0 !important;
        
        /* Скролл */
        overflow: hidden !important; /* Сначала скрываем весь overflow */
        overflow-y: auto !important; /* Затем включаем вертикальный */
        overscroll-behavior: contain !important;
        -webkit-overflow-scrolling: touch !important;
        
        /* Убираем все возможные ограничения */
        max-width: none !important;
        
        scrollbar-width: thin;
        scrollbar-color: var(--primary) var(--bg-light);
    }
    
    /* Принудительный скролл для webkit */
    .turbo-user-dropdown::-webkit-scrollbar {
        width: 6px !important;
        display: block !important;
    }
    
    .turbo-user-dropdown::-webkit-scrollbar-track {
        background: var(--bg-light) !important;
        border-radius: 3px;
    }
    
    .turbo-user-dropdown::-webkit-scrollbar-thumb {
        background: var(--primary) !important;
        border-radius: 3px;
    }
    
    /* ВАЖНО: делаем контент внутри flex */
    .turbo-dropdown-header,
    .turbo-dropdown-menu,
    .turbo-dropdown-footer {
        flex-shrink: 0 !important; /* Не сжимаются */
    }
    
    /* Компактные отступы */
    .turbo-dropdown-header {
        padding: 0.75rem 1rem !important;
    }
    
    .turbo-dropdown-avatar,
    .turbo-dropdown-avatar img {
      /*  width: 50px !important;
        height: 50px !important;*/
    }
    
    .turbo-dropdown-name {
        font-size: 0.95rem !important;
    }
    
    .turbo-dropdown-role {
        font-size: 0.75rem !important;
    }
    
    .turbo-dropdown-item {
        padding: 0.5rem 1rem !important;
        font-size: 0.85rem !important;
    }
    
    .turbo-dropdown-item svg {
        width: 16px !important;
        height: 16px !important;
    }
    
    .turbo-dropdown-divider {
        margin: 0.4rem 0 !important;
    }
    
    .turbo-dropdown-footer {
        padding: 0.75rem 1rem !important;
    }
    
    .turbo-dropdown-footer .turbo-btn-outline {
        padding: 0.5rem 1rem !important;
        font-size: 0.85rem !important;
    }
    
    
    /* ГОСТЬ (ФОРМА ВХОДА) */
    .turbo-login-dropdown {
        /* Позиционирование */
        position: absolute !important;
        
        /* КРИТИЧНО ДЛЯ СКРОЛЛА */
        display: flex !important;
        flex-direction: column !important;
        max-height: 85vh !important;
        height: auto !important;
        min-height: 0 !important;
        
        /* Скролл */
        overflow: hidden !important;
        overflow-y: auto !important;
        overscroll-behavior: contain !important;
        -webkit-overflow-scrolling: touch !important;
        
        scrollbar-width: thin;
        scrollbar-color: var(--primary) var(--bg-light);
    }
    
    .turbo-login-dropdown::-webkit-scrollbar {
        width: 6px !important;
        display: block !important;
    }
    
    .turbo-login-dropdown::-webkit-scrollbar-track {
        background: var(--bg-light) !important;
        border-radius: 3px;
    }
    
    .turbo-login-dropdown::-webkit-scrollbar-thumb {
        background: var(--primary) !important;
        border-radius: 3px;
    }
    
    /* Все секции не сжимаются */
    .turbo-login-header,
    .turbo-social-login,
    .turbo-login-divider,
    .turbo-login-form,
    .turbo-login-footer {
        flex-shrink: 0 !important;
    }
    
    .turbo-login-header {
        padding: 0.75rem 1rem !important;
    }
    
    .turbo-login-header h3 {
        font-size: 1rem !important;
        margin: 0 !important;
    }
    
    .turbo-social-login {
        padding: 0.5rem 1rem !important;
        gap: 0.5rem !important;
    }
    
    .turbo-social-btn {
        width: 34px !important;
        height: 34px !important;
    }
    
    .turbo-social-btn svg {
        width: 18px !important;
        height: 18px !important;
    }
    
    .turbo-login-divider {
        margin: 0.5rem 0 !important;
        font-size: 0.75rem !important;
    }
    
    .turbo-login-form {
        padding: 0 1rem 0.75rem !important;
    }
    
    .turbo-form-group {
        margin-bottom: 0.6rem !important;
    }
    
    .turbo-form-group label {
        font-size: 0.8rem !important;
        margin-bottom: 0.3rem !important;
    }
    
    .turbo-input {
        padding: 0.55rem 0.75rem 0.55rem 2.5rem !important;
        font-size: 0.85rem !important;
    }
    
    .turbo-input-icon {
        width: 16px !important;
        height: 16px !important;
    }
    
    .turbo-btn-primary {
        padding: 0.6rem 1rem !important;
        font-size: 0.9rem !important;
    }
    
    .turbo-login-footer {
        padding: 0.75rem 1rem !important;
        font-size: 0.8rem !important;
    }
}

/* Для очень низких экранов */
@media screen and (max-height: 400px) and (orientation: landscape) {
    .turbo-user-dropdown,
    .turbo-login-dropdown {
        max-height: 80vh !important;
    }
}