/* =============================================
   common.css - 漫天星河工作站 统一设计 Token
   ============================================= */

/* ===== CSS 变量 ===== */
:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 25, 40, 0.75);
    --bg-input: rgba(15, 23, 42, 0.8);
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-medium: rgba(255, 255, 255, 0.12);
    --border-accent: rgba(56, 189, 248, 0.2);
    --text-primary: #e8edf5;
    --text-secondary: #8892a4;
    --text-muted: #5a6478;
    --accent-cyan: #38bdf8;
    --accent-cyan-glow: rgba(56, 189, 248, 0.25);
    --accent-amber: #f59e0b;
    --accent-amber-glow: rgba(245, 158, 11, 0.25);
    --accent-emerald: #34d399;
    --accent-emerald-glow: rgba(52, 211, 153, 0.25);
    --accent-purple: #a78bfa;
    --accent-purple-glow: rgba(167, 139, 250, 0.25);
    --accent-rose: #fb7185;
    --accent-rose-glow: rgba(251, 113, 133, 0.25);
    --radius-xl: 28px;
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --transition-smooth: 0.4s cubic-bezier(0.25, 0.8, 0.25, 1.2);
    --transition-fast: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.35), 0 0 60px rgba(56, 189, 248, 0.04);
    --shadow-elevated: 0 24px 60px rgba(0, 0, 0, 0.4);
}

/* ===== 全局重置 ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Outfit', 'Noto Serif SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ===== 通用按钮 ===== */
.btn {
    padding: 10px 22px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition-fast);
    white-space: nowrap;
    touch-action: manipulation;
    letter-spacing: 0.3px;
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-primary {
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.25);
    color: var(--accent-cyan);
}

.btn-primary:hover:not(:disabled) {
    background: rgba(56, 189, 248, 0.2);
    border-color: rgba(56, 189, 248, 0.45);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(56, 189, 248, 0.2);
}

.btn-primary:active:not(:disabled) {
    transform: scale(0.97);
}

.btn-secondary {
    background: rgba(167, 139, 250, 0.08);
    border: 1px solid rgba(167, 139, 250, 0.2);
    color: var(--accent-purple);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(167, 139, 250, 0.16);
    border-color: rgba(167, 139, 250, 0.4);
}

.btn-danger {
    background: rgba(251, 113, 133, 0.08);
    border: 1px solid rgba(251, 113, 133, 0.2);
    color: var(--accent-rose);
}

.btn-danger:hover:not(:disabled) {
    background: rgba(251, 113, 133, 0.16);
    border-color: rgba(251, 113, 133, 0.4);
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
}

.btn-ghost:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-medium);
    color: var(--text-secondary);
}

.btn-solid {
    background: linear-gradient(135deg, var(--accent-cyan), #818cf8);
    border: none;
    color: #fff;
    font-weight: 600;
}

.btn-solid:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(56, 189, 248, 0.3);
}

.btn-solid:active:not(:disabled) {
    transform: scale(0.97);
}

.btn-solid.loading {
    pointer-events: none;
    opacity: 0.65;
}

.btn-solid.success {
    background: linear-gradient(135deg, var(--accent-emerald), #22d3ee);
    box-shadow: 0 4px 16px rgba(52, 211, 153, 0.3);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
    border-radius: var(--radius-xs);
}

.btn-block {
    width: 100%;
}

/* ===== 通用输入框 ===== */
.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.92rem;
    font-family: inherit;
    outline: none;
    transition: all var(--transition-fast);
}

.form-input:focus {
    border-color: rgba(56, 189, 248, 0.45);
    background: rgba(15, 23, 42, 0.95);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.08);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== 通用模态框 ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active,
.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    padding: 36px 32px 28px;
    max-width: 420px;
    width: 100%;
    position: relative;
    transform: translateY(20px) scale(0.96);
    transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1.2);
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.5), 0 0 60px rgba(56, 189, 248, 0.05);
}

.modal-overlay.active .modal-box,
.modal-overlay.show .modal-box {
    transform: translateY(0) scale(1);
}

.modal-box h3 {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.modal-box p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.7;
    margin-bottom: 20px;
    font-weight: 300;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.modal-x {
    position: absolute;
    top: 16px;
    right: 18px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
    transition: color var(--transition-fast);
    line-height: 1;
}

.modal-x:hover {
    color: var(--text-secondary);
}

/* ===== 通用消息提示 ===== */
.msg,
.form-message,
.result-msg {
    text-align: center;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-top: 12px;
    transition: all 0.3s;
}

.msg.success,
.form-message.show,
.result-msg.success {
    background: rgba(52, 211, 153, 0.08);
    color: var(--accent-emerald);
    border: 1px solid rgba(52, 211, 153, 0.2);
}

.msg.error,
.form-message.show,
.result-msg.error {
    background: rgba(251, 113, 133, 0.08);
    color: var(--accent-rose);
    border: 1px solid rgba(251, 113, 133, 0.2);
}

/* ===== 徽章 ===== */
.badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 9999px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-emerald {
    background: rgba(52, 211, 153, 0.12);
    color: var(--accent-emerald);
    border: 1px solid rgba(52, 211, 153, 0.25);
}

.badge-amber {
    background: rgba(245, 158, 11, 0.12);
    color: var(--accent-amber);
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge-rose {
    background: rgba(251, 113, 133, 0.12);
    color: var(--accent-rose);
    border: 1px solid rgba(251, 113, 133, 0.25);
}

.badge-muted {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
}

/* ===== 动画关键帧 ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

@keyframes shimmer {
    to { background-position: 200% center; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* ===== 无障碍：减少动画 ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
