/* ===== Pages — Apple-Inspired Design System ===== */
/* System font stack — no external CDN dependency */

:root {
    /* 字体 */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
    --font-mono: 'SF Mono', 'Menlo', 'Consolas', monospace;

    /* 圆角 (Modern Rounded Corners) */
    --radius: 16px;
    --radius-sm: 8px;
    --radius-lg: 20px;
    --radius-xl: 24px;

    /* 过渡 */
    --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
    --duration: 0.3s;

    /* 投影 (Premium Smooth Layered Shadows) */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.03), 0 2px 4px rgba(0, 0, 0, 0.02);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.02);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.06), 0 24px 64px rgba(0, 0, 0, 0.03);
    --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.08), 0 40px 100px rgba(0, 0, 0, 0.04);

    /* 发光边框/投影 (Glows for Interactive States) */
    --glow-primary: 0 0 0 2px rgba(26, 115, 232, 0.15), 0 4px 12px rgba(26, 115, 232, 0.15);
}

/* ===== 浅色主题（默认） ===== */
[data-theme="light"],
[data-theme="auto"] {
    /* Backgrounds: slightly cool & modern off-white */
    --bg: #FBFBFD;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F3F4F6;
    --bg-tertiary: #E5E7EB;
    --bg-card: #FFFFFF;
    --bg-input: #F9FAFB;
    --bg-hover: rgba(0, 0, 0, 0.04);

    --text: #111827;
    --text-secondary: #6B7280;
    --text-tertiary: #9CA3AF;

    --border: rgba(0, 0, 0, 0.06);
    --border-focus: rgba(0, 0, 0, 0.15);
    --divider: rgba(0, 0, 0, 0.04);

    /* Premium Accent Color (Google Blue) */
    --accent: #1A73E8;
    --accent-hover: #174EA6;
    --accent-light: rgba(26, 115, 232, 0.08);

    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;

    --code-bg: #F3F4F6;
    /* Glassmorphism: Lighter, more blur */
    --glass: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
}

/* ===== 深色主题 ===== */
[data-theme="dark"] {
    /* Backgrounds: profound dark space */
    --bg: #09090B;
    --bg-primary: #121214;
    --bg-secondary: #1F1F22;
    --bg-tertiary: #27272A;
    --bg-card: #121214;
    --bg-input: #18181B;
    --bg-hover: rgba(255, 255, 255, 0.06);

    --text: #F9FAFB;
    --text-secondary: #9CA3AF;
    --text-tertiary: #6B7280;

    --border: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(255, 255, 255, 0.2);
    --divider: rgba(255, 255, 255, 0.04);

    --accent: #8AB4F8;
    --accent-hover: #AECBFA;
    --accent-light: rgba(138, 180, 248, 0.15);

    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;

    --code-bg: #1F1F22;
    --glass: rgba(9, 9, 11, 0.65);
    --glass-border: rgba(255, 255, 255, 0.05);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
    --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.7);
}

@media (prefers-color-scheme: dark) {
    [data-theme="auto"] {
        --bg: #09090B;
        --bg-primary: #121214;
        --bg-secondary: #1F1F22;
        --bg-tertiary: #27272A;
        --bg-card: #121214;
        --bg-input: #18181B;
        --bg-hover: rgba(255, 255, 255, 0.06);
        --text: #F9FAFB;
        --text-secondary: #9CA3AF;
        --text-tertiary: #6B7280;
        --border: rgba(255, 255, 255, 0.08);
        --border-focus: rgba(255, 255, 255, 0.2);
        --divider: rgba(255, 255, 255, 0.04);
        --accent: #8AB4F8;
        --accent-hover: #AECBFA;
        --accent-light: rgba(138, 180, 248, 0.15);
        --danger: #EF4444;
        --code-bg: #1F1F22;
        --glass: rgba(9, 9, 11, 0.65);
        --glass-border: rgba(255, 255, 255, 0.05);
        --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
        --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
        --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.7);
    }
}

/* ===== 基础 ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'kern' 1;
}

/* ===== View Transitions & Reusable Animations ===== */
::view-transition-old(root) {
    animation: fade-out 0.2s var(--ease) both;
}

::view-transition-new(root) {
    animation: slide-up 0.4s var(--ease) both;
}

@keyframes fade-out {
    to {
        opacity: 0;
    }
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fade-in 0.4s var(--ease) forwards;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s var(--ease);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.skeleton {
    background-image: linear-gradient(90deg, var(--bg-tertiary) 0px, var(--bg-secondary) 50%, var(--bg-tertiary) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
    border-radius: var(--radius-sm);
    color: transparent !important;
}

.skeleton * {
    visibility: hidden;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: opacity var(--duration) var(--ease);
}

a:hover {
    opacity: 0.8;
}

::selection {
    background: var(--accent);
    color: #fff;
}

/* ===== 卡片 ===== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--duration) var(--ease), transform var(--duration) var(--ease);
}

.card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    font-family: var(--font);
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.btn:active {
    transform: scale(0.98);
}

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

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background: var(--bg-hover);
    border-color: var(--text-tertiary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text);
}

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

.btn-danger:hover {
    opacity: 0.85;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 17px;
}

/* ===== 表单 ===== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}

.input,
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    font-family: var(--font);
    font-size: 15px;
    color: var(--text);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: all var(--duration) var(--ease);
}

.input:focus,
select:focus,
textarea:focus {
    background: var(--bg-card);
    border-color: var(--accent);
    box-shadow: var(--glow-primary);
}

.input::placeholder {
    color: var(--text-tertiary);
}

textarea {
    resize: vertical;
    line-height: 1.6;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 6L0 0h10z' fill='%2386868b'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

/* ===== 徽章 ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.badge-success {
    background: rgba(48, 209, 88, 0.12);
    color: var(--success);
}

.badge-warning {
    background: rgba(255, 159, 10, 0.12);
    color: var(--warning);
}

.badge-danger {
    background: rgba(255, 59, 48, 0.12);
    color: var(--danger);
}

.badge-info {
    background: rgba(26, 115, 232, 0.12);
    color: var(--accent);
}

/* ===== 主题切换器 ===== */
.theme-switcher {
    display: flex;
    background: var(--bg-secondary);
    border-radius: 980px;
    padding: 3px;
    gap: 2px;
}

.theme-switcher button {
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration) var(--ease);
    opacity: 0.5;
}

.theme-switcher button:hover {
    opacity: 0.8;
}

.theme-switcher button.active {
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    opacity: 1;
}

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    background: var(--glass);
    backdrop-filter: blur(24px) saturate(200%);
    -webkit-backdrop-filter: blur(24px) saturate(200%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    box-shadow: var(--glass-shadow), var(--shadow-lg);
    animation: toastIn 0.4s var(--ease);
}

.toast.error {
    border-left: 3px solid var(--danger);
}

.toast.success {
    border-left: 3px solid var(--success);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes slideOut {
    to {
        opacity: 0;
        transform: translateY(-8px) scale(0.96);
    }
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}