/* ============================================================
   Grant Cropper — Design Tokens & Global Styles
   Navy / Steel Blue / Gold — Professional + Aviation
   ============================================================ */

:root {
  --navy:       #0d1b2a;
  --navy-mid:   #1b2838;
  --steel:      #415a77;
  --steel-light:#778da9;
  --gold:       #c9a84c;
  --gold-light: #e0c872;
  --gold-dark:  #a88a30;
  --cream:      #f5f1e8;
  --white:      #ffffff;
  --red:        #c0392b;
  --green:      #27ae60;
  --text:       #e0e0e0;
  --text-muted: #8899aa;
  --radius:     8px;
  --shadow:     0 4px 24px rgba(0,0,0,0.3);
  --transition: 0.3s ease;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--navy);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--gold); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--gold-light); }

/* ── HEADER ─────────────────────────────────────── */
.site-header {
  background: var(--navy-mid);
  border-bottom: 1px solid rgba(201,168,76,0.2);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-header .logo {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.5px;
}
.site-header nav a {
  color: var(--steel-light);
  margin-left: 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
}
.site-header nav a:hover { color: var(--gold); }

/* ── HUB WHEEL ──────────────────────────────────── */
.hub-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem 2rem;
  min-height: 70vh;
}

.hub-title {
  font-size: 1.8rem;
  color: var(--cream);
  margin-bottom: 0.5rem;
  font-weight: 300;
  text-align: center;
}
.hub-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 3rem;
  text-align: center;
}

.wheel-container {
  position: relative;
  width: 540px;
  height: 540px;
}

/* Center hub */
.wheel-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: var(--navy-mid);
  border: 3px solid var(--gold);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 10;
  box-shadow: 0 0 30px rgba(201,168,76,0.15);
}
.wheel-center .hub-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1.2;
}
.wheel-center .hub-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Connector lines */
.wheel-connector {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120px;
  height: 2px;
  background: linear-gradient(90deg, var(--gold) 0%, var(--steel) 100%);
  transform-origin: 0 50%;
  opacity: 0.4;
  z-index: 1;
}

/* Spoke nodes */
.spoke-node {
  position: absolute;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: var(--navy-mid);
  border: 2px solid var(--steel);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  z-index: 5;
  text-decoration: none;
}
.spoke-node:hover {
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(201,168,76,0.25);
  transform: scale(1.08);
}
.spoke-node .spoke-icon {
  font-size: 2rem;
  margin-bottom: 6px;
}
.spoke-node .spoke-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--cream);
  line-height: 1.2;
}
.spoke-node .spoke-status {
  font-size: 0.65rem;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}
.spoke-status.live     { background: var(--green); color: #fff; }
.spoke-status.building { background: #e67e22; color: #fff; }
.spoke-status.planned  { background: var(--steel); color: var(--cream); }

/* ── SPOKE PAGES ────────────────────────────────── */
.spoke-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem;
}
.spoke-page h1 {
  font-size: 1.8rem;
  color: var(--gold);
  margin-bottom: 0.5rem;
}
.spoke-page .spoke-desc {
  color: var(--text-muted);
  margin-bottom: 2rem;
}
.back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  color: var(--steel-light);
  font-size: 0.9rem;
}
.back-link:hover { color: var(--gold); }

