/* css/base.css - 全局重置、字体、基础样式 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    color: #333;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: inherit;
}

.version-tag {
    position: fixed;
    bottom: 8px;
    right: 12px;
    font-size: 0.6rem;
    color: #bbb;
    z-index: 50;
    pointer-events: none;
    font-family: monospace;
    letter-spacing: 0.5px;
}

/* ========== 全局主题变量 ========== */
:root {
    /* 深色模式 (默认) */
    --bg-page: #050505;
    --bg-color: #09090b; /* Zinc 950 */
    --text-primary: #e4e4e7;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;
    
    --header-bg: rgba(24, 24, 27, 0.6);
    --panel-bg: rgba(24, 24, 27, 0.5);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.03);
    
    --btn-bg: rgba(39, 39, 42, 0.4);
    --btn-hover-bg: rgba(63, 63, 70, 0.6);
    --btn-active-bg: rgba(255, 255, 255, 0.08);
    --btn-active-text: #fff;
    --btn-active-border: rgba(255, 255, 255, 0.2);
    --btn-active-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    
    --card-bg: linear-gradient(160deg, #18181b 0%, #09090b 100%);
    --card-shadow: rgba(0, 0, 0, 0.6);
    
    --theme-btn-bg: rgba(63, 63, 70, 0.5);
    --theme-btn-hover: rgba(82, 82, 91, 0.8);
    --theme-icon-color: #fcd34d;
}

[data-theme="light"] {
    /* 浅色模式 */
    --bg-page: #eef1f6;
    --bg-color: #eef1f6;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;

    --header-bg: rgba(255, 255, 255, 0.92);
    --panel-bg: rgba(255, 255, 255, 0.92);
    --border-color: #d1d9e6;
    --border-light: #e8ecf2;

    --btn-bg: #f0f3f8;
    --btn-hover-bg: #e8ecf3;
    --btn-active-bg: #ffffff;
    --btn-active-text: #1e3a5f;
    --btn-active-border: #c2cfe0;
    --btn-active-shadow: 0 2px 8px -1px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(255,255,255,0.8);

    --card-bg: #ffffff;
    --card-shadow: rgba(0, 0, 0, 0.06);

    --theme-btn-bg: #ffffff;
    --theme-btn-hover: #f0f3f8;
    --theme-icon-color: #f59e0b;
}

/* ========== 主题切换按钮样式 ========== */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--theme-btn-bg);
    border: 1px solid var(--border-color);
    color: var(--theme-icon-color);
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease, box-shadow 0.3s ease;
    box-shadow: inset 0 1px 0 var(--border-light);
}

.theme-toggle:hover {
    background: var(--theme-btn-hover);
    transform: rotate(15deg) scale(1.05);
    box-shadow: 0 4px 12px var(--card-shadow);
}

.theme-toggle:active {
    transform: scale(0.95);
}

/* 按钮点击物理反馈动画 */
.spin-anim {
    animation: spinToggle 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes spinToggle {
    0% { transform: scale(0.9) rotate(0deg); }
    50% { transform: scale(1.1) rotate(180deg); }
    100% { transform: scale(1) rotate(360deg); }
}

/* ========== 物理防闪烁与快照屏蔽过渡 ========== */
html.disable-transitions,
html.disable-transitions *,
html.disable-transitions *:before,
html.disable-transitions *:after {
    transition: none !important;
}

/* ========== 扩散圆（Telegram Style）主题切换动画 ========== */
::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
}

/* 默认：旧画面在下，新画面从点击位置向外扩散 */
::view-transition-old(root) {
    z-index: 1;
}
::view-transition-new(root) {
    z-index: 9999;
    animation: clip-expand 0.8s cubic-bezier(0.2, 1, 0.2, 1) forwards;
}

/* 切回深色模式：特殊处理，表现为光圈收缩回按钮 (新画面不动，旧画面(浅色)收缩) */
[data-theme="dark"]::view-transition-old(root) {
    z-index: 9999;
    animation: clip-contract 0.8s cubic-bezier(0.2, 1, 0.2, 1) forwards;
}
[data-theme="dark"]::view-transition-new(root) {
    z-index: 1;
    animation: none;
}

@keyframes clip-expand {
    0% { clip-path: circle(0px at var(--click-x, 90vw) var(--click-y, 40px)); }
    100% { clip-path: circle(150vw at var(--click-x, 90vw) var(--click-y, 40px)); }
}

@keyframes clip-contract {
    0% { clip-path: circle(150vw at var(--click-x, 90vw) var(--click-y, 40px)); }
    100% { clip-path: circle(0px at var(--click-x, 90vw) var(--click-y, 40px)); }
}

