/**
 * 端智AI - 用户导航组件样式
 * @version 2.0.0
 */

/* ========================================
   用户导航容器
   ======================================== */
#user-nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* 头像容器 */
.user-nav-avatar-wrapper {
    position: relative;
}

/* 登录按钮 */
.user-nav-login-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.user-nav-login-btn svg {
    width: 16px;
    height: 16px;
}

/* 用户头像 */
.user-avatar {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    overflow: visible;
    transition: all 0.3s ease;
}

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

.user-avatar .avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(124, 58, 237, 0.5);
}

.user-avatar .avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #7c3aed 0%, #2563eb 100%);
    border-radius: 50%;
    color: white;
}

/* ========================================
   用户下拉菜单（fixed定位，添加到body）
   ======================================== */
.user-nav-dropdown {
    position: fixed;
    width: 240px;
    background: rgba(15, 15, 25, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 10001;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
}

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

/* 下拉菜单头部 */
.dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
}

.dropdown-avatar {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed 0%, #2563eb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    overflow: hidden;
}

.dropdown-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.dropdown-phone {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}

.dropdown-points {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #94a3b8;
}

.dropdown-points svg {
    color: #7c3aed;
}

/* 分割线 */
.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 16px;
}

/* 菜单列表 */
.dropdown-menu {
    padding: 8px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    color: #e2e8f0;
    font-size: 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background: rgba(124, 58, 237, 0.15);
    color: #a78bfa;
}

