/* ============================================================
   凌晨潜龙进销存 · Windows 11 Fluent 增强皮肤
   在 erp.css / win11.css 之后加载，只做视觉增强（不动布局与功能）
   ============================================================ */

:root {
    --win-ease: cubic-bezier(0.2, 0, 0, 1);
    --win-ease-out: cubic-bezier(0.1, 0.9, 0.2, 1);
    --win-stroke: rgba(0, 0, 0, 0.0578);
    --win-elevation-1: 0 1px 2px rgba(0, 0, 0, 0.045), 0 2px 6px rgba(0, 0, 0, 0.03);
    --win-elevation-2: 0 2px 4px rgba(0, 0, 0, 0.05), 0 10px 26px -14px rgba(0, 0, 0, 0.28);
    --win-elevation-3: 0 8px 20px -8px rgba(0, 0, 0, 0.24), 0 24px 48px -24px rgba(0, 0, 0, 0.32);
}

/* ---------- 1. 桌面 Mica 底色（光斑 + 渐变，不遮挡内容） ---------- */
body {
    background-color: var(--bg);
    background-image:
        radial-gradient(1100px 520px at 8% -12%, rgba(0, 120, 212, 0.10), transparent 62%),
        radial-gradient(900px 460px at 100% -6%, rgba(116, 77, 169, 0.09), transparent 58%),
        radial-gradient(760px 420px at 62% 108%, rgba(0, 124, 140, 0.07), transparent 60%);
    background-repeat: no-repeat;
    background-attachment: fixed;
}

/* ---------- 2. 键盘可达性：Win11 蓝色焦点环 ---------- */
:focus-visible {
    outline: 2px solid var(--accent) !important;
    outline-offset: 2px;
    border-radius: 6px;
}
.nav-item:focus-visible,
.sys-nav:focus-visible,
.btn:focus-visible {
    outline-offset: 1px;
}

/* ---------- 3. 侧栏 / 顶栏：Fluent 层次与描边 ---------- */
.sidebar {
    background: var(--card-mica);
    box-shadow: inset -1px 0 0 var(--win-stroke);
}
.topbar {
    background: rgba(252, 252, 252, 0.72);
    box-shadow: 0 1px 0 var(--win-stroke), 0 6px 18px -18px rgba(0, 0, 0, 0.3);
}
.sidebar-brand {
    border-bottom: 1px solid var(--win-stroke);
}

/* ---------- 4. 导航：Fluent NavigationView（指示条 + 药丸填充） ---------- */
.sidebar .nav-item {
    border-radius: 6px;
    transition: background var(--win-ease) 120ms, color var(--win-ease) 120ms, transform 120ms var(--win-ease);
}
.sidebar .nav-item:hover {
    background: var(--hover-fill);
    color: var(--text);
}
.sidebar .nav-item:active {
    background: var(--pressed-fill);
    transform: scale(0.994);
}
.sidebar .nav-item.active {
    background: var(--accent-soft);
    color: var(--accent);
}
.sidebar .nav-item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 16px;
    border-radius: 2px;
    background: var(--accent);
}
.nav-group-title {
    letter-spacing: 0.9px;
}
.nav-item .badge-dot,
.nav-item .badge-num {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

/* ---------- 5. 按钮：Fluent 按压与焦点 ---------- */
.btn {
    transition: background var(--win-ease) 120ms, border-color var(--win-ease) 120ms,
                color var(--win-ease) 120ms, box-shadow var(--win-ease) 160ms,
                transform 90ms var(--win-ease);
}
.btn:hover:not(:disabled) {
    box-shadow: var(--win-elevation-1);
}
.btn:active:not(:disabled) {
    transform: translateY(1px) scale(0.995);
    box-shadow: none;
}
.btn-primary {
    box-shadow: 0 1px 2px rgba(0, 103, 192, 0.28);
}
.btn-primary:hover:not(:disabled) {
    box-shadow: 0 3px 10px -4px rgba(0, 103, 192, 0.5);
}
.btn-ghost:hover:not(:disabled),
.btn-outline:hover:not(:disabled) {
    background: var(--hover-fill);
}

/* ---------- 6. 输入控件：聚焦时 Win11 强调描边 ---------- */
.input,
.login-form input,
.form-input,
input[type="text"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="email"],
input[type="tel"],
select,
textarea {
    transition: border-color var(--win-ease) 140ms, box-shadow var(--win-ease) 140ms,
                background var(--win-ease) 140ms;
}
.input:focus,
.login-form input:focus,
.form-input:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 103, 192, 0.14);
    outline: none;
}
input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--accent);
}