/* ── UPLOAD ZONE ────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--steel);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  background: rgba(65,90,119,0.08);
  transition: all var(--transition);
  cursor: pointer;
  margin-bottom: 2rem;
}
.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--gold);
  background: rgba(201,168,76,0.06);
}
.upload-zone .upload-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}
.upload-zone p {
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.upload-zone .formats {
  font-size: 0.8rem;
  color: var(--steel-light);
}

/* ── CARDS / PANELS ─────────────────────────────── */
.card {
  background: var(--navy-mid);
  border: 1px solid rgba(65,90,119,0.3);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.card h3 {
  color: var(--gold);
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

/* ── BUTTONS ────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
}
.btn-gold {
  background: var(--gold);
  color: var(--navy);
}
.btn-gold:hover { background: var(--gold-light); }
.btn-steel {
  background: var(--steel);
  color: var(--cream);
}
.btn-steel:hover { background: var(--steel-light); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--steel);
  color: var(--cream);
}
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }
.btn-sm { padding: 0.35rem 0.9rem; font-size: 0.8rem; }
.btn-approve { background: var(--green); color: #fff; }
.btn-approve:hover { opacity: 0.9; }
.btn-deny { background: var(--red); color: #fff; }
.btn-deny:hover { opacity: 0.9; }

/* ── KB ENTRIES LIST ────────────────────────────── */
.kb-list { list-style: none; }
.kb-entry {
  background: var(--navy-mid);
  border: 1px solid rgba(65,90,119,0.3);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin-bottom: 0.75rem;
  transition: border-color var(--transition);
}
.kb-entry:hover { border-color: var(--steel-light); }
.kb-entry .kb-q {
  font-weight: 600;
  color: var(--cream);
  margin-bottom: 0.4rem;
}
.kb-entry .kb-a {
  color: var(--text-muted);
  font-size: 0.9rem;
}
.kb-entry .kb-meta {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--steel-light);
}
.kb-entry.pending {
  border-left: 3px solid #e67e22;
}
.kb-entry.approved {
  border-left: 3px solid var(--green);
}

/* ── UPLOAD QUEUE ───────────────────────────────── */
.upload-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--navy-mid);
  border: 1px solid rgba(65,90,119,0.3);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}
.upload-item .file-icon { font-size: 1.5rem; }
.upload-item .file-info { flex: 1; }
.upload-item .file-name { font-size: 0.9rem; color: var(--cream); }
.upload-item .file-status { font-size: 0.75rem; color: var(--text-muted); }
.progress-bar {
  height: 4px;
  background: var(--steel);
  border-radius: 2px;
  margin-top: 4px;
  overflow: hidden;
}
.progress-bar .fill {
  height: 100%;
  background: var(--gold);
  border-radius: 2px;
  transition: width 0.3s;
}

/* ── TABS ───────────────────────────────────────── */
.tab-bar {
  display: flex;
  border-bottom: 1px solid rgba(65,90,119,0.3);
  margin-bottom: 1.5rem;
}
.tab-bar button {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 0.75rem 1.2rem;
  font-size: 0.9rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}
.tab-bar button:hover { color: var(--cream); }
.tab-bar button.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* ── CATEGORY PILLS ─────────────────────────────── */
.cat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.cat-pill {
  padding: 0.35rem 0.9rem;
  border-radius: 20px;
  font-size: 0.8rem;
  border: 1px solid var(--steel);
  color: var(--cream);
  cursor: pointer;
  background: transparent;
  transition: all var(--transition);
}
.cat-pill:hover,
.cat-pill.active {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(201,168,76,0.08);
}

/* ── KB APPROVAL PANEL (below chat) ─────────────── */
.approval-panel {
  background: var(--navy-mid);
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin-top: 0.5rem;
}
.approval-panel h4 {
  color: var(--gold);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}
.approval-panel .proposed-entry {
  background: rgba(65,90,119,0.15);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-bottom: 0.75rem;
}
.approval-panel .proposed-q {
  font-weight: 600;
  color: var(--cream);
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
}
.approval-panel .proposed-a {
  color: var(--text-muted);
  font-size: 0.8rem;
}
.approval-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* ── SEARCH BAR ─────────────────────────────────── */
.search-bar {
  position: relative;
  margin-bottom: 1.5rem;
}
.search-bar input {
  width: 100%;
  padding: 0.7rem 1rem 0.7rem 2.5rem;
  background: var(--navy-mid);
  border: 1px solid var(--steel);
  border-radius: var(--radius);
  color: var(--cream);
  font-size: 0.9rem;
}
.search-bar input:focus {
  outline: none;
  border-color: var(--gold);
}
.search-bar::before {
  content: '🔍';
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
}

