/* =================================================================
   HONDANA · Barra global de control + estética unificada
   Disponible en TODAS las páginas: Home, Idioma, Voz, Mic, Cámara
   ================================================================= */

:root {
  --hg-bg: rgba(12, 8, 4, 0.78);
  --hg-bg-strong: rgba(18, 12, 6, 0.92);
  --hg-border: rgba(212, 160, 74, 0.28);
  --hg-border-hover: rgba(244, 217, 138, 0.55);
  --hg-gold-1: #f4d98a;
  --hg-gold-2: #c69847;
  --hg-gold-3: #8c6a26;
  --hg-cream: #f7eccb;
  --hg-text: #e7d9a8;
  --hg-text-dim: rgba(231, 217, 168, 0.65);
}

/* ============== BARRA GLOBAL ============== */
.hg-bar {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--hg-bg);
  border: 1px solid var(--hg-border);
  border-radius: 999px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 0 1px rgba(244,217,138,0.05);
  font-family: 'Inter', -apple-system, sans-serif;
  pointer-events: auto;
}

.hg-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--hg-text);
  cursor: pointer;
  padding: 7px 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: all 200ms ease;
  white-space: nowrap;
  text-decoration: none;
}
.hg-btn:hover {
  background: rgba(244, 217, 138, 0.08);
  border-color: var(--hg-border-hover);
  color: var(--hg-gold-1);
}
.hg-btn.active {
  background: linear-gradient(135deg, rgba(244,217,138,0.18), rgba(198,152,71,0.12));
  border-color: var(--hg-border-hover);
  color: var(--hg-gold-1);
}
.hg-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.hg-divider {
  width: 1px;
  height: 22px;
  background: var(--hg-border);
}

/* Selector idioma */
.hg-lang {
  position: relative;
}
.hg-lang-current {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--hg-text);
  cursor: pointer;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-family: inherit;
  transition: all 200ms ease;
}
.hg-lang-current:hover {
  background: rgba(244, 217, 138, 0.08);
  border-color: var(--hg-border-hover);
  color: var(--hg-gold-1);
}
.hg-lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--hg-bg-strong);
  border: 1px solid var(--hg-border);
  border-radius: 14px;
  padding: 6px;
  min-width: 140px;
  display: none;
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.hg-lang.open .hg-lang-menu { display: block; }
.hg-lang-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--hg-text);
  text-align: left;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  transition: background 150ms ease;
}
.hg-lang-option:hover { background: rgba(244, 217, 138, 0.10); }
.hg-lang-option.active { background: rgba(244, 217, 138, 0.18); color: var(--hg-gold-1); }
.hg-flag {
  display: inline-block;
  width: 18px; height: 13px;
  border-radius: 2px;
  font-size: 13px;
  line-height: 1;
}

/* Token badge */
.hg-tokens {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: linear-gradient(135deg, rgba(244,217,138,0.18), rgba(140,106,38,0.18));
  border: 1px solid rgba(244,217,138,0.35);
  border-radius: 999px;
  font-size: 12px;
  color: var(--hg-gold-1);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.hg-tokens:hover { background: linear-gradient(135deg, rgba(244,217,138,0.28), rgba(140,106,38,0.22)); }

/* Estado activo (escuchando, hablando, etc) */
.hg-btn.listening {
  background: rgba(255, 80, 80, 0.18);
  border-color: rgba(255, 120, 120, 0.55);
  color: #ffb0b0;
  animation: hg-pulse 1.4s ease-in-out infinite;
}
.hg-btn.camera-on {
  background: rgba(80, 180, 255, 0.16);
  border-color: rgba(120, 200, 255, 0.55);
  color: #bdd9ff;
}
@keyframes hg-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,120,120,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(255,120,120,0); }
}

/* Móvil */
@media (max-width: 768px) {
  .hg-bar {
    top: 8px;
    padding: 6px 8px;
    gap: 4px;
  }
  .hg-btn { padding: 6px 8px; font-size: 12px; }
  .hg-btn-label { display: none; }
  .hg-divider { display: none; }
}

/* ============== ESTÉTICA UNIFICADA ============== */
/* Fondo cinematográfico tipo baúl/Pandora en todas las páginas */
.hg-page {
  min-height: 100vh;
  background:
    radial-gradient(1200px 800px at 50% 0%, rgba(140, 106, 38, 0.22) 0%, rgba(0,0,0,0) 60%),
    radial-gradient(800px 600px at 80% 100%, rgba(198, 152, 71, 0.16) 0%, rgba(0,0,0,0) 60%),
    linear-gradient(180deg, #0a0703 0%, #050301 100%);
  color: var(--hg-text);
  font-family: 'Inter', sans-serif;
  padding: 100px 20px 40px;
  position: relative;
  overflow-x: hidden;
}
.hg-page::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(1500px 1000px at 50% 30%, rgba(212, 160, 74, 0.08) 0%, transparent 70%);
  z-index: 0;
}
.hg-container {
  max-width: 980px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hg-h1 {
  font-family: 'Cormorant Garamond', 'Instrument Serif', serif;
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 400;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #f4d98a 0%, #c69847 60%, #8c6a26 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 0 0 16px;
  line-height: 1.05;
}
.hg-h1 em { font-style: italic; font-weight: 500; }
.hg-h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(24px, 3.5vw, 36px);
  font-weight: 400;
  color: var(--hg-cream);
  margin: 32px 0 12px;
  letter-spacing: -0.01em;
}
.hg-h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 500;
  color: var(--hg-gold-1);
  margin: 24px 0 8px;
}
.hg-kicker {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--hg-gold-1);
  font-weight: 600;
  margin-bottom: 18px;
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid var(--hg-border);
  border-radius: 999px;
  background: var(--hg-bg);
}
.hg-lead {
  font-size: 18px;
  line-height: 1.65;
  color: var(--hg-text);
  max-width: 720px;
  margin-bottom: 32px;
}
.hg-text {
  font-size: 15px;
  line-height: 1.7;
  color: var(--hg-text);
}
.hg-text-dim { color: var(--hg-text-dim); }

