/* ============================================
   OpenCity Console — base.css
   主题变量 + 全局布局 + 顶栏 + 导航 + 通用组件
   默认浅色；[data-theme="dark"] 为深色（沿用原 opencity 青绿深色）
   ============================================ */

@font-face {
    font-family: 'AlimamaShuHeiTi-Bold';
    src: url('/console/static/AlimamaShuHeiTi-Bold.woff2') format('woff2');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

/* ---------- 浅色主题（默认） ---------- */
:root {
    --bg-primary: #f4f7fa;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-panel: #ffffff;
    --bg-hover: #eef4f8;
    --accent-primary: #0bb5e5;
    --accent-secondary: #0f3460;
    --accent-glow: rgba(11, 181, 229, 0.25);
    --accent-green: #3ec771;
    --text-primary: #1a2b3c;
    --text-secondary: #5a6b7e;
    --text-muted: #8a99ac;
    --gradient-1: linear-gradient(135deg, #0bb5e5 0%, #3ec771 100%);
    --gradient-2: linear-gradient(135deg, #45c2e9 0%, #3ec771 100%);
    --gradient-header: linear-gradient(135deg, #0bb5e5 0%, #3ec771 100%);
    --card-border: rgba(11, 181, 229, 0.18);
    --input-bg: #f4f7fa;
    --input-border: rgba(11, 181, 229, 0.25);
    --modal-bg: #ffffff;
    --modal-mask: rgba(15, 30, 50, 0.45);
    --toast-bg: rgba(26, 43, 60, 0.92);
    --toast-text: #ffffff;
    --shadow-sm: 0 1px 4px rgba(15, 30, 50, 0.08);
    --shadow-md: 0 4px 16px rgba(15, 30, 50, 0.10);
    --danger: #e74c5e;
    --success: #3ec771;
    --warning: #f5a623;
    --radius: 10px;
    --radius-lg: 14px;
    --header-h: 64px;
    --nav-h: 56px;
    --font: 'Microsoft YaHei', 'PingFang SC', Arial, sans-serif;
}

/* ---------- 深色主题（沿用原 opencity） ---------- */
[data-theme="dark"] {
    --bg-primary: #0a1628;
    --bg-secondary: #0d1f33;
    --bg-card: rgba(16, 42, 67, 0.6);
    --bg-panel: rgba(13, 31, 51, 0.8);
    --bg-hover: rgba(11, 181, 229, 0.08);
    --accent-primary: #0bb5e5;
    --accent-secondary: #0f3460;
    --accent-glow: rgba(11, 181, 229, 0.35);
    --accent-green: #3ec771;
    --text-primary: #e8f1f8;
    --text-secondary: #b7c7d7;
    --text-muted: #7a8a9e;
    --gradient-1: linear-gradient(135deg, #0bb5e5 0%, #3ec771 100%);
    --gradient-2: linear-gradient(135deg, #45c2e9 0%, #3ec771 100%);
    --gradient-header: linear-gradient(135deg, #0bb5e5 0%, #3ec771 100%);
    --card-border: rgba(11, 181, 229, 0.15);
    --input-bg: #0d1f33;
    --input-border: rgba(11, 181, 229, 0.2);
    --modal-bg: #0d1f33;
    --modal-mask: rgba(0, 0, 0, 0.6);
    --toast-bg: rgba(13, 31, 51, 0.95);
    --toast-text: #ffffff;
    --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* ---------- 全局重置 ---------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}
a { text-decoration: none; color: inherit; }
button { font-family: var(--font); cursor: pointer; }
img { max-width: 100%; }

/* ---------- 顶部页头 ---------- */
.site-header {
    position: sticky; top: 0; z-index: 100;
    height: var(--header-h);
    background: var(--gradient-header);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
    box-shadow: var(--shadow-sm);
}
.site-header .logo { display: flex; align-items: center; gap: 10px; color: #fff; font-size: 1.3rem; font-weight: 700; }
.site-header .logo .icon { font-size: 1.45rem; }
.site-header .header-right { display: flex; align-items: center; gap: 16px; color: #fff; font-size: 1rem; }
.site-header .header-right a { color: #fff; opacity: 0.92; }
.site-header .header-right a:hover { opacity: 1; text-decoration: underline; }
.site-header .username { font-weight: 600; }
.btn-theme-toggle {
    background: rgba(255,255,255,0.18); border: 1px solid rgba(255,255,255,0.3);
    color: #fff; width: 34px; height: 34px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.05rem; transition: background .2s;
}
.btn-theme-toggle:hover { background: rgba(255,255,255,0.3); }

/* ---------- 顶部导航 ---------- */
.site-nav {
    position: sticky; top: var(--header-h); z-index: 90;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--card-border);
    display: flex; gap: 4px; padding: 0 24px; height: var(--nav-h); align-items: center;
    overflow-x: auto;
}
.site-nav a {
    padding: 8px 18px; border-radius: 8px; font-size: 0.95rem; font-weight: 600;
    color: var(--text-secondary); white-space: nowrap; transition: all .15s;
}
.site-nav a:hover { color: var(--accent-primary); background: var(--bg-hover); }
.site-nav a.active { color: #fff; background: var(--gradient-1); }

/* ---------- 主内容区 ---------- */
.site-main { min-height: calc(100vh - var(--header-h) - var(--nav-h)); padding: 28px 24px; max-width: 1280px; margin: 0 auto; width: 100%; }

/* ---------- 通用卡片 ---------- */
.card {
    background: var(--bg-card); border: 1px solid var(--card-border);
    border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow-sm);
    transition: border-color .2s, box-shadow .2s;
}
.card:hover { border-color: var(--accent-primary); box-shadow: var(--shadow-md); }
.page-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 4px; color: var(--text-primary); }
.page-desc { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 20px; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    font-family: var(--font); font-size: 0.9rem; font-weight: 600;
    padding: 12px 20px; border-radius: var(--radius); border: none;
    transition: all .15s; white-space: nowrap;
}
.btn-primary { background: var(--gradient-1); color: #fff; box-shadow: 0 3px 10px var(--accent-glow); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 5px 16px var(--accent-glow); }
.btn-primary:disabled { background: var(--text-muted); box-shadow: none; cursor: not-allowed; transform: none; }
.btn-outline { background: transparent; color: var(--accent-primary); border: 1px solid var(--accent-primary); }
.btn-outline:hover { background: var(--bg-hover); }
.btn-cancel { background: transparent; color: var(--text-secondary); border: 1px solid var(--card-border); }
.btn-cancel:hover { background: var(--bg-hover); }
.btn-danger { background: rgba(231,76,94,0.12); color: var(--danger); border: 1px solid rgba(231,76,94,0.3); }
.btn-danger:hover { background: rgba(231,76,94,0.2); }
.btn-sm { padding: 5px 12px; font-size: 0.82rem; }
.btn-block { width: 100%; }

/* ---------- 表单 ---------- */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.input-text, .input-textarea, .input-select {
    width: 100%; padding: 10px 14px; background: var(--input-bg);
    border: 1px solid var(--input-border); border-radius: var(--radius);
    color: var(--text-primary); font-size: 0.92rem; font-family: var(--font);
    outline: none; transition: border-color .2s, box-shadow .2s; box-sizing: border-box;
}
.input-text:focus, .input-textarea:focus, .input-select:focus {
    border-color: var(--accent-primary); box-shadow: 0 0 0 3px var(--accent-glow);
}
.input-textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
.input-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

/* ---------- 模态框 ---------- */
.modal-overlay {
    position: fixed; inset: 0; background: var(--modal-mask);
    display: flex; align-items: center; justify-content: center; z-index: 1000;
    animation: fadeIn .2s;
}
.modal-box {
    background: var(--modal-bg); border-radius: var(--radius-lg); padding: 26px;
    width: 90%; max-width: 420px; box-shadow: var(--shadow-md);
    animation: modalIn .25s;
}
.modal-box h3 { font-size: 1.1rem; margin-bottom: 12px; color: var(--text-primary); }
.modal-box p { color: var(--text-secondary); margin-bottom: 20px; font-size: 0.92rem; line-height: 1.6; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- Toast ---------- */
.nice-toast {
    position: fixed; top: 80px; left: 50%; transform: translateX(-50%);
    background: var(--toast-bg); color: var(--toast-text);
    padding: 10px 22px; border-radius: var(--radius); font-size: 0.9rem;
    z-index: 2000; box-shadow: var(--shadow-md); animation: toastIn .25s;
    max-width: 80%; text-align: center;
}
.nice-toast.error { background: var(--danger); }
.nice-toast.success { background: var(--success); }

/* ---------- 动画 ---------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(-12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translate(-50%, -10px); } }

/* ---------- 页脚 ---------- */
.site-footer {
    background: var(--bg-secondary); border-top: 1px solid var(--card-border);
    padding: 24px; text-align: center; color: var(--text-muted); font-size: 0.82rem; margin-top: 40px;
}
.site-footer .footer-links { margin-bottom: 8px; }
.site-footer .footer-links a { color: var(--accent-primary); margin: 0 6px; }
.site-footer .footer-sep { color: var(--text-muted); }

/* ---------- 工具类 ---------- */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.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; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.hidden { display: none !important; }
