/* common.css — shared styles across all pages */

/* ===== Reset ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* ===== Theme: Light ===== */
:root {
  --bg: #f5f0e8;
  --bg-alt: #ede8dc;
  --ink: #2c2420;
  --ink-light: #5a4e44;
  --muted: #7a6e64;
  --faint: #a09080;
  --ghost: #c8b8a4;
  --whisper: #d4c8b8;
  --border: rgba(26,26,26,0.08);
  --border-strong: rgba(26,26,26,0.15);
  --vermilion: #c0392b;
  --vermilion-faint: rgba(192,57,43,0.15);
  --nav-bg: rgba(245,240,232,0.92);
  --card-bg: rgba(237,232,220,0.5);
  --hover-bg: rgba(26,26,26,0.06);
  --shadow: rgba(26,26,26,0.08);
  --svg-fill: #2c2420;
  --svg-circle: #5c3a30;
}

/* ===== Theme: Dark ===== */
:root.dark-theme {
  --bg: #1c1a16;
  --bg-alt: #252320;
  --ink: #e8e0d4;
  --ink-light: #ccc4b8;
  --muted: #a49c8c;
  --faint: #847c6c;
  --ghost: #5a5448;
  --whisper: #3e3830;
  --border: rgba(232,224,212,0.10);
  --border-strong: rgba(232,224,212,0.18);
  --vermilion: #e07060;
  --vermilion-faint: rgba(224,112,96,0.18);
  --nav-bg: rgba(28,26,22,0.94);
  --card-bg: rgba(37,35,32,0.7);
  --hover-bg: rgba(232,224,212,0.08);
  --shadow: rgba(0,0,0,0.3);
  --svg-fill: #e8e0d4;
  --svg-circle: #a07860;
}

/* ===== Body ===== */
body {
  font-family: 'Noto Serif SC','STSong','SimSun','Georgia',serif;
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
  transition: background 0.4s, color 0.4s;
}

/* ===== Top Navigation ===== */
.top-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  background: var(--nav-bg);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 0.5px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 24px;
  font-family: 'Noto Sans SC',system-ui,sans-serif;
  transition: background 0.4s;
}
.nav-left { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.nav-tools { flex: 1; justify-content: flex-end; }
.nav-home, .nav-back {
  font-size: 13px; letter-spacing: 0.1em; color: var(--muted);
  text-decoration: none; display: flex; align-items: center; gap: 6px;
  transition: color 0.2s;
  font-family: 'Noto Sans SC',system-ui,sans-serif;
}
.nav-home:hover, .nav-back:hover { color: var(--vermilion); }
.nav-current { opacity: 0.35; pointer-events: none; }
.nav-logo { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.nav-logo svg { width: 28px; height: 28px; }
.nav-logo svg circle { stroke: var(--svg-circle); }
.nav-logo svg line { stroke: var(--svg-fill); }
.nav-logo svg line:nth-child(4),
.nav-logo svg line:nth-child(5) { stroke: var(--vermilion); }
.nav-logo:hover svg { opacity: 0.7; }
.nav-tools { display: flex; align-items: center; gap: 4px; }
.nav-btn {
  width: 32px; height: 32px; border: none; background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; border-radius: 6px;
  color: var(--muted); transition: background 0.2s, color 0.2s;
}
.nav-btn:hover { background: var(--hover-bg); color: var(--ink); }
.nav-btn svg { width: 18px; height: 18px; }

/* ===== Account Dropdown ===== */
.nav-account { position: relative; }
.account-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; width: 200px;
  background: var(--bg); border: 0.5px solid var(--border-strong);
  border-radius: 6px; box-shadow: 0 4px 20px var(--shadow);
  opacity: 0; transform: translateY(-4px); pointer-events: none;
  transition: opacity 0.25s, transform 0.25s; z-index: 210;
}
.account-dropdown.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.dropdown-header {
  padding: 12px 16px; border-bottom: 0.5px solid var(--border);
  font-size: 11px; letter-spacing: 0.1em; color: var(--faint);
}
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; font-size: 12px; letter-spacing: 0.06em;
  color: var(--ink-light); cursor: pointer;
  transition: background 0.15s, color 0.15s; text-decoration: none;
}
.dropdown-item:hover { background: var(--hover-bg); color: var(--vermilion); }
.dropdown-item svg { width: 16px; height: 16px; color: var(--faint); flex-shrink: 0; }
.dropdown-item:hover svg { color: var(--vermilion); }
.dropdown-item.disabled { color: var(--ghost); cursor: default; }
.dropdown-item.disabled:hover { background: none; color: var(--ghost); }
.dropdown-item.disabled svg { color: var(--whisper); }
.dropdown-divider { height: 0.5px; background: var(--border); margin: 4px 0; }

