/* 通用样式 - common.css */
/* 现代专业设计系统 */

:root {
    --accent: #6C5CE7;
    --accent-light: #A29BFE;
    --accent-dark: #4834D4;
    --accent-glow: rgba(108, 92, 231, 0.35);
    --green: #00B894;
    --red: #E17055;
    --orange: #FDCB6E;
    --surface: #FFFFFF;
    --surface-alt: #F8F9FC;
    --surface-hover: #F0F1F6;
    --text-primary: #2D3436;
    --text-secondary: #636E72;
    --text-muted: #B2BEC3;
    --divider: #E9ECEF;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
    background: var(--surface);
    line-height: 1.5;
    overflow-x: hidden;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s var(--ease-out);
}

a:hover {
    color: var(--accent-dark);
}

#app {
    min-height: 100vh;
}

/* ====== Toast 通知 ====== */
.toast-wrap {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    transform: translateY(-20px);
    opacity: 0;
    transition: transform 0.4s var(--ease-spring), opacity 0.3s var(--ease-out);
}

.toast.visible {
    transform: translateY(0);
    opacity: 1;
}

.toast-success { background: var(--green); }
.toast-error { background: var(--red); }
.toast-warning { background: var(--orange); color: var(--text-primary); }
.toast-info { background: var(--accent); }

.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

/* ====== 全局 Loading ====== */
.global-loading {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    z-index: 99998;
    transition: opacity 0.3s var(--ease-out);
}

.global-loading.fade-out {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--divider);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* ====== 确认弹窗 ====== */
.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99990;
    animation: dialogOverIn .2s var(--ease-out);
}

@keyframes dialogOverIn {
    from { opacity: 0; }
}

.dialog-box {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 340px;
    max-width: calc(100% - 32px);
    background: var(--surface);
    border-radius: var(--radius-lg);
    z-index: 99991;
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(0,0,0,.18);
    animation: dialogBoxIn .3s var(--ease-out);
    text-align: center;
    padding: 28px 24px 20px;
}

@keyframes dialogBoxIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(.95); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.dialog-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.dialog-msg {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.5;
}

.dialog-actions {
    display: flex;
    gap: 10px;
}

.dialog-btn {
    flex: 1;
    height: 40px;
    font-size: 14px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    transition: all .15s;
}

.dialog-btn.cancel {
    background: var(--surface-alt);
    color: var(--text-secondary);
}

.dialog-btn.cancel:hover {
    background: var(--divider);
}

.dialog-btn.ok {
    background: var(--accent);
    color: #fff;
}

.dialog-btn.ok:hover {
    background: var(--accent-dark);
}

.dialog-btn.danger {
    background: var(--red);
    color: #fff;
}

.dialog-btn.danger:hover {
    background: #dc2626;
}

/* ====== 响应式 ====== */
@media (max-width: 480px) {
    .toast-wrap {
        top: 12px;
        max-width: 80vw;
    }
    .toast {
        padding: 10px 14px;
        font-size: 13px;
        gap: 8px;
    }
}
