/* ============================================================
   S1 Web Exporter — 主样式
   深色主题（默认）+ 浅色主题 CSS 自定义属性
   ============================================================ */

/* --- CSS Custom Properties: Dark Theme (default) --- */
:root, [data-theme="dark"] {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d27;
    --bg-tertiary: #242836;
    --bg-hover: #2a2f3e;
    --bg-active: #323848;
    --bg-card: #1e2230;
    --bg-input: #1a1d27;
    --bg-overlay: rgba(0, 0, 0, 0.6);

    --text-primary: #e4e6ed;
    --text-secondary: #9ca3b4;
    --text-muted: #6b7280;
    --text-inverse: #0f1117;

    --border-color: #2d3348;
    --border-light: #3a4058;

    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-muted: rgba(99, 102, 241, 0.15);

    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.12);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.12);

    --sidebar-width: 240px;
    --sidebar-collapsed: 64px;
    --header-height: 0px;
    --radius: 8px;
    --radius-sm: 4px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
    --transition: 0.2s ease;
    --transition-slow: 0.35s ease;
}

/* --- Light Theme --- */
[data-theme="light"] {
    --bg-primary: #f8f9fc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f3f8;
    --bg-hover: #e8ebf2;
    --bg-active: #dde1ec;
    --bg-card: #ffffff;
    --bg-input: #f1f3f8;
    --bg-overlay: rgba(0, 0, 0, 0.3);

    --text-primary: #1a1d27;
    --text-secondary: #5a6178;
    --text-muted: #9ca3b4;
    --text-inverse: #ffffff;

    --border-color: #e2e5ef;
    --border-light: #ebeef5;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

/* --- Global Reset --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: var(--text-primary);
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }


/* ============================================================
   App Shell Layout
   ============================================================ */
.app-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: width var(--transition-slow), min-width var(--transition-slow);
    z-index: 100;
}

.sidebar-header {
    padding: 20px 16px 16px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
}

.logo-icon::after { content: "S1"; }

.logo-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

/* --- Sidebar Navigation --- */
.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    transition: all var(--transition);
    white-space: nowrap;
    text-decoration: none;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-muted);
    color: var(--accent);
}

.nav-item.active .nav-icon { color: var(--accent); }

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-label {
    font-size: 13.5px;
    font-weight: 500;
}

/* --- Sidebar Footer --- */
.sidebar-footer {
    padding: 8px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    transition: all var(--transition);
    width: 100%;
    text-align: left;
    font-size: 13.5px;
    font-weight: 500;
}

.sidebar-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

#logout-btn:hover { color: var(--danger); }

/* --- Main Content --- */
.main-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 28px 32px;
    background: var(--bg-primary);
}

/* ============================================================
   Login Page
   ============================================================ */
.login-page {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    position: relative;
}

.login-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(99,102,241,0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(99,102,241,0.05) 0%, transparent 50%);
    pointer-events: none;
}

.login-card {
    width: 420px;
    max-width: 90vw;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header .login-logo {
    width: 56px;
    height: 56px;
    background: var(--accent);
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
    color: #fff;
    margin-bottom: 16px;
}

.login-header h1 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 6px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 13.5px;
}

/* ============================================================
   Page Transitions
   ============================================================ */
.page-enter {
    animation: pageIn 0.25s ease forwards;
}

@keyframes pageIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Utility Classes
   ============================================================ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.w-full { width: 100%; }
.hidden { display: none !important; }
