/* ── URAAS Design System v2.1 — Premium Glassmorphism ── */
:root {
  --bg: #0a0f1a;
  --bg2: #111827;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.07);
  --text: #f1f5f9;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --scrollbar: #1e293b;
  --input-bg: #0f172a;
  --input-border: #1e293b;
  --modal-bg: #0f172a;
  --terminal-bg: #050a12;
  --terminal-text: #4ade80;
  --tree-border: rgba(59, 130, 246, 0.15);
  --badge-idle-bg: #1e293b;
  --badge-idle-text: #64748b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
  --glass: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] {
  --bg: #f8fafc;
  --bg2: #ffffff;
  --surface: rgba(255, 255, 255, 0.95);
  --surface-hover: #ffffff;
  --border: rgba(0, 0, 0, 0.08);
  --text: #0f172a;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --scrollbar: #e2e8f0;
  --input-bg: #ffffff;
  --input-border: #e2e8f0;
  --modal-bg: #ffffff;
  --terminal-bg: #1e293b;
  --terminal-text: #4ade80;
  --tree-border: rgba(37, 99, 235, 0.15);
  --badge-idle-bg: #f1f5f9;
  --badge-idle-text: #64748b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
  --glass: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
  font-size: 14px;
  line-height: 1.6;
}

h1, h2, h3 {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}

/* Surface & Glassmorphism */
.surface {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.surface:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.header-glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-md);
}

/* Labels */
.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
  display: block;
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent) 0%, #60a5fa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}

/* Buttons */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-danger:hover {
  background: #dc2626;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.08);
}

/* Tabs */
.tab-btn {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  border: none;
  background: transparent;
  white-space: nowrap;
}

.tab-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.tab-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Inputs */
input, select, textarea {
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  width: 100%;
  transition: all 0.2s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
  background: var(--bg2);
}

/* Stat card */
.stat-card {
  border-radius: 16px;
  padding: 20px;
}

/* Chip */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-dim);
  font-weight: 600;
}

.chip:hover, .chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.25);
}

/* Badges */
.badge-oa {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.2);
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
}

.badge-restricted {
  background: rgba(148, 163, 184, 0.1);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.2);
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
}

.badge-docid {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent);
  border: 1px solid rgba(59, 130, 246, 0.2);
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
}

/* Live indicator */
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: livePulse 2s infinite;
}

@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  70% { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Progress */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--input-bg);
  border-radius: 4px;
  overflow: hidden;
  display: none;
}

.progress-bar.active {
  display: block;
}

.progress-bar-inner {
  width: 35%;
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  animation: slide 1.5s infinite ease-in-out;
}

@keyframes slide {
  0% { margin-left: -35%; }
  100% { margin-left: 100%; }
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 200;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-overlay.open {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

/* Toast */
#toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: toastIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 360px;
  background: var(--modal-bg);
}

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Tree */
.tree-node {
  margin-left: 16px;
  border-left: 1px solid var(--tree-border);
  padding-left: 16px;
}

/* SDG Cards */
.sdg-card {
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.sdg-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Chart Wrapper */
.chart-wrapper {
  position: relative;
  overflow: hidden;
}

.chart-fullscreen-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.2s ease;
  z-index: 10;
}

.chart-wrapper:hover .chart-fullscreen-btn {
  opacity: 1;
}

.fs-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 300;
  flex-direction: column;
  padding: 48px;
}

.fs-overlay.open {
  display: flex;
}

/* UNILAG Colors */
.unilag-strip {
  height: 4px;
  background: linear-gradient(90deg, #003087 33.3%, #e8e8e8 33.3%, #e8e8e8 66.6%, #009739 66.6%);
}

/* Animations */
.animate-spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Accessibility */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
