/* ============================================================
   Obul GEO Tracker — Dark Theme
   ============================================================ */

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

:root {
  --bg:       #0f1117;
  --card:     #1a1d26;
  --border:   #2a2d3a;
  --accent:   #00c9a7;
  --accent2:  #007aff;
  --text:     #e4e6ef;
  --muted:    #7a7f99;
  --danger:   #ff4d6d;
  --success:  #00c9a7;
  --warn:     #ffb627;
  --radius:   10px;
}

html { font-size: 16px; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* ── Layout ── */

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* ── Header ── */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1.75rem;
}

.header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

.header h1 span { color: var(--accent); }

.last-run {
  font-size: .8rem;
  color: var(--muted);
}

/* ── Section titles ── */

.section-title {
  font-size: .85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: .75rem;
}

/* ── Summary cards ── */

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .75rem;
  margin-bottom: 1.5rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}

.card-label {
  font-size: .75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .25rem;
}

.card-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
}

.card-sub {
  font-size: .75rem;
  color: var(--muted);
  margin-top: .2rem;
}

.card-sub.up   { color: var(--success); }
.card-sub.down { color: var(--danger); }

/* ── Model status card ── */

.model-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  grid-column: span 2;
}

@media (max-width: 600px) { .model-card { grid-column: span 1; } }

.model-list {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin-top: .5rem;
}

.model-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
}

.model-icon { font-size: 1rem; line-height: 1; }
.model-name { flex: 1; }
.model-pct  { color: var(--muted); font-size: .78rem; }

/* ── Chart section ── */

.chart-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1rem;
}

.btn-group {
  display: flex;
  gap: .25rem;
}

.btn {
  background: var(--border);
  border: none;
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  font-size: .78rem;
  font-weight: 500;
  padding: .25rem .6rem;
  transition: background .15s, color .15s;
}

.btn:hover  { background: #3a3d4a; }
.btn.active { background: var(--accent); color: #0f1117; }

.chart-wrap {
  position: relative;
  height: 220px;
}

/* ── Heatmap ── */

.heatmap-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.heatmap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
  white-space: nowrap;
}

.heatmap-table th {
  color: var(--muted);
  font-weight: 600;
  text-align: center;
  padding: .4rem .6rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-size: .72rem;
}

.heatmap-table th:first-child {
  text-align: left;
  min-width: 240px;
  max-width: 340px;
}

.heatmap-table td {
  text-align: center;
  padding: .35rem .6rem;
  border-top: 1px solid var(--border);
}

.heatmap-table td:first-child {
  text-align: left;
  color: var(--muted);
  font-size: .78rem;
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.heatmap-table tr:hover td { background: rgba(255,255,255,.03); }

.cell-yes { color: var(--success); font-size: 1rem; }
.cell-no  { color: var(--border);  font-size: 1rem; }

/* ── Prompts editor ── */

.prompts-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.prompts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1rem;
}

.btn-add {
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: #0f1117;
  cursor: pointer;
  font-size: .8rem;
  font-weight: 600;
  padding: .35rem .75rem;
  transition: opacity .15s;
}

.btn-add:hover { opacity: .85; }

.prompt-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.prompt-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .6rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  transition: border-color .15s;
}

.prompt-row:hover { border-color: #3a3d50; }

.prompt-badge {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  border-radius: 4px;
  padding: .15rem .4rem;
  flex-shrink: 0;
}

.badge-awareness    { background: rgba(0,201,167,.15); color: var(--accent); }
.badge-consideration{ background: rgba(0,122,255,.15); color: var(--accent2); }
.badge-decision     { background: rgba(255,182,39,.15); color: var(--warn); }

.prompt-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: .85rem;
  font-family: inherit;
  outline: none;
  min-width: 0;
}

.prompt-input:focus {
  border-bottom: 1px solid var(--accent);
}

.toggle-btn {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .04em;
  padding: .2rem .55rem;
  transition: border-color .15s, color .15s;
  flex-shrink: 0;
  color: var(--muted);
}

.toggle-btn.active {
  border-color: var(--accent);
  color: var(--accent);
}

.edit-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: .85rem;
  padding: .15rem .35rem;
  border-radius: 4px;
  transition: color .15s;
  flex-shrink: 0;
}

.edit-btn:hover { color: var(--text); }

.save-btn {
  background: var(--accent);
  border: none;
  border-radius: 5px;
  color: #0f1117;
  cursor: pointer;
  font-size: .75rem;
  font-weight: 600;
  padding: .2rem .5rem;
  transition: opacity .15s;
  flex-shrink: 0;
}

.save-btn:hover { opacity: .85; }

/* ── Empty / loading states ── */

.empty {
  text-align: center;
  color: var(--muted);
  padding: 2rem;
  font-size: .9rem;
}

.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, #2e3146 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 4px;
  height: 1rem;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Scrollbar ── */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Mobile ── */

@media (max-width: 600px) {
  .header h1 { font-size: 1.1rem; }
  .card-value { font-size: 1.6rem; }
  .chart-wrap { height: 180px; }
  .heatmap-table th:first-child { min-width: 140px; }
}
