/**
 * Opengater Profile Menu CSS
 * Стили для аватара, мобильного выдвижного меню и десктоп дропдауна
 */

/* ============================================
   PROFILE AVATAR
   ============================================ */

.profile-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #5BA3F5, #3D7EDB);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    border: none;
}

.profile-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

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

.profile-initials {
    opacity: 0;
}

.profile-initials.visible {
    opacity: 1;
}

/* ============================================
   PROFILE MENU OVERLAY (MOBILE)
   ============================================ */

.profile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

@media (max-width: 767px) {
    .profile-menu-overlay.active {
        display: block;
        opacity: 1;
    }
}

/* ============================================
   MOBILE SLIDE MENU
   ============================================ */

.profile-slide-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100%;
    background: #0a0a0a;
    z-index: 999;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 0 24px;
}

[data-theme="light"] .profile-slide-menu {
    background: #F8F8FA;
}

.profile-slide-menu.active {
    right: 0;
}

/* ============================================
   PROFILE MENU HEADER
   ============================================ */

.profile-menu-header {
    padding: 20px 0 0;
    margin-bottom: 20px;
}

.profile-menu-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: opacity 0.2s;
    z-index: 1;
}

.profile-menu-close:hover {
    opacity: 0.5;
}

/* ============================================
   PROFILE INFO (в меню)
   ============================================ */

.profile-info {
    margin-top: 40px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.profile-info-avatar {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #5BA3F5, #3D7EDB);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
    flex-shrink: 0;
}

.profile-info-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.profile-email {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
}

.profile-uid {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

.copy-uid-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.copy-uid-btn:hover {
    color: var(--text-primary);
}

/* ============================================
   SUBSCRIPTION BADGE
   ============================================ */

.subscription-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    color: #10b981;
    margin-top: 8px;
    width: fit-content;
    white-space: nowrap;
}

.subscription-badge.expired {
    background: rgba(255, 59, 48, 0.1);
    color: #FF3B30;
}

.subscription-badge svg {
    width: 16px;
    height: 16px;
}

/* ============================================
   PROFILE MENU CONTENT & ITEMS
   ============================================ */

.profile-menu-content {
    flex: 1;
}


.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
    cursor: pointer;
    position: relative;
    margin-bottom: 4px;
    padding: 12px 0;
}

.profile-menu-item.with-arrow {
    padding-right: 20px;
}

.profile-menu-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

[data-theme="light"] .profile-menu-icon {
    background: rgba(0, 0, 0, 0.05);
}

.profile-menu-icon svg {
    width: 18px;
    height: 18px;
    color: #ffffff;
}

[data-theme="light"] .profile-menu-icon svg {
    color: var(--text-primary);
}

.profile-menu-item.with-arrow::after {
    content: '';
    position: absolute;
    right: 0;
    width: 6px;
    height: 6px;
    border-right: 1.5px solid var(--text-secondary);
    border-bottom: 1.5px solid var(--text-secondary);
    transform: rotate(-45deg);
    opacity: 0.3;
}

.profile-menu-item-value {
    margin-left: 12px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 400;
}

/* ============================================
   PROFILE MENU DIVIDER
   ============================================ */

.profile-menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 8px 0;
}

[data-theme="light"] .profile-menu-divider {
    background: rgba(0, 0, 0, 0.06);
}

/* ============================================
   THEME TOGGLE (в меню)
   ============================================ */

.theme-toggle-container {
    margin-left: auto;
}

.theme-toggle {
    position: relative;
    width: 48px;
    height: 28px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.3s;
}

.theme-toggle.active {
    background: rgba(255, 255, 255, 0.2);
}

[data-theme="light"] .theme-toggle {
    background: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .theme-toggle.active {
    background: #34C759;
}

.theme-toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.theme-toggle.active .theme-toggle-slider {
    transform: translateX(20px);
}

/* ============================================
   LOGOUT MENU ITEM
   ============================================ */

.logout-menu-item {
    color: var(--text-primary);
}

.logout-menu-item svg {
    color: var(--text-primary);
}

/* ============================================
   DESKTOP PROFILE DROPDOWN
   ============================================ */

.profile-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    background: #1a1a1e;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    overflow: hidden;
}

.profile-dropdown.active {
    display: block;
    animation: profileDropdownFadeIn 0.2s ease forwards;
}

.profile-dropdown.closing {
    display: block;
    animation: profileDropdownFadeOut 0.15s ease forwards;
}

@keyframes profileDropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes profileDropdownFadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-8px);
    }
}

[data-theme="light"] .profile-dropdown {
    background: #FFFFFF;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 12px 48px rgba(0, 0, 0, 0.05);
}

/* Адаптация стилей для dropdown */
.profile-dropdown .profile-menu-header {
    padding: 12px 16px;
    margin-bottom: 0;
}