/* Tarjeta unificada */
.hg-card {
  background: linear-gradient(180deg, rgba(28, 18, 8, 0.55) 0%, rgba(14, 9, 4, 0.65) 100%);
  border: 1px solid var(--hg-border);
  border-radius: 18px;
  padding: 28px;
  margin: 16px 0;
  backdrop-filter: blur(8px);
  transition: border-color 200ms ease, transform 200ms ease;
}
.hg-card:hover { border-color: var(--hg-border-hover); }
.hg-card.compact { padding: 18px; }
.hg-card.clickable { cursor: pointer; }
.hg-card.clickable:hover { transform: translateY(-2px); }

.hg-grid { display: grid; gap: 16px; }
.hg-grid-2 { grid-template-columns: 1fr 1fr; }
.hg-grid-3 { grid-template-columns: repeat(3, 1fr); }
.hg-grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 768px) {
  .hg-grid-2, .hg-grid-3, .hg-grid-4 { grid-template-columns: 1fr; }
}

/* CTA dorado */
.hg-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #f4d98a 0%, #c69847 100%);
  color: #1a0f04;
  padding: 14px 28px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 200ms ease;
  font-family: inherit;
}
.hg-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(244,217,138,0.3);
}
.hg-cta:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.hg-cta-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--hg-gold-1);
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--hg-border-hover);
  cursor: pointer;
  text-decoration: none;
  transition: all 200ms ease;
  font-family: inherit;
}
.hg-cta-ghost:hover {
  background: rgba(244,217,138,0.08);
  color: var(--hg-cream);
}

/* Inputs */
.hg-input, .hg-select, .hg-textarea {
  width: 100%;
  background: rgba(8, 5, 2, 0.6);
  border: 1px solid var(--hg-border);
  color: var(--hg-text);
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 150ms ease;
  box-sizing: border-box;
}
.hg-input:focus, .hg-select:focus, .hg-textarea:focus {
  outline: none;
  border-color: var(--hg-gold-1);
}
.hg-textarea { resize: vertical; min-height: 100px; }
.hg-label {
  display: block;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hg-text-dim);
  margin: 16px 0 6px;
  font-weight: 500;
}
.hg-form-row { margin-bottom: 14px; }
.hg-form-row-inline { display: flex; gap: 14px; align-items: center; }
.hg-checkbox {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
  padding: 10px 0;
  font-size: 14px;
}
.hg-checkbox input { margin-top: 3px; cursor: pointer; }

/* Progress bar */
.hg-progress {
  width: 100%;
  height: 8px;
  background: rgba(244,217,138,0.12);
  border-radius: 999px;
  overflow: hidden;
  margin: 6px 0;
}
.hg-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #f4d98a 0%, #c69847 100%);
  border-radius: 999px;
  transition: width 600ms ease;
}

/* Modal */
.hg-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 9000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(8px);
}
.hg-modal.open { display: flex; }
.hg-modal-body {
  background: linear-gradient(180deg, #16100a 0%, #0a0703 100%);
  border: 1px solid var(--hg-border);
  border-radius: 22px;
  padding: 32px;
  max-width: 540px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
}
.hg-modal-close {
  position: absolute;
  top: 16px; right: 16px;
  background: transparent;
  border: 1px solid var(--hg-border);
  color: var(--hg-text);
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

/* Toast */
.hg-toast-wrap {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.hg-toast {
  background: var(--hg-bg-strong);
  border: 1px solid var(--hg-border-hover);
  color: var(--hg-cream);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 13px;
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: hg-toast-in 280ms ease;
  pointer-events: auto;
}
@keyframes hg-toast-in {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Texto leído sincronizado (word-by-word) */
.hg-spoken-word {
  display: inline;
  background: linear-gradient(135deg, rgba(244,217,138,0.35), rgba(198,152,71,0.25));
  border-radius: 4px;
  padding: 1px 3px;
  transition: background 100ms ease;
}
.hg-read-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--hg-border);
  color: var(--hg-text);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  margin-left: 8px;
}
.hg-read-toggle.reading { color: var(--hg-gold-1); border-color: var(--hg-border-hover); }

/* ====== ENCAJE CON PÁGINAS HEREDADAS ====== */
/* Cuando la barra global está presente, dejamos respirar el contenido superior */
body { padding-top: 0; }
.landing > .nav,
nav.nav,
nav.mc-nav,
nav.doc-nav { margin-top: 56px; }
@media (max-width: 720px) {
  .landing > .nav,
  nav.nav,
  nav.mc-nav,
  nav.doc-nav { margin-top: 48px; }
}
/* La barra global debe quedar por encima de absolutamente todo */
.hg-bar { z-index: 10000; }
/* Que el toast no quede tapado por avatares fixed */
.hg-toast { z-index: 10001; }