.dropdown-item svg {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.dropdown-item:hover svg {
    opacity: 1;
}

/* 退出登录按钮 */
.dropdown-logout:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.dropdown-logout:hover svg {
    color: #ef4444;
}

/* ========================================
   弹窗基础样式
   ======================================== */
.user-nav-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.user-nav-modal.active {
    opacity: 1;
    visibility: visible;
}

.user-nav-modal .modal {
    background: linear-gradient(180deg, rgba(30, 30, 50, 0.98) 0%, rgba(20, 20, 40, 0.98) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 32px;
    max-width: 420px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s ease;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
}

.user-nav-modal.active .modal {
    transform: scale(1) translateY(0);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: rotate(90deg);
}

/* ========================================
   登录弹窗
   ======================================== */
.login-modal {
    position: relative;
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 14px;
    color: #94a3b8;
}

.login-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.login-tab {
    flex: 1;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #94a3b8;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.login-tab:hover {
    color: #e2e8f0;
}

.login-tab.active {
    background: linear-gradient(135deg, #7c3aed 0%, #2563eb 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

.login-form-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 260px;  /* 固定表单区域高度，避免切换 tab 时跳动 */
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-field label {
    font-size: 13px;
    font-weight: 500;
    color: #94a3b8;
}

.form-field input {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    font-size: 15px;
    color: #fff;
    transition: all 0.3s ease;
}

.form-field input:focus {
    outline: none;
    border-color: #7c3aed;
    background: rgba(124, 58, 237, 0.1);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

.form-field input::placeholder {
    color: #64748b;
}

.form-field input.readonly-input {
    background: rgba(255, 255, 255, 0.02);
    color: #94a3b8;
    cursor: not-allowed;
}

.sms-input-group {
    display: flex;
    gap: 10px;
}

.sms-input-group input {
    flex: 1;
}

.btn-send-sms {
    padding: 12px 16px;
    background: rgba(124, 58, 237, 0.2);
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: #a78bfa;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-send-sms:hover:not(:disabled) {
    background: rgba(124, 58, 237, 0.3);
    border-color: rgba(124, 58, 237, 0.5);
}

.btn-send-sms:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.agreement-field {
    /* 使用 login-form-content 的 gap，不需要额外 margin */
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 12px;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1.5;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    min-width: 18px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin-top: 1px;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: linear-gradient(135deg, #7c3aed 0%, #2563eb 100%);
    border-color: transparent;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    color: #fff;
    font-size: 12px;
    font-weight: bold;
}

.checkbox-label a {
    color: #7c3aed;
    text-decoration: none;
}

.checkbox-label a:hover {
    text-decoration: underline;
}

.login-footer {
    margin-top: 20px;
    text-align: center;
}

.login-tip {
    font-size: 13px;
    color: #64748b;
}

.bonus-points {
    color: #f59e0b;
    font-weight: 600;
}

/* ========================================
   充值弹窗
   ======================================== */
.recharge-modal {
    position: relative;
}

.recharge-header {
    text-align: center;
    margin-bottom: 24px;
}

.recharge-title {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}

.recharge-subtitle {
    font-size: 14px;
    color: #94a3b8;
}

.recharge-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.recharge-option {
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.recharge-option:hover {
    background: rgba(124, 58, 237, 0.1);
    border-color: rgba(124, 58, 237, 0.3);
}

.recharge-option.selected {
    background: rgba(124, 58, 237, 0.15);
    border-color: #7c3aed;
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.3);
}

.recharge-option.recommended {
    position: relative;
    border-color: rgba(124, 58, 237, 0.5);
}

.option-points {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

.option-points-label {
    font-size: 12px;
    color: #94a3b8;
    margin: 4px 0 8px;
}

.option-price {
    font-size: 18px;
    font-weight: 600;
    color: #f59e0b;
}

.option-tag {
    position: absolute;
    top: -8px;
    right: 10px;
    background: linear-gradient(135deg, #7c3aed 0%, #2563eb 100%);
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}

.option-bonus {
    margin-top: 6px;
    font-size: 11px;
    color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
}

.loading-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
}

.error-text, .empty-text {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
}

.recharge-balance {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: #94a3b8;
}

.recharge-balance .balance-value {
    font-weight: 600;
    color: #f59e0b;
}

/* 旋转动画 */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spin {
    animation: spin 1s linear infinite;
}

.recharge-footer {
    margin-top: 20px;
}

/* ========================================
   通用按钮样式
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-full {
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #7c3aed 0%, #2563eb 100%);
    color: #fff;
    border: none;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-glow {
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

/* 确保登录弹窗内的按钮样式不被其他页面覆盖 */
.user-nav-modal .btn.btn-primary.btn-lg.btn-full,
.user-nav-modal .btn.btn-primary.btn-lg.btn-full.btn-glow {
    position: relative !important;
    height: auto !important;
    background: linear-gradient(135deg, #7c3aed 0%, #2563eb 100%) !important;
    overflow: visible !important;
    transform: none !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
}

/* ========================================
   Toast 提示
   ======================================== */
.toast {
    position: fixed;
    top: 100px;
    bottom: auto;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    background: rgba(30, 30, 50, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    font-size: 14px;
    color: #e2e8f0;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 20000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.toast.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.toast-success {
    border-color: rgba(34, 197, 94, 0.3);
}

.toast-success svg {
    color: #22c55e;
}

.toast-error {
    border-color: rgba(239, 68, 68, 0.3);
}

.toast-error svg {
    color: #ef4444;
}

.toast-info svg {
    color: #3b82f6;
}

/* ========================================
   加载和错误状态
   ======================================== */
.loading-placeholder,
.error-text,
.empty-text {
    text-align: center;
    padding: 20px;
    color: #64748b;
    font-size: 14px;
}

.error-text {
    color: #ef4444;
}

/* ========================================
   响应式
   ======================================== */
@media (max-width: 768px) {
    #user-nav {
        gap: 10px;
    }

    .user-nav-info {
        gap: 10px;
    }

    .user-balance {
        padding: 4px 10px;
        font-size: 13px;
    }

    .user-balance .balance-label {
        display: none;
    }

    .user-nav-modal .modal {
        padding: 24px;
        border-radius: 16px;
    }

    .recharge-options {
        grid-template-columns: 1fr;
    }
}
