/* ==========================================
   🎯 紧凑下拉菜单样式 - 简洁用户界面
   ========================================== */

/* ==========================================
   🔐 认证容器样式
   ========================================== */

.auth-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ==========================================
   🚀 登录开始按钮样式
   ========================================== */

.login-start-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    outline: none;
}

.login-start-btn:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.login-start-btn:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 16px;
    animation: rocketPulse 2s infinite;
}

@keyframes rocketPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ==========================================
   🎯 紧凑用户菜单样式
   ========================================== */

.user-menu {
    position: relative;
    display: flex;
    align-items: center;
}

/* 用户菜单触发器 */
.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.9) 0%, rgba(139, 92, 246, 0.9) 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(15px);
    min-width: 220px;
    max-width: 300px;
    box-shadow: 
        0 8px 32px rgba(99, 102, 241, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.user-menu-trigger:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 1) 0%, rgba(139, 92, 246, 1) 100%);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 12px 40px rgba(99, 102, 241, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.user-menu-trigger::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.user-menu-trigger:hover::before {
    left: 100%;
}

.user-menu-trigger.active {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

/* 用户头像 */
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b6b 0%, #ffa726 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    flex-shrink: 0;
    border: 3px solid rgba(255, 255, 255, 0.8);
    box-shadow: 
        0 4px 12px rgba(255, 107, 107, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

.user-menu-trigger:hover .user-avatar {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 
        0 6px 16px rgba(255, 107, 107, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* 用户信息 */
.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    flex: 1;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
    line-height: 1.2;
}

.user-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.plan-badge {
    font-size: 11px;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    padding: 4px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    line-height: 1;
    border: 2px solid rgba(255, 255, 255, 0.6);
    box-shadow: 
        0 2px 8px rgba(16, 185, 129, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 
            0 2px 8px rgba(16, 185, 129, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
    50% {
        box-shadow: 
            0 2px 12px rgba(16, 185, 129, 0.5),
            inset 0 1px 0 rgba(255, 255, 255, 0.3),
            0 0 0 2px rgba(16, 185, 129, 0.2);
    }
}

.plan-badge.vip {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.plan-badge.premium {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.credits-info {
    font-size: 11px;
    color: rgba(255, 255, 255, 1);
    font-weight: 600;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
}

/* 下拉箭头 */
.dropdown-arrow {
    font-size: 12px;
    color: rgba(255, 255, 255, 1);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.user-menu-trigger.active .dropdown-arrow {
    transform: rotate(180deg);
}

/* ==========================================
   📋 下拉菜单样式
   ========================================== */

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid #e5e7eb;
    min-width: 280px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    overflow: hidden;
}

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

/* 积分区域 */
.dropdown-credits {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-bottom: 1px solid #e5e7eb;
}

.credits-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.credits-icon {
    font-size: 18px;
}

.credits-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.credits-value {
    font-size: 16px;
    font-weight: 700;
    color: #0369a1;
    line-height: 1;
}

.credits-label {
    font-size: 11px;
    color: #0284c7;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.buy-credits-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.buy-credits-btn:hover {
    background: linear-gradient(135deg, #047857 0%, #065f46 100%);
    transform: scale(1.05);
}

/* 配额区域 */
.dropdown-quota {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
}

.quota-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quota-label {
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    min-width: 35px;
}

.quota-bar {
    flex: 1;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}

.quota-fill {
    height: 100%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.quota-text {
    font-size: 11px;
    font-weight: 600;
    color: #374151;
    min-width: 30px;
    text-align: right;
}

/* 分隔线 */
.dropdown-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 0;
}

/* 操作按钮区域 */
.dropdown-actions {
    padding: 8px 0;
}

.dropdown-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: none;
    border: none;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.dropdown-btn:hover {
    background: #f9fafb;
    color: #111827;
}

.dropdown-btn.primary {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    margin: 0 8px 8px;
    border-radius: 8px;
    font-weight: 600;
}

.dropdown-btn.primary:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    transform: translateY(-1px);
}

.dropdown-btn.logout {
    color: #ef4444;
    border-top: 1px solid #e5e7eb;
    margin-top: 8px;
}

.dropdown-btn.logout:hover {
    background: #fef2f2;
    color: #dc2626;
}

.dropdown-btn .btn-icon {
    font-size: 16px;
    width: 16px;
    text-align: center;
}

/* ==========================================
   🪟 登录弹窗样式
   ========================================== */

.login-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.login-modal.show {
    opacity: 1;
    visibility: visible;
}

.login-modal-content {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.8) translateY(-20px);
    transition: all 0.3s ease;
}

.login-modal.show .login-modal-content {
    transform: scale(1) translateY(0);
}

.login-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 24px 16px;
    border-bottom: 1px solid #e5e7eb;
}

.login-modal-header h3 {
    margin: 0;
    color: #1f2937;
    font-size: 20px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

.login-modal-body {
    padding: 24px;
}

.login-description {
    text-align: center;
    color: #6b7280;
    margin: 0 0 24px;
    font-size: 14px;
}

.login-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.google-login-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 20px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.google-login-btn:hover {
    border-color: #667eea;
    background: #f8fafc;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.google-icon {
    font-size: 18px;
}

.login-divider {
    position: relative;
    text-align: center;
    color: #9ca3af;
    font-size: 12px;
}

.login-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e5e7eb;
    z-index: 1;
}

.login-divider span {
    background: white;
    padding: 0 16px;
    position: relative;
    z-index: 2;
}

.email-login-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 14px;
    transition: all 0.2s ease;
    outline: none;
}

.login-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.login-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.login-actions .login-btn,
.login-actions .register-btn {
    flex: 1;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.login-actions .login-btn {
    background: #667eea;
    color: white;
}

.login-actions .login-btn:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

.login-actions .register-btn-link {
    flex: 1;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    color: #374151;
    border: 2px solid #e5e7eb;
}

.login-actions .register-btn-link:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
    text-decoration: none;
    color: #374151;
}

/* ==========================================
   📱 响应式设计
   ========================================== */

@media (max-width: 768px) {
    .user-menu-trigger {
        padding: 6px 10px;
        gap: 6px;
        min-width: 160px;
        max-width: 200px;
    }
    
    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .user-name {
        font-size: 13px;
        max-width: 80px;
    }
    
    .user-status {
        gap: 6px;
    }
    
    .plan-badge {
        font-size: 9px;
        padding: 1px 4px;
    }
    
    .credits-info {
        font-size: 9px;
    }
    
    .user-dropdown {
        min-width: 260px;
        right: -10px;
    }
    
    .dropdown-credits {
        padding: 12px;
    }
    
    .dropdown-quota {
        padding: 10px 12px;
    }
}

@media (max-width: 480px) {
    .user-dropdown {
        min-width: 240px;
        right: -20px;
    }
    
    .dropdown-credits {
        padding: 10px;
    }
    
    .dropdown-quota {
        padding: 8px 10px;
    }
    
    .dropdown-btn {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .login-modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .login-modal-header,
    .login-modal-body {
        padding: 20px;
    }
    
    .login-modal-header h3 {
        font-size: 18px;
    }
    
    .login-actions {
        flex-direction: column;
    }
}

/* ==========================================
   🌙 暗色主题支持
   ========================================== */

@media (prefers-color-scheme: dark) {
    .user-dropdown {
        background: #1f2937;
        border-color: #374151;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    }
    
    .dropdown-credits {
        background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
        border-bottom-color: #374151;
    }
    
    .credits-value {
        color: #93c5fd;
    }
    
    .credits-label {
        color: #60a5fa;
    }
    
    .quota-label {
        color: #9ca3af;
    }
    
    .quota-text {
        color: #d1d5db;
    }
    
    .dropdown-divider {
        background: #374151;
    }
    
    .dropdown-btn {
        color: #d1d5db;
    }
    
    .dropdown-btn:hover {
        background: #374151;
        color: #f9fafb;
    }
    
    .dropdown-btn.logout {
        color: #fca5a5;
        border-top-color: #374151;
    }
    
    .dropdown-btn.logout:hover {
        background: rgba(239, 68, 68, 0.1);
        color: #fca5a5;
    }
}

/* ==========================================
   ✨ 动画效果
   ========================================== */

@keyframes dropdownSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.user-dropdown.show {
    animation: dropdownSlideIn 0.3s ease-out;
}

@keyframes creditsUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.credits-value.updating {
    animation: creditsUpdate 0.6s ease-in-out;
}

@keyframes quotaUpdate {
    0% { width: 0%; }
}

.quota-fill.updating {
    animation: quotaUpdate 0.8s ease-out;
}

/* ==========================================
   🔧 工具类
   ========================================== */

.user-menu.hidden {
    display: none !important;
}

.user-menu.visible {
    display: flex !important;
}

.auth-container.hidden {
    display: none !important;
}

.auth-container.visible {
    display: flex !important;
}

/* ==========================================
   🎯 与现有样式的兼容性
   ========================================== */

.header-container .user-menu {
    margin-left: 16px;
}