/* Shared design tokens + chrome used by index.html, reports.html, channel-status.html */

:root {
  --bg: #0f0f11;
  --surface: #18181b;
  --surface-elevated: #1e1e22;
  --surface-hover: #27272a;
  --border: #27272a;
  --border-focus: #3f3f46;
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent: #f59e0b;
  --accent-hover: #fbbf24;
  --accent-soft: rgba(245, 158, 11, 0.1);
  --success: #22c55e;
  --error: #ef4444;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  /* keeps content clear of the iOS home-indicator / gesture area */
  padding-bottom: env(safe-area-inset-bottom);
}

::placeholder { color: var(--text-muted); }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-focus); }

/* ── Announcements banner (admin-posted notices) ── */
#announcements-container {
  max-width: 680px; margin: 0 auto; padding: 0 20px;
  display: flex; flex-direction: column; gap: 10px;
  max-height: 0; overflow: hidden; opacity: 0;
  transition: max-height 0.4s ease, opacity 0.3s ease, margin-top 0.4s ease;
}
#announcements-container.show { max-height: 800px; opacity: 1; margin-top: 22px; margin-bottom: 22px; }

.announcement {
  display: flex; align-items: flex-start; gap: 12px;
  border-radius: var(--radius-md); padding: 14px 16px;
  border: 1px solid; animation: announceIn 0.3s ease;
}
.announcement.hide { animation: announceOut 0.25s ease forwards; }
@keyframes announceIn  { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes announceOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-4px); } }

.announcement-icon { font-size: 18px; line-height: 1; flex-shrink: 0; margin-top: 1px; }
.announcement-body { flex: 1; min-width: 0; }
.announcement-body strong { display: block; font-size: 13px; margin-bottom: 2px; }
.announcement-body p { font-size: 13.5px; color: var(--text-secondary); line-height: 1.5; margin: 0; }
.announcement-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 19px; cursor: pointer; line-height: 1; padding: 2px 4px; flex-shrink: 0;
}
.announcement-close:hover { color: var(--text-primary); }

.announcement-info     { background: rgba(129,140,248,0.06); border-color: rgba(129,140,248,0.25); }
.announcement-info strong     { color: #818cf8; }
.announcement-warning  { background: var(--accent-soft); border-color: rgba(245,158,11,0.3); }
.announcement-warning strong  { color: var(--accent); }
.announcement-critical { background: rgba(239,68,68,0.07); border-color: rgba(239,68,68,0.3); }
.announcement-critical strong { color: var(--error); }

/* ── Toast ── */
#toast-container {
  position: fixed; top: 24px; right: 24px;
  z-index: 1000; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 12px;
  min-width: 280px;
  animation: toastIn 0.25s ease;
  backdrop-filter: blur(12px);
  font-size: 14px;
}
.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--error); }
.toast-info    { border-left: 3px solid var(--accent); }
.toast.hide    { animation: toastOut 0.25s ease forwards; }
@keyframes toastIn  { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

/* ── Header / logo / nav (shared shell across all pages) ── */
.page-header {
  text-align: center; padding: 48px 24px 28px; position: relative;
}
.page-header::before {
  content: '';
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 600px; height: 200px;
  background: radial-gradient(ellipse at center, rgba(245,158,11,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.logo-wrapper {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px;
  background: var(--accent-soft);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: var(--radius-lg);
  margin-bottom: 20px; font-size: 24px;
  position: relative; overflow: hidden;
}
.logo-wrapper img { width: 100%; height: 100%; object-fit: contain; border-radius: var(--radius-md); position: relative; z-index: 1; }
.logo-wrapper::after {
  content: '';
  position: absolute; inset: -1px; border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(245,158,11,0.3), transparent 60%);
  z-index: 0;
}
.logo-wrapper .logo-emoji { position: relative; z-index: 1; }

.page-header h1, .page-header .page-title {
  font-size: clamp(22px, 4vw, 28px); font-weight: 800; letter-spacing: -0.03em; margin-bottom: 6px;
}
.page-header p, .page-header .page-sub { color: var(--text-muted); font-size: 14.5px; }

.site-nav { display: flex; justify-content: center; gap: 6px; margin-top: 24px; flex-wrap: wrap; }
.site-nav-link {
  padding: 8px 20px; border-radius: var(--radius-sm);
  color: var(--text-muted); text-decoration: none;
  font-size: 14px; font-weight: 500; transition: var(--transition); position: relative;
}
.site-nav-link:hover { color: var(--text-secondary); background: var(--surface); }
.site-nav-link.active {
  color: var(--text-primary);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
}
.site-nav-link.active::after {
  content: '';
  position: absolute; bottom: -1px; left: 20%; right: 20%;
  height: 2px; background: var(--accent); border-radius: 2px;
}
.site-nav-link.btn-primary { background: linear-gradient(135deg, var(--accent), #d97706); color: #000; font-weight: 700; }
.site-nav-link.btn-primary:hover { background: linear-gradient(135deg, var(--accent-hover), var(--accent)); color: #000; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600; font-family: inherit;
  cursor: pointer; border: none; transition: var(--transition); text-decoration: none;
  min-height: 44px;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #d97706);
  color: #000;
  box-shadow: 0 4px 14px rgba(245,158,11,0.3);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(245,158,11,0.4); filter: brightness(1.1); }
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary .spinner { border-color: rgba(0,0,0,0.2); border-top-color: #000; }

.btn-secondary {
  background: var(--surface-elevated); color: var(--text-primary); border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--border-focus); }

.btn-gold-outline {
  background: transparent; color: var(--accent); border: 1px solid rgba(245,158,11,0.3);
}
.btn-gold-outline:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent); }

.btn-lg { width: 100%; padding: 14px; font-size: 16px; }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 6px; min-height: 36px; }

/* ── Spinner ── */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Inline SVG icon helper (search, etc.) ── */
.icon-svg { width: 16px; height: 16px; display: block; flex-shrink: 0; }

@media (max-width: 640px) {
  .page-header { padding: 28px 16px 20px; }
}
@media (max-width: 400px) {
  #toast-container { top: 12px; left: 12px; right: 12px; }
  .toast { min-width: 0; }
}