/* ── STATS ROW ──────────────────────────────────── */
.stats-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  flex: 1;
  background: var(--navy-mid);
  border: 1px solid rgba(65,90,119,0.3);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}
.stat-card .stat-num {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--gold);
}
.stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── UPLOAD PHASE INDICATORS ───────────────────── */
.upload-phases {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.5rem;
}
.upload-phase {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: color 0.3s;
}
.upload-phase.active {
  color: var(--gold);
  font-weight: 600;
}
.upload-phase.done {
  color: var(--green);
}
.upload-phase.failed {
  color: var(--red);
}
.upload-phase .phase-icon {
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}

/* Pulsing dot for active processing phase */
.pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  animation: pulseDot 1.4s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* Indeterminate progress bar (animated stripes) */
.progress-bar.indeterminate .fill {
  width: 100% !important;
  background: repeating-linear-gradient(
    -45deg,
    var(--gold),
    var(--gold) 10px,
    var(--gold-dark) 10px,
    var(--gold-dark) 20px
  );
  background-size: 28px 100%;
  animation: barberpole 0.8s linear infinite;
}
@keyframes barberpole {
  0% { background-position: 0 0; }
  100% { background-position: 28px 0; }
}

/* Upload result section */
.upload-result {
  margin-top: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: rgba(39,174,96,0.08);
  border: 1px solid rgba(39,174,96,0.2);
  border-radius: var(--radius);
}
.upload-result .result-count {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--green);
}
.upload-result .result-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.upload-result .result-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.4rem;
}
.upload-result .result-actions a,
.upload-result .result-actions button {
  font-size: 0.75rem;
  color: var(--gold);
  background: none;
  border: 1px solid var(--gold);
  border-radius: 4px;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}
.upload-result .result-actions a:hover,
.upload-result .result-actions button:hover {
  background: var(--gold);
  color: var(--navy);
}

/* Transcription modal */
.transcript-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.transcript-overlay.open {
  display: flex;
}
.transcript-modal {
  background: var(--navy-mid);
  border: 1px solid var(--steel);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 90%;
  max-width: 650px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.transcript-modal h3 {
  color: var(--gold);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.transcript-modal .close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}
.transcript-modal .close-btn:hover { color: var(--cream); }
.transcript-modal .transcript-body {
  flex: 1;
  overflow-y: auto;
  font-size: 0.85rem;
  color: var(--cream);
  line-height: 1.7;
  white-space: pre-wrap;
  padding: 0.75rem;
  background: var(--navy);
  border-radius: 4px;
  border: 1px solid rgba(65,90,119,0.3);
}

/* Extracted entries list in upload result */
.extracted-entries {
  margin-top: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
}
.extracted-entry {
  padding: 0.4rem 0.6rem;
  margin-bottom: 0.3rem;
  background: rgba(65,90,119,0.15);
  border-radius: 4px;
  font-size: 0.75rem;
}
.extracted-entry .eq {
  color: var(--cream);
  font-weight: 600;
}
.extracted-entry .ea {
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* ── RESPONSIVE ─────────────────────────────────── */
@media (max-width: 600px) {
  .wheel-container {
    width: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
  }
  .wheel-center {
    position: static;
    transform: none;
    margin-bottom: 1rem;
  }
  .spoke-node {
    position: static;
    width: 100%;
    max-width: 280px;
    height: auto;
    border-radius: var(--radius);
    padding: 1.2rem;
    flex-direction: row;
    gap: 1rem;
    justify-content: flex-start;
  }
  .spoke-node .spoke-icon { font-size: 1.5rem; margin-bottom: 0; }
  .wheel-connector { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .stats-row { flex-direction: column; }
  .hub-section { padding: 2rem 1rem; }
}
