/* ========================================
   上上签 - 全局共享主题样式
   Theme Shared Styles
   ======================================== */

/* 粒子背景 */
.particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.6;
}

/* 主题切换遮罩 */
.theme-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(255,255,255,0.3) 0%, transparent 70%);
    opacity: 0;
    pointer-events: none;
    z-index: 9998;
    transition: opacity 0.5s ease;
}

.theme-overlay.active {
    opacity: 1;
}

/* ========================================
   顶部控制栏 - Top Controls
   ======================================== */

.top-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ========================================
   主题选择器 - Theme Selector
   ======================================== */

.theme-selector {
    position: relative;
}

.theme-selector-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 20px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.theme-selector-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.theme-selector-btn:active {
    transform: translateY(0);
}

.theme-selector-icon {
    font-size: 16px;
}

.theme-selector-text {
    font-size: 12px;
}

/* 主题下拉菜单 */
.theme-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 140px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

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

.theme-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    color: #333;
}

.theme-option:hover {
    background: rgba(102, 126, 234, 0.1);
}

.theme-option.active {
    background: rgba(102, 126, 234, 0.15);
    font-weight: 600;
}

.theme-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.theme-option:hover .theme-dot {
    transform: scale(1.1);
}

.theme-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 8px 0;
}

/* ========================================
   动画开关 - Animation Toggle
   ======================================== */

.animation-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 20px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.animation-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.animation-toggle:active {
    transform: translateY(0);
}

.animation-toggle.disabled {
    background: linear-gradient(135deg, #9e9e9e 0%, #757575 100%);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

#animation-icon {
    font-size: 16px;
    transition: all 0.3s ease;
}

.animation-toggle.disabled #animation-icon {
    opacity: 0.5;
    filter: grayscale(100%);
}

.animation-text {
    font-size: 12px;
}

/* ========================================
   Toast弹窗 - App Toast
   ======================================== */

.app-toast, .ssq-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 14px 24px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
    z-index: 10003;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    min-width: 180px;
    justify-content: center;
}

.app-toast.show, .ssq-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

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

.toast-text {
    white-space: nowrap;
}

/* ========================================
   禁用动画时的全局样式
   ======================================== */

body.animations-disabled .animate-on-load,
body.animations-disabled .animate-on-scroll {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
}

body.animations-disabled .particle-canvas {
    display: none !important;
}

body.animations-disabled * {
    animation: none !important;
    transition: none !important;
}

body.animations-disabled .app-toast {
    transition: none !important;
}

/* ========================================
   主题样式 - Theme Styles
   ======================================== */

/* 明亮主题 (默认) */
body.theme-light {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* 复古主题 */
body.theme-retro {
    background: linear-gradient(135deg, #d4a574 0%, #8b7355 100%);
}

/* 护眼主题 */
body.theme-eye-care {
    background: linear-gradient(135deg, #4a6741 0%, #8fbc8f 100%);
}

/* 海天主题 */
body.theme-ocean {
    background: linear-gradient(135deg, #006994 0%, #00a8cc 100%);
}

/* 深邃主题 */
body.theme-deep {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

/* 暗黑主题 */
body.theme-dark {
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a3e 50%, #2d1b4e 100%);
}

/* 各主题的Toast样式 */
body.theme-retro .app-toast {
    background: rgba(139, 115, 85, 0.95);
}
body.theme-eye-care .app-toast {
    background: rgba(74, 103, 65, 0.95);
}
body.theme-ocean .app-toast {
    background: rgba(2, 136, 209, 0.95);
}
body.theme-deep .app-toast {
    background: rgba(44, 62, 80, 0.95);
}
body.theme-dark .app-toast {
    background: rgba(30, 30, 47, 0.95);
}

/* ========================================
   响应式优化 - Responsive
   ======================================== */

@media (max-width: 480px) {
    .theme-selector-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .theme-selector-icon {
        font-size: 14px;
    }

    .animation-toggle {
        padding: 6px 12px;
        font-size: 12px;
    }

    #animation-icon {
        font-size: 14px;
    }

    .theme-dropdown {
        left: 0;
        right: auto;
        min-width: 130px;
    }

    .app-toast {
        padding: 12px 20px;
        font-size: 13px;
        min-width: 160px;
    }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .particle-canvas {
        display: none;
    }
}
