/**
 * Kervin 站点共享样式 v3 — Precision Workshop
 * 设计方向：精密工坊 — 暗色拉丝金属 + 暖色仪表灯光
 * 彻底去除 AI 套路：无紫色渐变、无 Pacifico、无毛玻璃、无纯黑
 */

/* ========== Design Tokens ========== */
:root {
  --accent: #c9a96e;
  --accent-dim: #a88b4f;
  --accent-glow: rgba(201,169,110,0.12);
  --accent-strong: rgba(201,169,110,0.22);
  --surface: #16161d;
  --surface-hover: #1e1e26;
  --surface-raised: #1c1c24;
  --border: rgba(255,255,255,0.06);
  --border-visible: rgba(255,255,255,0.10);
  --text: #e4e0d8;
  --text-secondary: #8a857c;
  --text-dim: #54514b;
  --danger: #d94a4a;
  --success: #5a9e6f;
  --warning: #d9a44a;
  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 10px;
  --font: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Cascadia Code", "Fira Code", monospace;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 2px 8px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.03);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.5);
}

/* ========== Base Reset ========== */
*,*::before,*::after{box-sizing:border-box}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: #0d0d12;
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  font-size: 15px;
}

/* ========== Typography ========== */
h1,h2,h3,h4,h5,h6 {
  color: var(--text);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}
a:hover { color: var(--accent-dim); }

p { color: var(--text-secondary); }

label, .label {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.14); }

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}

/* ========== Loading ========== */
.kervin-loading {
  position: fixed; inset: 0; z-index: 9999;
  background: #0d0d12;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
.kervin-loading.hidden {
  opacity: 0; visibility: hidden; pointer-events: none;
}
.kervin-ld-spin {
  width: 36px; height: 36px;
  border: 2px solid rgba(255,255,255,0.06);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: kervin-sp 0.7s linear infinite;
}
@keyframes kervin-sp { to { transform: rotate(360deg); } }
.kervin-ld-text {
  margin-top: 16px;
  color: var(--text-dim);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ========== Navigation ========== */
.navbar, .nav, header, .header, .top-bar, .topbar {
  background: rgba(22,22,29,0.45) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border-bottom: 1px solid rgba(255,255,255,0.06) !important;
  color: var(--text) !important;
}

.navbar a, .nav a, header a, .header a,
.navbar a:visited, .nav a:visited, header a:visited, .header a:visited {
  color: var(--text) !important;
  transition: color 0.2s ease;
}

.navbar a:hover, .nav a:hover, header a:hover {
  color: var(--text) !important;
}

/* Logo — clean, no Pacifico, no gradient */
.logo, .navbar .logo, .nav .logo, header .logo, .site-name {
  font-family: var(--font) !important;
  font-size: 20px !important;
  font-weight: 600 !important;
  color: var(--text) !important;
  letter-spacing: -0.02em !important;
  background: none !important;
  -webkit-text-fill-color: var(--text) !important;
}

.logo::after, .site-name::after {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  margin-left: 6px;
  vertical-align: middle;
  position: relative;
  top: -2px;
}

/* ========== Cards & Surfaces ========== */
.card, .panel, .box, .login-box, .register-box,
.main-content, .content, .sidebar, .blog-container, .post-card,
.comment-box, .message-box, .friend-card, .user-card, .tool-card,
.tab-content, .modal, .dropdown, .info-card, .stat-card,
.result-box, .formula-box, .circuit-diagram, .recommended-item,
.settings-panel, .profile-card, .auth-box, .reset-box,
[class*="panel"] {
  background: rgba(22, 22, 29, 0.55) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: var(--radius) !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.03) inset !important;
}

.card:hover, .panel:hover, .blog-container:hover,
.post-card:hover, .tool-card:hover, .friend-card:hover {
  background: rgba(30, 30, 38, 0.65) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

/* ========== Inputs ========== */
input, select, textarea {
  background: rgba(255,255,255,0.04) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  border-radius: var(--radius-sm) !important;
  font-family: var(--font) !important;
  font-size: 0.9rem !important;
  padding: 8px 12px !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-glow) !important;
  outline: none !important;
}

input::placeholder, textarea::placeholder {
  color: var(--text-dim) !important;
}

/* ========== Buttons ========== */
/* Primary — warm brass, no purple gradient */
.btn-primary, button[type="submit"], .submit-btn,
.filter-tab.active, .calc-mode-btn.active {
  background: var(--accent) !important;
  color: #0d0d12 !important;
  border: none !important;
  border-radius: var(--radius-sm) !important;
  cursor: pointer !important;
  font-weight: 500 !important;
  font-family: var(--font) !important;
  font-size: 0.875rem !important;
  padding: 8px 18px !important;
  transition: background 0.2s ease, transform 0.15s ease;
}

.btn-primary:hover, button[type="submit"]:hover {
  background: var(--accent-dim) !important;
  transform: none !important;
}
.btn-primary:active, button[type="submit"]:active {
  transform: scale(0.98) !important;
}

/* Secondary */
.btn-secondary, .btn-outline, .nav-btn-outline {
  background: transparent !important;
  border: 1px solid var(--border-visible) !important;
  color: var(--text-secondary) !important;
  border-radius: var(--radius-sm) !important;
  font-family: var(--font) !important;
  font-size: 0.875rem !important;
  padding: 7px 16px !important;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.btn-secondary:hover, .btn-outline:hover {
  border-color: var(--accent) !important;
  color: var(--accent) !important;
  background: var(--accent-glow) !important;
}

/* Ghost/danger button */
.btn-danger {
  background: transparent !important;
  border: 1px solid rgba(217,74,74,0.3) !important;
  color: var(--danger) !important;
  border-radius: var(--radius-sm) !important;
  cursor: pointer !important;
  font-family: var(--font) !important;
  padding: 7px 16px !important;
  transition: all 0.2s ease;
}
.btn-danger:hover {
  background: rgba(217,74,74,0.1) !important;
  border-color: var(--danger) !important;
}

/* ========== Tables ========== */
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
}

th {
  background: rgba(255,255,255,0.03) !important;
  color: var(--text-dim) !important;
  border-bottom: 1px solid var(--border) !important;
  padding: 10px 14px !important;
  font-weight: 500 !important;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

td {
  border-bottom: 1px solid var(--border) !important;
  color: var(--text-secondary) !important;
  padding: 10px 14px !important;
}

tr:hover td {
  background: rgba(255,255,255,0.02) !important;
}

/* ========== Text Hierarchy ========== */
/* All text white by default — no gray text anywhere */
body, p, li, td, th, span, div, label, .label, strong, em, small,
h1, h2, h3, h4, h5, h6,
.navbar, .nav, header, .header, footer, .ft,
input, select, textarea, button,
[class*="title"], [class*="text"], [class*="content"], [class*="body"],
[class*="card"], [class*="panel"], [class*="box"], [class*="item"],
[class*="menu"], [class*="list"], [class*="dropdown"], [class*="modal"],
[class*="message"], [class*="notification"], [class*="toast"],
[class*="setting"], [class*="tool"], [class*="header"], [class*="footer"] {
  color: var(--text) !important;
}

/* Links: accent unless overridden */
a, a:visited { color: var(--accent) !important; }
a:hover { color: var(--accent-dim) !important; }

/* Explicitly dimmed secondary text */
.meta, .time, .date, .hint, .caption, .subtitle, .desc, .secondary,
[class*="-dim"], [class*="-muted"], [class*="-secondary"] {
  color: var(--text-secondary) !important;
}

/* ========== Tags/Chips ========== */
.tag, .chip, .badge, [class*="tag"] {
  background: var(--accent-glow) !important;
  color: var(--accent) !important;
  border-radius: 3px !important;
  padding: 2px 8px !important;
  font-size: 0.75rem !important;
  font-weight: 500 !important;
}

/* ========== Aggressive overrides for sub-pages ========== */
/* Kill all gradient text everywhere */
[style*="gradient"],
.logo[class*="gradient"],
.brand[class*="gradient"],
h1[style*="gradient"], h2[style*="gradient"],
span[style*="gradient"], div[style*="gradient"] {
  background: none !important;
  -webkit-background-clip: unset !important;
  -webkit-text-fill-color: var(--text) !important;
  background-clip: unset !important;
}

/* Override purple accent links in all sub-pages */
a[style*="color:#667eea"], a[style*="color: #667eea"],
a[style*="color:#764ba2"], a[style*="color: #764ba2"] {
  color: var(--accent) !important;
}

/* Force active/focus states to use brass */
.filter-tab.active, .calc-mode-btn.active,
.tab.active, .nav-tab.active,
[class*="active"] {
  background: var(--accent) !important;
  color: #0d0d12 !important;
}

/* Ensure glass morphism on remaining cards */
.glass-card, [class*="glass"],
.card[style*="blur"],
.panel[style*="blur"] {
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
}

/* Kill loading spinner purple */
.kervin-ld-spin, .spinner, [class*="spin"] {
  border-top-color: var(--accent) !important;
}

/* Kill gradient progress bars */
.prog-fill, .progress-fill, [class*="progress"] [class*="fill"] {
  background: var(--accent) !important;
}

/* Kill purple borders on focus */
input:focus, select:focus, textarea:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-glow) !important;
}

