/* ===== CSS Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #4F6EF7;
  --primary-dark: #3A56D4;
  --primary-light: #EEF1FF;
  --secondary: #7C3AED;
  --accent: #06B6D4;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --bg: #F8FAFC;
  --bg-card: #FFFFFF;
  --text-primary: #1E293B;
  --text-secondary: #64748B;
  --text-muted: #94A3B8;
  --border: #E2E8F0;
  --border-focus: #4F6EF7;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.07);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --font: 'Inter', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
[data-theme="dark"] {
  --bg: #0F172A;
  --bg-card: #1E293B;
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #475569;
  --border: #334155;
  --primary-light: #1E2A4A;
}
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text-primary); line-height: 1.6; min-height: 100vh; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: var(--font); }
input, textarea, select { font-family: var(--font); }

/* ===== Layout ===== */
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.page { min-height: 100vh; display: flex; flex-direction: column; }
.hidden { display: none !important; }

/* ===== Navbar ===== */
.navbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(10px);
}
.navbar-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; padding: 0 24px; max-width: 1280px; margin: 0 auto; }
.navbar-logo { display: flex; align-items: center; gap: 10px; font-size: 1.2rem; font-weight: 700; color: var(--primary); }
.navbar-logo svg { width: 32px; height: 32px; }
.navbar-nav { display: flex; align-items: center; gap: 8px; }
.nav-link { padding: 8px 16px; border-radius: var(--radius-sm); font-size: 0.9rem; color: var(--text-secondary); transition: var(--transition); font-weight: 500; }
.nav-link:hover, .nav-link.active { background: var(--primary-light); color: var(--primary); }
.navbar-actions { display: flex; align-items: center; gap: 12px; }

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border-radius: var(--radius-sm); font-size: 0.9rem; font-weight: 600; border: none; transition: var(--transition); white-space: nowrap; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(79,110,247,0.35); transform: translateY(-1px); }
.btn-secondary { background: var(--primary-light); color: var(--primary); }
.btn-secondary:hover { background: #dde4ff; }
.btn-danger { background: #FEF2F2; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: white; }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); border-color: var(--primary); color: var(--primary); }
.btn-icon { padding: 10px; border-radius: var(--radius-sm); background: transparent; border: 1px solid var(--border); color: var(--text-secondary); transition: var(--transition); }
.btn-icon:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.btn-lg { padding: 14px 32px; font-size: 1rem; border-radius: var(--radius-md); }
.btn-sm { padding: 6px 14px; font-size: 0.82rem; }

/* ===== Cards ===== */
.card { background: var(--bg-card); border-radius: var(--radius-md); border: 1px solid var(--border); padding: 24px; box-shadow: var(--shadow-sm); transition: var(--transition); }
.card:hover { box-shadow: var(--shadow-md); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); }

/* ===== Badges ===== */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 100px; font-size: 0.75rem; font-weight: 600; }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: #ECFDF5; color: var(--success); }
.badge-warning { background: #FFFBEB; color: var(--warning); }
.badge-danger { background: #FEF2F2; color: var(--danger); }

/* ===== Form Elements ===== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.875rem; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.form-input { width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 0.9rem; color: var(--text-primary); background: var(--bg-card); transition: var(--transition); outline: none; }
.form-input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(79,110,247,0.12); }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748B' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

/* ===== Language Selector ===== */
.lang-selector { display: flex; align-items: center; gap: 10px; background: var(--bg); border: 1.5px solid var(--border); border-radius: var(--radius-lg); padding: 6px 14px; }
.lang-btn { padding: 6px 14px; border-radius: 100px; font-size: 0.85rem; font-weight: 600; border: none; background: transparent; color: var(--text-secondary); transition: var(--transition); cursor: pointer; }
.lang-btn.active { background: var(--primary); color: white; box-shadow: 0 2px 8px rgba(79,110,247,0.3); }
.lang-arrow { color: var(--text-muted); font-size: 1.1rem; }

/* ===== Sidebar ===== */
.sidebar { width: 240px; min-height: 100vh; background: var(--bg-card); border-right: 1px solid var(--border); padding: 24px 16px; display: flex; flex-direction: column; gap: 6px; }
.sidebar-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.9rem; font-weight: 500; color: var(--text-secondary); transition: var(--transition); cursor: pointer; }
.sidebar-item:hover { background: var(--bg); color: var(--text-primary); }
.sidebar-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.sidebar-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); padding: 8px 14px 4px; }

