/* 认证相关样式 */

/* 用户区域样式 */
.user-section {
    display: flex;
    align-items: center;
    margin-left: auto;
    padding-left: 2rem; /* 增加左边距，将用户信息往右移动 */
    min-width: 300px; /* 设置最小宽度以适应长用户名 */
    justify-content: flex-end; /* 右对齐内容 */
}

.auth-buttons {
    display: flex;
    gap: 0.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1.5rem; /* 增加间距 */
    flex-wrap: nowrap; /* 防止换行 */
    min-width: 0; /* 允许flex项收缩 */
}

.credit-display {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.user-menu {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem; /* 增加间距 */
    cursor: pointer;
    max-width: 200px; /* 设置最大宽度 */
}

.user-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px; /* 用户名最大宽度 */
    font-weight: 500;
    color: var(--text-primary);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.user-menu:hover .user-avatar {
    border-color: var(--primary-color);
}

.dropdown-trigger {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: 100;
    display: none;
}

.user-menu:hover .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s ease;
}

.dropdown-menu a:hover {
    background-color: var(--surface-hover);
    color: var(--primary-color);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 0.25rem 0;
}

/* 支持.dropdown类名（与HTML中的类名一致） */
.dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 1px; /* 从0.5rem减小到1px，以减少空隙 */
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: 100;
    display: none;
}

.user-menu:hover .dropdown {
    display: block;
}

.dropdown a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s ease;
}

.dropdown a:hover {
    background-color: var(--bg-secondary);
    color: var(--primary-color);
}

/* 登录页面样式 */
.login-main {
    min-height: calc(100vh - 160px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-box {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 3rem 2rem;
}

.login-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 2rem;
}

.google-signin-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.login-features {
    border-top: 1px solid var(--border-color);
    padding-top: 2rem;
    margin-bottom: 2rem;
}

.login-features h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.login-features ul {
    list-style: none;
    padding: 0;
}

.login-features li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

.login-features svg {
    color: var(--primary-color);
    flex-shrink: 0;
}

.free-trial-info {
    text-align: center;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

.free-trial-info p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

/* 个人资料页面样式 */
.profile-main {
    min-height: calc(100vh - 160px);
    padding: 3rem 1rem;
    background-color: var(--surface-background);
}

.profile-container {
    max-width: 800px;
    margin: 0 auto;
}

.profile-card,
.transaction-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    margin-bottom: 2rem;
}

.profile-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2rem;
}

.user-info-section {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
    margin-bottom: 3rem;
}

.user-info-section .user-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--border-color);
}

.user-details h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.user-details p {
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.join-date {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.credits-section {
    border-top: 1px solid var(--border-color);
    padding-top: 2rem;
}

.credits-section h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.credits-display {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    text-align: center;
    margin-bottom: 1rem;
}

.credits-amount {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
}

.credits-unit {
    font-size: 1.25rem;
    font-weight: 500;
    margin-left: 0.25rem;
}

.credits-info {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.transaction-list {
    max-height: 400px;
    overflow-y: auto;
}

.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.transaction-item:last-child {
    border-bottom: none;
}

.transaction-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.transaction-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.transaction-credits {
    font-weight: 600;
    color: var(--success-color);
}

.transaction-details {
    text-align: right;
}

.transaction-amount {
    font-weight: 600;
    color: var(--text-primary);
}

.transaction-status {
    font-size: 0.875rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    margin-top: 0.25rem;
    display: inline-block;
}

.status-completed {
    background-color: #e6f4ea;
    color: #1e7e34;
}

.status-pending {
    background-color: #fff3cd;
    color: #856404;
}

.status-failed {
    background-color: #f8d7da;
    color: #721c24;
}

.no-data,
.error {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
}

.loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
}

.profile-actions {
    text-align: center;
}

/* 支付页面样式 */
.payment-main {
    min-height: calc(100vh - 160px);
    padding: 3rem 1rem;
    background-color: var(--surface-background);
}

.payment-container {
    max-width: 1000px;
    margin: 0 auto;
}

.payment-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 0.5rem;
}

.payment-subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 2rem;
}

.current-balance {
    text-align: center;
    margin-bottom: 3rem;
    padding: 1rem;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.current-balance span {
    color: var(--text-secondary);
    margin-right: 0.5rem;
}

.current-balance strong {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.payment-packages {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.package {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    position: relative;
    transition: all 0.3s ease;
}

.package:hover {
    border-color: var(--primary-color);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.package.popular {
    border-color: var(--primary-color);
}

.popular-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
}

.package-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.package-price {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.package-credits {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.package-desc {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.package-features {
    text-align: left;
    margin-bottom: 1.5rem;
}

.package-features p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.package.selected {
    border-color: var(--primary-color);
    background: linear-gradient(to bottom, #f8f9ff, white);
}

#paypal-button-container {
    max-width: 400px;
    margin: 0 auto 3rem;
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

#paypal-button-container h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    text-align: center;
}

#selectedPackageInfo {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.payment-info {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}

.payment-info h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.payment-info ul {
    list-style: none;
    padding: 0;
}

.payment-info li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

.payment-info li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}

/* 支付处理状态 */
.payment-processing,
.payment-success,
.payment-error {
    text-align: center;
    padding: 2rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.payment-success svg,
.payment-error svg {
    margin-bottom: 1rem;
}

.payment-success h3,
.payment-error h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.payment-success p,
.payment-error p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.success-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .user-section {
        padding-left: 1rem;
        min-width: 250px; /* 移动端适配 */
    }
    
    .user-info {
        gap: 0.75rem; /* 移动端保持足够间距 */
    }
    
    .credit-display {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }
    
    .user-avatar {
        width: 32px;
        height: 32px;
    }

    .user-menu {
        max-width: 150px; /* 移动端调整用户菜单宽度 */
    }

    .user-name {
        max-width: 100px; /* 移动端调整用户名宽度 */
        font-size: 0.875rem;
    }
    
    .login-box {
        padding: 2rem 1.5rem;
    }
    
    .payment-packages {
        grid-template-columns: 1fr;
    }
    
    .profile-container,
    .payment-container {
        padding: 0 1rem;
    }
}