.profile-dropdown .profile-menu-content {
    padding-bottom: 8px;
}

.profile-dropdown .profile-menu-item {
    padding: 10px 16px;
    font-size: 14px;
    margin-bottom: 0;
}

.profile-dropdown .profile-menu-item.with-arrow {
    padding-right: 32px;
}

.profile-dropdown .profile-menu-item.with-arrow::after {
    right: 16px;
}

.profile-dropdown .profile-menu-close {
    display: none !important;
}

.profile-dropdown .profile-info {
    margin-top: 0;
}


.profile-dropdown .profile-menu-divider {
    display: block;
    margin: 4px 0;
}

/* На десктопе скрываем мобильное меню */
@media (min-width: 768px) {
    .profile-slide-menu {
        display: none !important;
    }
}

/* ============================================
   LANGUAGE SELECTOR STYLES
   ============================================ */

.language-slide-menu {
    background: #0a0a0a !important;
}

.language-page-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 20px;
}

.language-page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.language-back-button {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s;
}

.language-back-button:hover {
    background: rgba(255, 255, 255, 0.12);
}

.language-content {
}

.language-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

.language-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.language-item:active {
    transform: scale(0.98);
}

.language-item.selected {
    background: rgba(0, 122, 255, 0.08);
    border-color: var(--primary);
}

.language-flag {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.language-name {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.language-native {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 400;
}

.language-item .check-icon {
    width: 24px;
    height: 24px;
    color: var(--primary);
    animation: checkIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes checkIn {
    from {
        transform: scale(0) rotate(-45deg);
        opacity: 0;
    }
    to {
        transform: scale(1) rotate(0);
        opacity: 1;
    }
}

[data-theme="light"] .language-slide-menu {
    background: #F8F8FA !important;
}

[data-theme="light"] .language-item {
    background: #FFFFFF;
    border-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .language-item.selected {
    background: rgba(0, 122, 255, 0.12);
}

[data-theme="light"] .language-back-button {
    background: rgba(0, 0, 0, 0.05);
}

/* ============================================
   CURRENCY SELECTOR STYLES
   ============================================ */

.currency-slide-menu {
    background: #0a0a0a !important;
}

[data-theme="light"] .currency-slide-menu {
    background: #F8F8FA !important;
}

/* ============================================
   PROFILE CARD (GlobalAuth quickCard style)
   ============================================ */

.profile-card {
    margin-top: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 100px;
    transition: border-color 0.2s;
}

.profile-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.profile-card:active {
    transform: scale(0.98);
}

[data-theme="light"] .profile-card {
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .profile-card:hover {
    border-color: rgba(0, 0, 0, 0.2);
}

.profile-card-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #5BA3F5, #3D7EDB);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
    user-select: none;
}

.profile-card-info {
    flex: 1;
    min-width: 0;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 8px;
}

.profile-card-fullname {
    grid-column: 1;
    grid-row: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.profile-card-username {
    grid-column: 1;
    grid-row: 2;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
    line-height: 1.3;
}

.profile-card .subscription-badge {
    grid-column: 2;
    grid-row: 1 / -1;
    margin-top: 0;
    padding: 2px 8px;
    font-size: 11px;
    border-radius: 8px;
}

.profile-card .subscription-badge svg {
    width: 12px;
    height: 12px;
}

.profile-card-arrow {
    flex-shrink: 0;
    color: var(--text-secondary);
    opacity: 0.3;
    transition: all 0.2s;
}

.profile-card:hover .profile-card-arrow {
    transform: translateX(2px);
    opacity: 0.6;
}

/* Desktop dropdown overrides for profile-card */
.profile-dropdown .profile-card {
    margin: 0;
}

.profile-dropdown .profile-card-avatar {
    width: 34px;
    height: 34px;
    font-size: 13px;
}

/* ============================================
   AUTH SECTION — pill style (GlobalAuth)
   ============================================ */

.auth-section {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-pill {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 100px;
    font-size: 14px;
    color: var(--text-primary);
    transition: border-color 0.2s;
}

[data-theme="light"] .auth-pill {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.06);
}

.auth-pill svg {
    flex-shrink: 0;
    color: var(--text-secondary);
}

.auth-pill-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 400;
}

/* Actionable pill (add email / add telegram) */
button.auth-pill-action {
    cursor: pointer;
    font-family: inherit;
    font-weight: 400;
}

button.auth-pill-action:hover {
    border-color: rgba(255, 255, 255, 0.16);
}

[data-theme="light"] button.auth-pill-action:hover {
    border-color: rgba(0, 0, 0, 0.12);
}

button.auth-pill-action .auth-pill-label {
    color: var(--text-secondary);
}

/* Email link slide panel removed — email flow moved to GlobalAuth popup */

/* ============================================
   MINIAPP: HIDE LOGOUT
   ============================================ */

body.is-miniapp .logout-menu-item {
    display: none;
}