/* ---------- 7. 卡片 / 面板：双层投影（Win11 elevation） ---------- */
.panel,
.sys-card,
.stat-card,
.section-card,
.login-card {
    box-shadow: var(--win-elevation-1);
    transition: box-shadow var(--win-ease) 200ms, transform 200ms var(--win-ease);
}
.panel:hover,
.sys-card:hover,
.stat-card:hover {
    box-shadow: var(--win-elevation-2);
}
.modal-card,
.lc-modal-card {
    box-shadow: var(--win-elevation-3);
    border-radius: 10px;
}

/* ---------- 8. 表格：行悬停填充 + 半透明表头 ---------- */
table.grid thead th {
    background: rgba(0, 0, 0, 0.026);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
table.grid tbody tr {
    transition: background 120ms var(--win-ease);
}
table.grid tbody tr:hover {
    background: rgba(0, 103, 192, 0.045);
}

/* ---------- 9. 滚动条：Win11 细圆条 ---------- */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.26) transparent;
}
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border: 3px solid transparent;
    border-radius: 8px;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.34);
    background-clip: content-box;
}

/* ---------- 10. 标签 / 徽标微调 ---------- */
.tag,
.badge,
.pill {
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}
.toast,
.lc-toast {
    box-shadow: var(--win-elevation-3);
    border-radius: 8px;
}

/* ---------- 11. 深色模式（跟随系统，Win11 风格深色） ---------- */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1f1f1f;
        --bg-alt: #272727;
        --card: #2b2b2b;
        --card-mica: rgba(43, 43, 43, 0.82);
        --text: #f3f3f3;
        --text-2: #c9c9c9;
        --text-3: #9b9b9b;
        --border: rgba(255, 255, 255, 0.08);
        --border-strong: rgba(255, 255, 255, 0.16);
        --mica: rgba(38, 38, 38, 0.82);
        --mica-strong: rgba(38, 38, 38, 0.92);
        --acrylic: rgba(32, 32, 32, 0.86);
        --hover-fill: rgba(255, 255, 255, 0.06);
        --pressed-fill: rgba(255, 255, 255, 0.04);
        --subtle-fill: rgba(255, 255, 255, 0.04);
        --divider: rgba(255, 255, 255, 0.1);
        --topbar-border: rgba(255, 255, 255, 0.08);
        --accent: #4cc2ff;
        --accent-hover: #6fd0ff;
        --accent-active: #35b0ee;
        --accent-soft: rgba(76, 194, 255, 0.14);
        --win-stroke: rgba(255, 255, 255, 0.08);
        --win-elevation-1: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.24);
        --win-elevation-2: 0 2px 6px rgba(0, 0, 0, 0.42), 0 12px 28px -14px rgba(0, 0, 0, 0.6);
        --win-elevation-3: 0 10px 24px -8px rgba(0, 0, 0, 0.6), 0 28px 56px -24px rgba(0, 0, 0, 0.7);
    }

    body {
        background-color: var(--bg);
        background-image:
            radial-gradient(1100px 520px at 8% -12%, rgba(76, 194, 255, 0.12), transparent 62%),
            radial-gradient(900px 460px at 100% -6%, rgba(146, 108, 197, 0.12), transparent 58%),
            radial-gradient(760px 420px at 62% 108%, rgba(0, 200, 220, 0.08), transparent 60%);
    }

    .topbar {
        background: rgba(32, 32, 32, 0.76);
    }

    table.grid thead th {
        background: rgba(255, 255, 255, 0.045);
    }

    table.grid tbody tr:hover {
        background: rgba(76, 194, 255, 0.08);
    }

    .login-card,
    .panel,
    .sys-card,
    .stat-card,
    .section-card {
        background: var(--card);
        border-color: var(--border);
    }

    .btn-primary {
        color: #101010;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    }

    ::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.22);
        background-clip: content-box;
    }
    ::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.4);
        background-clip: content-box;
    }
}

/* ---------- 12. 减少动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
