/* ============================================================
   Global Economic Development Dashboard — Design System
   Premium dark theme with glassmorphism
   ============================================================ */

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

/* ─── RESET & BASE ─────────────────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #060a13;
  --bg-secondary: #0c1222;
  --bg-card: rgba(15, 23, 42, 0.7);
  --bg-card-hover: rgba(20, 30, 55, 0.85);
  --border-card: rgba(56, 78, 119, 0.3);
  --border-card-hover: rgba(99, 130, 190, 0.4);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-red: #ef4444;
  --accent-cyan: #06b6d4;
  --accent-amber: #f59e0b;
  --accent-green: #10b981;
  --accent-purple: #8b5cf6;
  --accent-pink: #ec4899;
  --accent-orange: #f97316;
  --accent-teal: #14b8a6;

  --glow-red: rgba(239, 68, 68, 0.15);
  --glow-cyan: rgba(6, 182, 212, 0.15);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3), 0 1px 4px rgba(0, 0, 0, 0.2);
  --shadow-glow: 0 0 30px rgba(6, 182, 212, 0.08);

  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  font-size: 16px;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ─── HEADER ───────────────────────────────────────────────── */
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: linear-gradient(180deg, rgba(12, 18, 34, 0.95) 0%, rgba(6, 10, 19, 0.9) 100%);
  border-bottom: 1px solid var(--border-card);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-logo {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.25);
}

.header-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header-title span {
  font-weight: 400;
  color: var(--text-secondary);
}

.live-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-green);
}

.live-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-green);
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
  box-shadow: 0 0 8px var(--accent-green);
}

@keyframes pulse-dot {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.5;
    transform: scale(0.85);
  }
}

/* ─── MAIN CONTENT ─────────────────────────────────────────── */
.dashboard-main {
  flex: 1;
  padding: 16px 24px 8px;
  overflow: hidden;
  min-height: 0;
  margin-bottom: 58px;
}

/* ─── SHEET PANELS ─────────────────────────────────────────── */
.sheet-panel {
  display: none;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
  flex-direction: column;
  height: 100%;
  min-height: 0;
  gap: 12px;
}

.sheet-panel.active {
  display: flex;
  opacity: 1;
  transform: translateY(0);
  animation: fadeSlideIn 0.4s ease forwards;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── GRID LAYOUTS ─────────────────────────────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-height: 0;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  min-height: 0;
}

.grid-kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  flex-shrink: 0;
}

.row-top {
  flex: 1;
  min-height: 0;
}

.row-bottom {
  flex: 1;
  min-height: 0;
}

/* ─── CARD ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.card:hover {
  border-color: var(--border-card-hover);
  box-shadow: var(--shadow-card), var(--shadow-glow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .icon {
  opacity: 0.7;
  display: inline-flex;
  align-items: center;
  color: var(--accent-cyan);
}

.card-title .icon svg {
  width: 16px;
  height: 16px;
}

.card-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ─── KPI CARDS ────────────────────────────────────────────── */
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 20px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.kpi-card:hover {
  border-color: var(--border-card-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-card), 0 0 20px rgba(6, 182, 212, 0.1);
}

.kpi-card:hover::before {
  opacity: 1;
}

.kpi-icon {
  margin-bottom: 10px;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
}

.kpi-icon svg {
  width: 24px;
  height: 24px;
}

.kpi-value {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.kpi-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 8px;
}

.kpi-change {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 100px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.kpi-change.up {
  color: var(--accent-green);
  background: rgba(16, 185, 129, 0.1);
}

.kpi-change.down {
  color: var(--accent-red);
  background: rgba(239, 68, 68, 0.1);
}

/* ─── CHART CONTAINER ──────────────────────────────────────── */
.chart-container {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
}

/* ─── PILL BUTTONS (chart filters) ─────────────────────────── */
.pill-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pill-btn {
  padding: 5px 14px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(51, 65, 85, 0.5);
  border-radius: 100px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: 'Inter', sans-serif;
}

.pill-btn:hover {
  background: rgba(51, 65, 85, 0.7);
  color: var(--text-primary);
}

.pill-btn.active {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.3);
}

/* ─── TAB BAR (Bottom Navigation) ──────────────────────────── */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: rgba(10, 15, 30, 0.92);
  border-top: 1px solid var(--border-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  height: 58px;
}

.tab-btn {
  flex: 1;
  max-width: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 8px 10px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  transition: all var(--transition-fast);
  border-radius: var(--radius-sm);
  position: relative;
}

.tab-btn:hover {
  color: var(--text-secondary);
  background: rgba(30, 41, 59, 0.3);
}

.tab-btn.active {
  color: var(--accent-cyan);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  top: -1px;
  left: 16px;
  right: 16px;
  height: 2px;
  background: var(--accent-cyan);
  border-radius: 0 0 2px 2px;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

.tab-icon {
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tab-icon svg {
  width: 18px;
  height: 18px;
}

.tab-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* ─── ABOUT PAGE ───────────────────────────────────────────── */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.about-section h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: 8px;
}

.about-icon {
  display: inline-flex;
  align-items: center;
}

.about-icon svg {
  width: 18px;
  height: 18px;
}

.about-section p,
.about-section li {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.about-section ul {
  list-style: none;
  padding: 0;
}

.about-section li {
  padding: 6px 0;
  border-bottom: 1px solid rgba(51, 65, 85, 0.3);
  display: flex;
  align-items: center;
  gap: 8px;
}

.about-section li::before {
  content: '→';
  color: var(--accent-cyan);
  font-weight: 600;
}

.stat-highlight {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.stat-box {
  text-align: center;
  padding: 16px;
  background: rgba(6, 182, 212, 0.05);
  border: 1px solid rgba(6, 182, 212, 0.15);
  border-radius: var(--radius-md);
}

.stat-box .stat-val {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

.stat-box .stat-lbl {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ─── SECTION TITLE ────────────────────────────────────────── */
.section-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border-card), transparent);
}

/* ─── SCROLLBAR ────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(51, 65, 85, 0.5);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(71, 85, 105, 0.7);
}

/* ─── ABOUT PAGE VIEWPORT FIT ─────────────────────────────── */
#sheet-about .about-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* ─── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .grid-3 {
    grid-template-columns: 1fr;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }

  .stat-highlight {
    grid-template-columns: repeat(2, 1fr);
  }

  body {
    overflow-y: auto;
  }

  .dashboard-main {
    overflow-y: auto;
  }
}

@media (max-width: 768px) {
  .dashboard-header {
    padding: 12px 16px;
  }

  .header-title {
    font-size: 1rem;
  }

  .live-badge {
    padding: 6px 12px;
    font-size: 0.65rem;
  }

  .dashboard-main {
    padding: 12px 16px 8px;
  }

  .grid-kpi {
    grid-template-columns: repeat(2, 1fr);
  }

  .kpi-value {
    font-size: 1.3rem;
  }

  .tab-btn {
    max-width: none;
  }

  .tab-label {
    font-size: 0.6rem;
  }

  .stat-highlight {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .grid-kpi {
    grid-template-columns: 1fr;
  }

  .header-title span {
    display: none;
  }

  .live-badge span {
    display: none;
  }
}