@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Light mode ── */
:root {
  --teal: #0ea5e9;
  --teal-dark: #0284c7;
  --teal-light: #e0f2fe;
  --accent: #f59e0b;
  --text: #0f172a;
  --text-light: #64748b;
  --border: rgba(15,23,42,0.09);
  --bg: #f0f4f8;
  --white: #ffffff;
  --header-h: #0ea5e9;
  --row-hover: rgba(14,165,233,0.05);
  --search-bg: #ffffff;
  --shadow: rgba(15,23,42,0.08);
  --header-gradient: linear-gradient(135deg, #0f172a 0%, #1e3a5f 55%, #075985 100%);
  --nav-bg: #0c1a32;
  --card-border: rgba(14,165,233,0.15);
  --th-gradient: linear-gradient(90deg, #0284c7 0%, #0ea5e9 100%);
}

/* ── Dark mode ── */
[data-theme="dark"] {
  --teal: #38bdf8;
  --teal-dark: #0ea5e9;
  --teal-light: rgba(56,189,248,0.1);
  --accent: #fbbf24;
  --text: #e2e8f0;
  --text-light: #94a3b8;
  --border: rgba(255,255,255,0.07);
  --bg: #070d1a;
  --white: rgba(15,25,50,0.8);
  --header-h: rgba(14,165,233,0.15);
  --row-hover: rgba(56,189,248,0.06);
  --search-bg: rgba(255,255,255,0.05);
  --shadow: rgba(0,0,0,0.5);
  --header-gradient: linear-gradient(135deg, #020617 0%, #0c1a3a 55%, #0c3461 100%);
  --nav-bg: rgba(2,6,23,0.95);
  --card-border: rgba(56,189,248,0.12);
  --th-gradient: linear-gradient(90deg, #0c3461 0%, rgba(14,165,233,0.3) 100%);
}

/* ── Base ── */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.25s, color 0.25s;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Header ── */
#site-header {
  background: var(--header-gradient);
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 60px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.06), 0 4px 24px rgba(0,0,0,0.35);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

/* subtle shimmer line at bottom of header */
#site-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(56,189,248,0.6), transparent);
}

#site-header img { height: 34px; filter: brightness(1.1); }
#site-header h1 {
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
#site-header .spacer { flex: 1; }

/* ── Dark mode toggle ── */
#dark-toggle {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.9);
  width: 36px; height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
  flex-shrink: 0;
  backdrop-filter: blur(4px);
}
#dark-toggle:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.5);
  transform: scale(1.08);
}

/* ── Admin link ── */
#admin-link {
  color: rgba(255,255,255,0.75);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  padding: 6px 14px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 20px;
  transition: all 0.2s;
  white-space: nowrap;
  letter-spacing: 0.02em;
  backdrop-filter: blur(4px);
  background: rgba(255,255,255,0.06);
}
#admin-link:hover {
  color: #fff;
  border-color: rgba(56,189,248,0.7);
  background: rgba(56,189,248,0.12);
}

/* ── Login button ── */
#login-btn {
  background: rgba(14,165,233,0.15);
  border: 1px solid rgba(14,165,233,0.4);
  color: rgba(255,255,255,0.9);
  padding: 6px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  letter-spacing: 0.02em;
  transition: all 0.2s;
  backdrop-filter: blur(4px);
  font-family: inherit;
}
#login-btn:hover {
  background: rgba(14,165,233,0.3);
  border-color: rgba(56,189,248,0.8);
  color: #fff;
}

/* ── Nav ── */
#site-nav {
  background: var(--nav-bg);
  display: flex;
  padding: 0 28px;
  flex-shrink: 0;
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  backdrop-filter: blur(12px);
  position: relative;
  z-index: 9;
}

#site-nav .nav-tab {
  display: inline-block;
  color: rgba(255,255,255,0.55);
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.01em;
  position: relative;
}
#site-nav .nav-tab:hover { color: rgba(255,255,255,0.85); }
#site-nav .nav-tab.active {
  color: #fff;
  border-bottom-color: #38bdf8;
}