/* Force all buttons with gradient to solid */
button[style*="gradient"],
.btn[style*="gradient"],
[class*="btn"][style*="gradient"] {
  background: var(--accent) !important;
  color: #0d0d12 !important;
}

/* ========== Code ========== */
pre, code, .code-block {
  background: rgba(255,255,255,0.03) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-secondary) !important;
  border-radius: var(--radius-sm) !important;
  font-family: var(--font-mono) !important;
  font-size: 0.85em;
}

pre {
  padding: 16px;
  overflow-x: auto;
}

code {
  padding: 2px 6px;
}

/* ========== Toast/Alert ========== */
.toast, .alert, .notification {
  background: rgba(28, 28, 36, 0.7) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-lg) !important;
}

/* ========== Footer ========== */
footer, .footer, .ft {
  background: transparent !important;
  border-top: 1px solid var(--border) !important;
  color: var(--text-dim) !important;
  padding: 16px 20px 12px !important;
}
footer a, .footer a, .ft a {
  color: var(--text-secondary) !important;
}
footer a:hover, .footer a:hover, .ft a:hover {
  color: var(--accent) !important;
}

/* ========== SVG Override ========== */
svg text { fill: var(--text-secondary) !important; }
svg line, svg path, svg rect, svg circle {
  stroke: rgba(255,255,255,0.25) !important;
}

/* ========== Z-index layering ========== */
body > nav,
body > header,
body > main,
body > section,
body > footer,
body > .app,
body > .main,
body > .chat-layout,
body > .container,
body > .login-overlay,
body > .login-box,
body > .login-card,
body > .glass-card,
body > .spinner,
body > .kervin-loading {
  position: relative;
  z-index: 2;
}
body > .kervin-loading { z-index: 9999; }

/* ========== Utility ========== */
.text-accent { color: var(--accent) !important; }
.text-dim { color: var(--text-dim) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.bg-surface { background: var(--surface) !important; }

/* ========== Focus ring ========== */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ========== Selection ========== */
::selection {
  background: rgba(201,169,110,0.25);
  color: var(--text);
}