/* ===== Status Indicators ===== */
.dot-live { width: 8px; height: 8px; background: var(--danger); border-radius: 50%; animation: pulse 1.5s infinite; display: inline-block; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.6; transform: scale(1.3); } }
.status-bar { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--text-secondary); }

/* ===== Wave Animation ===== */
.wave-bars { display: flex; align-items: flex-end; gap: 3px; height: 24px; }
.wave-bar { width: 3px; background: var(--primary); border-radius: 2px; animation: wave 0.8s ease-in-out infinite; }
.wave-bar:nth-child(2) { animation-delay: 0.1s; }
.wave-bar:nth-child(3) { animation-delay: 0.2s; }
.wave-bar:nth-child(4) { animation-delay: 0.3s; }
.wave-bar:nth-child(5) { animation-delay: 0.15s; }
@keyframes wave { 0%, 100% { height: 6px; } 50% { height: 20px; } }
.wave-bars.paused .wave-bar { animation-play-state: paused; height: 6px; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== Tooltip ===== */
[data-tooltip] { position: relative; }
[data-tooltip]::after { content: attr(data-tooltip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); background: var(--text-primary); color: white; font-size: 0.75rem; padding: 4px 10px; border-radius: var(--radius-sm); white-space: nowrap; opacity: 0; pointer-events: none; transition: var(--transition); }
[data-tooltip]:hover::after { opacity: 1; }

/* ===== Modal ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); z-index: 200; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: var(--transition); }
.modal-overlay.show { opacity: 1; pointer-events: all; }
.modal { background: var(--bg-card); border-radius: var(--radius-lg); padding: 32px; max-width: 480px; width: 90%; box-shadow: var(--shadow-lg); transform: scale(0.95); transition: var(--transition); }
.modal-overlay.show .modal { transform: scale(1); }
.modal-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 20px; }
.modal-close { position: absolute; top: 16px; right: 16px; padding: 8px; background: transparent; border: none; color: var(--text-muted); cursor: pointer; border-radius: var(--radius-sm); }
.modal-close:hover { background: var(--bg); color: var(--text-primary); }

/* ===== Toast ===== */
.toast-container { position: fixed; top: 80px; right: 24px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 16px; font-size: 0.875rem; box-shadow: var(--shadow-md); display: flex; align-items: center; gap: 10px; min-width: 280px; animation: slideIn 0.3s ease; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--primary); }

/* ===== Loading ===== */
.spinner { width: 20px; height: 20px; border: 2.5px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Tabs ===== */
.tabs { display: flex; border-bottom: 1.5px solid var(--border); margin-bottom: 20px; }
.tab { padding: 10px 20px; font-size: 0.875rem; font-weight: 600; color: var(--text-secondary); border-bottom: 2.5px solid transparent; margin-bottom: -1.5px; cursor: pointer; transition: var(--transition); }
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ===== Progress Bar ===== */
.progress-bar { height: 4px; background: var(--border); border-radius: 100px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 100px; transition: width 0.3s ease; }

/* ===== Highlight styles ===== */
.highlight-yellow { background: #FEF9C3; border-radius: 2px; }
.highlight-red { background: #FEE2E2; border-radius: 2px; }
.highlight-green { background: #DCFCE7; border-radius: 2px; }
.text-bold { font-weight: 700; }
.text-underline { text-decoration: underline; text-underline-offset: 2px; }

/* ===== Gradient backgrounds ===== */
.gradient-hero { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.gradient-card { background: linear-gradient(135deg, var(--primary-light) 0%, #f0f4ff 100%); }
.bg-grid { background-image: radial-gradient(var(--border) 1px, transparent 1px); background-size: 24px 24px; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .navbar-nav { display: none; }
  .container { padding: 0 16px; }
}