/* ── Main content ── */
#content {
  flex: 1;
  padding: 28px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* ── Search bar ── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  background: var(--search-bg);
  border: 1px solid var(--card-border);
  border-radius: 50px;
  padding: 10px 20px;
  box-shadow: 0 2px 12px var(--shadow);
  transition: box-shadow 0.2s, border-color 0.2s;
  backdrop-filter: blur(8px);
}
.search-bar:focus-within {
  box-shadow: 0 0 0 3px rgba(56,189,248,0.18), 0 2px 12px var(--shadow);
  border-color: var(--teal);
}
.search-bar .search-icon { color: var(--text-light); font-size: 16px; flex-shrink: 0; }
.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  font-family: inherit;
  background: transparent;
  color: var(--text);
  min-width: 0;
}
.search-bar input::placeholder { color: var(--text-light); }
.search-bar .search-clear {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  color: var(--text-light);
  padding: 0 2px;
  line-height: 1;
  transition: color 0.15s;
}
.search-bar .search-clear:hover { color: var(--text); }
.search-count {
  font-size: 12px;
  color: var(--text-light);
  white-space: nowrap;
  min-width: 70px;
  text-align: right;
}
.no-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
  font-size: 14px;
}

/* ── Section block ── */
.section-block { margin-bottom: 20px; }

.section-block table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 16px var(--shadow);
  border: 1px solid var(--card-border);
  transition: background 0.25s;
}

.section-block th {
  background: var(--th-gradient);
  color: #fff;
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

[data-theme="dark"] .section-block th {
  color: rgba(255,255,255,0.85);
  border-bottom: 1px solid rgba(56,189,248,0.2);
}

.section-block td {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  transition: background 0.12s;
  font-size: 13.5px;
}
.section-block tr:last-child td { border-bottom: none; }
.section-block tr:hover td { background: var(--row-hover); }

.section-block td a {
  color: var(--teal);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s, opacity 0.15s;
}
.section-block td a:hover {
  color: var(--teal-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

[data-theme="dark"] .section-block td a { color: #38bdf8; }
[data-theme="dark"] .section-block td a:hover { color: #7dd3fc; }

.section-block td.empty-cell { color: var(--text-light); }

/* highlight matched text */
mark {
  background: rgba(245,158,11,0.22);
  color: inherit;
  border-radius: 3px;
  padding: 0 2px;
}
[data-theme="dark"] mark { background: rgba(251,191,36,0.28); }

/* ── Login overlay ── */
#login-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(2,6,23,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 900;
  align-items: center;
  justify-content: center;
}
#login-overlay.open { display: flex; }

.login-box {
  background: var(--white);
  border-radius: 20px;
  padding: 36px 40px;
  width: 360px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.4), 0 0 0 1px var(--card-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

[data-theme="dark"] .login-box {
  background: rgba(10,18,40,0.95);
  box-shadow: 0 24px 64px rgba(0,0,0,0.6), 0 0 0 1px rgba(56,189,248,0.15);
}

.login-box h2 {
  margin-bottom: 24px;
  color: var(--teal);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.login-box label {
  display: block;
  margin-bottom: 5px;
  font-size: 11px;
  color: var(--text-light);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.login-box input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  margin-bottom: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--bg);
  color: var(--text);
}
.login-box input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(14,165,233,0.15);
}
[data-theme="dark"] .login-box input {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
  color: var(--text);
}
[data-theme="dark"] .login-box input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56,189,248,0.15);
}

.login-box button.btn-primary {
  width: 100%;
  padding: 11px;
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.01em;
  transition: opacity 0.2s, transform 0.15s;
  box-shadow: 0 4px 14px rgba(14,165,233,0.35);
}
.login-box button.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}
.login-box .error { color: #f87171; font-size: 12px; margin-top: 8px; }

.google-btn {
  width: 100%;
  margin-top: 10px;
  padding: 11px;
  background: #4285f4;
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  transition: opacity 0.2s, transform 0.15s;
  box-shadow: 0 4px 14px rgba(66,133,244,0.3);
}
.google-btn:hover { opacity: 0.9; transform: translateY(-1px); }

.divider { text-align: center; color: var(--text-light); font-size: 12px; margin: 14px 0; }

/* ── Toast ── */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: linear-gradient(135deg, #059669, #10b981);
  color: #fff;
  padding: 11px 20px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  transition: all 0.22s cubic-bezier(0.34,1.56,0.64,1);
  pointer-events: none;
  z-index: 999;
  box-shadow: 0 8px 24px rgba(16,185,129,0.3);
}
#toast.show { opacity: 1; transform: translateY(0) scale(1); }
#toast.error {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  box-shadow: 0 8px 24px rgba(239,68,68,0.3);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  #content { padding: 14px; }
  #site-nav .nav-tab { padding: 10px 12px; font-size: 12px; }
  .section-block table { font-size: 12px; }
  .section-block th, .section-block td { padding: 7px 10px; }
  #site-header { padding: 0 16px; gap: 10px; }
  #site-header h1 { font-size: 15px; }
  .login-box { width: calc(100vw - 32px); padding: 28px 24px; }
}
