/* ========================================================================
   FlashVPN 官网 - 用户登录 / 注册 / 资料 样式
   ======================================================================== */

/* ---- 顶部导航: 用户菜单 ---- */
.nav-auth {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-nav-ghost {
    background: transparent !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
}

.btn-nav-ghost:hover {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}

.btn-nav-primary {
    background: var(--primary) !important;
    color: #fff !important;
}

.btn-nav-primary:hover {
    background: var(--primary-dark) !important;
}

.nav-user {
    position: relative;
    display: flex;
    align-items: center;
}

.btn-nav-user {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem 0.85rem 0.45rem 0.5rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    color: var(--text-primary);
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    max-width: 200px;
}

.btn-nav-user:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    flex-shrink: 0;
}

.user-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 110px;
}

.user-caret {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.btn-nav-user[aria-expanded="true"] .user-caret {
    transform: rotate(180deg);
}

.user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.4rem;
    box-shadow: 0 18px 40px -10px rgba(15, 23, 42, 0.18);
    z-index: 1100;
    animation: userMenuFade 0.18s ease;
}

@keyframes userMenuFade {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: transparent;
    border: 0;
    color: var(--text-primary);
    font-size: 0.9rem;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease;
    font-family: inherit;
}

.user-menu-item:hover {
    background: var(--bg-light);
    color: var(--primary);
}

.user-menu-item i {
    width: 16px;
    text-align: center;
    color: var(--primary);
}

.user-menu-divider {
    height: 1px;
    background: var(--border-light);
    margin: 0.4rem 0.2rem;
}

.user-menu-logout {
    color: #b91c1c;
}

.user-menu-logout i {
    color: #b91c1c;
}

.user-menu-logout:hover {
    background: #fef2f2;
    color: #b91c1c;
}

.menu-badge {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #ef4444;
    color: #fff;
    border-radius: 9px;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ---- 登录 / 注册 弹窗 ---- */
.auth-modal,
.profile-modal {
    max-width: 440px;
    padding: 2rem 1.8rem 1.5rem;
    text-align: left;
    position: relative;
}

.auth-close {
    position: absolute;
    top: 0.9rem;
    right: 0.9rem;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 0;
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.auth-close:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.auth-tabs {
    display: flex;
    gap: 0.4rem;
    padding: 0.3rem;
    background: var(--bg-light);
    border-radius: 10px;
    margin-bottom: 1.5rem;
}

.auth-tab {
    flex: 1;
    padding: 0.55rem 0.8rem;
    background: transparent;
    border: 0;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.auth-tab.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.auth-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: -0.4rem 0 0.6rem;
}

.auth-field {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0 0.9rem;
    transition: all 0.2s ease;
}

.auth-field:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    background: var(--bg-card);
}

.auth-field i {
    color: var(--text-muted);
    margin-right: 0.55rem;
    font-size: 0.95rem;
}

.auth-field input {
    flex: 1;
    padding: 0.75rem 0;
    background: transparent;
    border: 0;
    outline: none;
    font-size: 0.95rem;
    color: var(--text-primary);
    font-family: inherit;
    min-width: 0;
}

.auth-field input::placeholder {
    color: var(--text-muted);
}

.auth-captcha {
    padding-right: 0.4rem;
}

.auth-captcha .captcha-question {
    font-size: 0.9rem;
    color: var(--primary);
    font-weight: 600;
    background: var(--primary-light);
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
    margin: 0 0.4rem 0 0;
    white-space: nowrap;
    min-width: 78px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.captcha-refresh {
    background: transparent;
    border: 0;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.captcha-refresh:hover {
    color: var(--primary);
    background: var(--bg-card);
}

.captcha-refresh.spinning i {
    animation: captchaSpin 0.7s linear;
}

@keyframes captchaSpin {
    to { transform: rotate(360deg); }
}

.auth-submit {
    width: 100%;
    padding: 0.85rem 1rem;
    background: var(--primary);
    color: #fff;
    border: 0;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.3rem;
}

.auth-submit:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
}

.auth-submit:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
}

.auth-submit-ghost {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.auth-submit-ghost:hover {
    background: var(--bg-light);
    color: var(--primary);
    border-color: var(--primary);
    box-shadow: none;
}

.auth-submit-danger {
    background: var(--bg-card);
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.auth-submit-danger:hover {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #ef4444;
    box-shadow: none;
}

.auth-tip {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0.4rem 0 0;
}

.auth-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-link:hover {
    text-decoration: underline;
}

/* ---- 我的资料 弹窗 ---- */
.profile-info {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;
}

.profile-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    gap: 1rem;
}

.profile-label {
    color: var(--text-muted);
    flex-shrink: 0;
}

.profile-value {
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60%;
}

.profile-change-pwd {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0;
    margin-bottom: 1rem;
    background: var(--bg-light);
}

.profile-change-pwd summary {
    cursor: pointer;
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    list-style: none;
    user-select: none;
}

.profile-change-pwd summary::-webkit-details-marker {
    display: none;
}

.profile-change-pwd summary::before {
    content: '▶';
    display: inline-block;
    margin-right: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.profile-change-pwd[open] summary::before {
    transform: rotate(90deg);
}

.auth-form-inner {
    padding: 0 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.profile-actions {
    display: flex;
    gap: 0.6rem;
}

.profile-actions .auth-submit {
    flex: 1;
    margin-top: 0;
}

/* ---- 全局通知 (toast) ---- */
.toast-container {
    position: fixed;
    top: 90px;
    right: 1.5rem;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    min-width: 240px;
    max-width: 360px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary);
    border-radius: 10px;
    padding: 0.7rem 1rem;
    box-shadow: var(--shadow-lg);
    font-size: 0.9rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    pointer-events: auto;
    animation: toastIn 0.25s ease;
}

.toast-success { border-left-color: #22c55e; }
.toast-success i { color: #22c55e; }
.toast-error   { border-left-color: #ef4444; }
.toast-error   i { color: #ef4444; }
.toast-info    { border-left-color: var(--primary); }
.toast-info    i { color: var(--primary); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

.toast.is-leaving {
    animation: toastOut 0.25s ease forwards;
}

@keyframes toastOut {
    to { opacity: 0; transform: translateX(20px); }
}

/* ---- 响应式 ---- */
@media (max-width: 768px) {
    .nav-auth .btn-nav span,
    .btn-nav-primary span {
        display: none;
    }

    .user-name {
        max-width: 80px;
    }

    .auth-modal,
    .profile-modal {
        width: calc(100% - 1.5rem);
        padding: 1.6rem 1.2rem 1.2rem;
    }

    .profile-actions {
        flex-direction: column;
    }

    .toast-container {
        top: 75px;
        right: 0.6rem;
        left: 0.6rem;
    }

    .toast {
        min-width: 0;
        max-width: none;
    }
}
