/* 登录模态框样式 */
.login-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.login-modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: #ffffff;
    border-radius: 20px;
    max-width: 440px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.login-modal.active .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
    z-index: 1;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1e293b;
}

.modal-header {
    padding: 48px 40px 24px;
    text-align: center;
}

.modal-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 12px;
}

.modal-header p {
    font-size: 16px;
    color: #64748b;
    margin: 0;
}

.modal-body {
    padding: 0 40px 32px;
}

#google-signin-btn {
    display: flex;
    justify-content: center;
    margin: 24px 0;
}

.divider {
    position: relative;
    text-align: center;
    margin: 32px 0;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e2e8f0;
}

.divider span {
    position: relative;
    background: #ffffff;
    padding: 0 16px;
    color: #94a3b8;
    font-size: 14px;
}

.other-options {
    margin-top: 24px;
}

.info-text {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #64748b;
    margin: 0;
    padding: 16px;
    background: rgba(59, 130, 246, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(59, 130, 246, 0.1);
}

.info-text svg {
    flex-shrink: 0;
    color: #3b82f6;
}

.modal-footer {
    padding: 24px 40px;
    border-top: 1px solid #e2e8f0;
}

.terms-text {
    font-size: 13px;
    color: #94a3b8;
    text-align: center;
    margin: 0;
    line-height: 1.6;
}

.terms-text a {
    color: #3b82f6;
    text-decoration: none;
}

.terms-text a:hover {
    text-decoration: underline;
}

/* 用户头像 */
.user-avatar {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.user-avatar:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.avatar-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 用户下拉菜单 */
.user-dropdown {
    position: fixed;
    top: 70px;
    right: 20px;
    min-width: 260px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 9999;
    overflow: hidden;
    pointer-events: none;
}

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

.dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.dropdown-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
    object-fit: cover;
}

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

.dropdown-name {
    display: block;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-email {
    display: block;
    font-size: 13px;
    opacity: 0.9;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 8px 0;
}

/* 用户积分信息 */
.user-credits-info {
    padding: 16px 20px;
    background: #f8fafc;
}

.credits-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
}

.credits-row .label {
    color: #64748b;
}

.credits-row .value {
    font-weight: 600;
    color: #1e293b;
}

.credits-row .value.highlight {
    color: #f59e0b;
    font-size: 18px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 20px;
    background: none;
    border: none;
    color: #1e293b;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
    text-align: left;
}

.dropdown-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

.dropdown-item svg {
    flex-shrink: 0;
    color: #64748b;
}

.logout-btn {
    color: #ef4444;
}

.logout-btn svg {
    color: #ef4444;
}

/* 欢迎提示 */
.welcome-toast {
    position: fixed;
    top: 100px;
    right: 24px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 16px 20px;
    z-index: 10001;
    transform: translateX(400px);
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.welcome-toast.show {
    transform: translateX(0);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.toast-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toast-text strong {
    font-size: 15px;
    color: #1e293b;
}

.toast-text span {
    font-size: 13px;
    color: #64748b;
}

/* 深色主题适配 */
html[data-theme="dark"] .modal-content {
    background: #1e293b;
}

html[data-theme="dark"] .modal-close {
    color: #94a3b8;
}

html[data-theme="dark"] .modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

html[data-theme="dark"] .modal-header h2 {
    color: #f1f5f9;
}

html[data-theme="dark"] .modal-header p {
    color: #94a3b8;
}

html[data-theme="dark"] .divider::before {
    background: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .divider span {
    background: #1e293b;
}

html[data-theme="dark"] .info-text {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
    color: #cbd5e1;
}

html[data-theme="dark"] .modal-footer {
    border-top-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .user-dropdown {
    background: #1e293b;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

html[data-theme="dark"] .dropdown-divider {
    background: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .user-credits-info {
    background: rgba(15, 23, 42, 0.5);
}

html[data-theme="dark"] .credits-row .label {
    color: #94a3b8;
}

html[data-theme="dark"] .credits-row .value {
    color: #e2e8f0;
}

html[data-theme="dark"] .credits-row .value.highlight {
    color: #fbbf24;
}

html[data-theme="dark"] .dropdown-item {
    color: #e2e8f0;
}

html[data-theme="dark"] .dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

html[data-theme="dark"] .welcome-toast {
    background: #1e293b;
}

html[data-theme="dark"] .toast-text strong {
    color: #f1f5f9;
}

/* 浅色主题适配 */
html[data-theme="light"] .user-avatar {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
}

html[data-theme="light"] .user-avatar:hover {
    background: rgba(0, 0, 0, 0.1);
}

html[data-theme="light"] .user-name {
    color: #1e293b;
}

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

/* 响应式设计 */
@media (max-width: 768px) {
    .modal-content {
        max-width: 95%;
        margin: 20px;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding-left: 24px;
        padding-right: 24px;
    }
    
    .user-name {
        display: none;
    }
    
    .user-dropdown {
        right: 10px;
    }
    
    .welcome-toast {
        right: 12px;
        left: 12px;
        transform: translateY(-100px);
    }
    
    .welcome-toast.show {
        transform: translateY(0);
    }
}