/* Login form inside account dropdown */
.login-form {
  padding: 12px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.login-input {
  width: 100%; padding: 8px 10px;
  border: 0.5px solid var(--border-strong); border-radius: 3px;
  background: var(--card-bg); color: var(--ink);
  font-family: 'Noto Serif SC', serif; font-size: 12px;
  outline: none; transition: border-color 0.2s;
}
.login-input:focus { border-color: var(--vermilion); }
.login-input::placeholder { color: var(--ghost); }
.login-row { display: flex; gap: 6px; }
.login-btn {
  flex: 1; padding: 7px 0; border: none; border-radius: 3px;
  background: var(--ink); color: var(--bg); cursor: pointer;
  font-family: 'Noto Sans SC', system-ui, sans-serif;
  font-size: 11px; letter-spacing: 0.12em;
  transition: background 0.2s;
}
.login-btn:hover { background: var(--ink-light); }
.login-cancel {
  flex: 1; padding: 7px 0; border: 0.5px solid var(--border); border-radius: 3px;
  background: none; color: var(--muted); cursor: pointer;
  font-family: 'Noto Sans SC', system-ui, sans-serif;
  font-size: 11px; letter-spacing: 0.12em;
  transition: background 0.2s, color 0.2s;
}
.login-cancel:hover { background: var(--hover-bg); color: var(--ink); }
.login-error {
  font-size: 10px; color: var(--vermilion); letter-spacing: 0.08em;
  opacity: 0; transition: opacity 0.3s; height: 14px;
  font-family: 'Noto Sans SC', system-ui, sans-serif;
}
.login-error.show { opacity: 1; }

/* ===== Admin Panel ===== */
.admin-panel {
  position: fixed; top: 52px; right: 0; bottom: 0; width: 300px;
  background: var(--bg); border-left: 0.5px solid var(--border-strong);
  z-index: 95; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.3s ease;
  box-shadow: -4px 0 20px var(--shadow);
}
.admin-panel.open { transform: translateX(0); }
.admin-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 0.5px solid var(--border); flex-shrink: 0;
}
.admin-header-title {
  font-size: 13px; letter-spacing: 0.12em; color: var(--ink);
  font-family: 'Noto Sans SC',system-ui,sans-serif; font-weight: 600;
}
.admin-close {
  width: 28px; height: 28px; border: none; background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; border-radius: 4px;
  color: var(--muted); transition: background 0.2s, color 0.2s;
}
.admin-close:hover { background: var(--hover-bg); color: var(--vermilion); }
.admin-close svg { width: 16px; height: 16px; }
.admin-body { flex: 1; overflow-y: auto; padding: 16px; }
.section-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.section-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: 4px; cursor: pointer; transition: background 0.15s;
}
.section-item:hover { background: var(--hover-bg); }
.section-item-id {
  font-size: 10px; font-weight: 600; color: var(--vermilion);
  font-family: 'Cascadia Code','Fira Code','Consolas',monospace;
  background: var(--vermilion-faint); padding: 2px 6px; border-radius: 3px;
  white-space: nowrap;
}
.section-item-name {
  font-size: 11px; color: var(--ink-light); letter-spacing: 0.04em;
}
.section-badge {
  position: absolute; top: 4px; right: 4px; z-index: 100;
  font-size: 9px; font-weight: 700; color: #fff;
  background: var(--vermilion); padding: 2px 6px; border-radius: 3px;
  font-family: 'Cascadia Code','Fira Code','Consolas',monospace;
  letter-spacing: 0.05em; pointer-events: none; opacity: 0.85;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}


/* ===== Footer ===== */
.site-footer {
  background: var(--bg-alt); padding: 20px 32px;
  border-top: 0.5px solid var(--border);
  font-size: 9px; letter-spacing: 0.14em; color: var(--ghost);
  font-family: 'Noto Sans SC',system-ui,sans-serif; transition: background 0.4s;
}
.footer-row {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 960px; margin: 0 auto; gap: 12px; flex-wrap: wrap;
}
.footer-left { display: flex; align-items: center; gap: 6px; }
.footer-right { display: flex; align-items: center; gap: 6px; }
.footer-sep { color: var(--whisper); }
.site-footer a { color: var(--ghost); text-decoration: none; transition: color 0.2s; display: inline-flex; }
.site-footer a:hover { color: var(--muted); }
.site-footer a svg { width: 14px; height: 14px; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(26,26,26,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(26,26,26,0.2); }

/* ===== Fade-in Animation ===== */
.fade-in {
  opacity: 0; transform: translateY(24px);
  transition: opacity 0.8s cubic-bezier(0.25,0.46,0.45,0.94),
    transform 0.8s cubic-bezier(0.25,0.46,0.45,0.94);
}
.fade-in.visible { opacity: 1; transform: translateY(0); }
.fade-in.d1 { transition-delay: 0.1s; }
.fade-in.d2 { transition-delay: 0.25s; }
.fade-in.d3 { transition-delay: 0.4s; }
.fade-in.d4 { transition-delay: 0.55s; }
.fade-in.d5 { transition-delay: 0.7s; }

/* ===== Responsive: Footer ===== */
@media (max-width: 768px) {
  .nav-left { gap: 8px; }
  .nav-home, .nav-back { font-size: 12px; letter-spacing: 0.04em; }
  .footer-row { flex-direction: column; align-items: center; text-align: center; gap: 6px; }
  .footer-left, .footer-right { justify-content: center; flex-wrap: wrap; }
}
