/* ==========================================================================
   Hero Interactivo — Agentes de Voz con IA
   Tipografía: Satoshi Variable
   Acento: #65CE51
   Mobile-first / Dark & Light mode
   ========================================================================== */

/* --- Font Face --- */
@font-face {
  font-family: 'Satoshi';
  src: url('../fonts/satoshi/fonts/Satoshi-Variable.woff2') format('woff2');
  font-weight: 300 900;
  font-display: swap;
  font-style: normal;
}

@font-face {
  font-family: 'Satoshi';
  src: url('../fonts/satoshi/fonts/Satoshi-VariableItalic.woff2') format('woff2');
  font-weight: 300 900;
  font-display: swap;
  font-style: italic;
}

/* --- CSS Variables --- */
:root {
  --accent: #65CE51;
  --accent-hover: #56b845;
  --accent-glow: rgba(101, 206, 81, 0.3);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Satoshi', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Light theme (default fallback) */
[data-theme="light"] {
  --bg-primary: #f8fdf7;
  --bg-secondary: #f0faf0;
  --bg-card: #ffffff;
  --bg-card-hover: #f0fdf0;
  --bg-overlay: rgba(248, 253, 247, 0.95);
  --bg-call: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  --border: #e2e8f0;
  --border-hover: #65CE51;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
  --shadow-card-hover: 0 4px 20px rgba(101, 206, 81, 0.15), 0 2px 8px rgba(0, 0, 0, 0.08);
  --panel-bg: #f8fafc;
  --panel-step-bg: #ffffff;
  --panel-step-active: #f0fdf0;
}

/* Dark theme */
[data-theme="dark"] {
  --bg-primary: #0b0f1a;
  --bg-secondary: #111827;
  --bg-card: #1a1f2e;
  --bg-card-hover: #1f2a1f;
  --bg-overlay: rgba(11, 15, 26, 0.95);
  --bg-call: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --border: #1e293b;
  --border-hover: #65CE51;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2);
  --shadow-card-hover: 0 4px 20px rgba(101, 206, 81, 0.2), 0 2px 8px rgba(0, 0, 0, 0.4);
  --panel-bg: #111827;
  --panel-step-bg: #1a1f2e;
  --panel-step-active: #1a2e1a;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Hero Container --- */
.hero {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg-primary);
}

@media (min-width: 1024px) {
  .hero {
    min-height: 600px;
  }
}

/* --- Animated Blobs (light theme ambient) --- */
.hero-blobs {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.hero-blob {
  position: absolute;
  border-radius: 50%;
  background: rgba(101, 206, 81, 0.08);
  filter: blur(80px);
  animation: pulseBlob 8s ease-in-out infinite;
}

.hero-blob--1 {
  top: -20%;
  left: -10%;
  width: 500px;
  height: 500px;
}

.hero-blob--2 {
  bottom: -15%;
  right: -10%;
  width: 400px;
  height: 400px;
  animation-delay: 2s;
}

.hero-blob--3 {
  top: 40%;
  right: 20%;
  width: 250px;
  height: 250px;
  background: rgba(101, 206, 81, 0.05);
  animation-delay: 4s;
}

[data-theme="dark"] .hero-blobs {
  display: none;
}

@keyframes pulseBlob {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.05); }
}

/* --- Views (states) --- */
.view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1;
  transition: opacity 0.5s ease, transform 0.5s ease;
  opacity: 0;
  pointer-events: none;
  transform: scale(1.02);
}

.view.active {
  opacity: 1;
  pointer-events: all;
  transform: scale(1);
}

/* --- VIEW 1: Hero + Selector --- */
.view-selector {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.hero-header {
  text-align: center;
  margin-bottom: 1.5rem;
  padding-top: 0.5rem;
}

.hero-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.hero-logos img {
  height: 28px;
  width: auto;
  object-fit: contain;
}

.hero-logos span {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.hero-title {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.hero-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 0.75rem;
}

.hero-cta-text {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  font-style: italic;
}

.hero-cta-text strong {
  color: var(--accent);
  font-style: normal;
  font-weight: 600;
}

/* Section title */
.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 1rem;
}

/* --- Scenario Cards Grid --- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  max-width: 1100px;
  margin: 0 auto;
}

@media (min-width: 640px) {
  .cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .cards-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }
}

/* --- Card (incoming call style) --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1rem;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.75rem;
}

.card:hover,
.card:focus-visible {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-card-hover);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.card:active {
  transform: translateY(0);
}

/* Card avatar (icon circle) */
.card-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--card-color);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 24px var(--card-glow);
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .card-avatar {
    width: 64px;
    height: 64px;
  }
}

.card-avatar svg {
  width: 26px;
  height: 26px;
  stroke: white;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (min-width: 640px) {
  .card-avatar svg {
    width: 30px;
    height: 30px;
  }
}

/* Card label */
.card-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}

/* Card title */
.card-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.3;
}

@media (min-width: 640px) {
  .card-title {
    font-size: 1.05rem;
  }
}

/* Card description (hidden on mobile, 2-line clamp on tablet+) */
.card-desc {
  display: none;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--text-secondary);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

@media (max-width: 639px) {
  .card-desc {
    display: none;
  }
}

@media (min-width: 640px) {
  .card-desc {
    display: -webkit-box;
  }
}

/* Card CTA */
.card-cta {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  transition: var(--transition);
  margin-top: 0.25rem;
}

.card:hover .card-cta {
  opacity: 0.85;
}

/* --- VIEW 2: Incoming Call --- */
.view-call {
  background: var(--bg-call);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.call-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  animation: fadeIn 0.5s ease;
}

.call-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #3bb02b);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 40px var(--accent-glow);
}

.call-avatar svg {
  width: 36px;
  height: 36px;
  stroke: white;
  fill: none;
  stroke-width: 1.5;
}

.call-label {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.call-name {
  color: #ffffff;
  font-size: 1.5rem;
  font-weight: 300;
}

.call-dots {
  display: flex;
  gap: 6px;
}

.call-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: bounce 1s infinite;
}

.call-dots span:nth-child(2) { animation-delay: 0.15s; }
.call-dots span:nth-child(3) { animation-delay: 0.3s; }

.btn-answer {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 30px var(--accent-glow);
  transition: var(--transition);
  animation: ring 2s infinite;
}

.btn-answer:hover {
  transform: scale(1.1);
  background: var(--accent-hover);
}

.btn-answer:active {
  transform: scale(0.95);
}

.btn-answer svg {
  width: 28px;
  height: 28px;
  stroke: white;
  fill: none;
  stroke-width: 2;
}

.call-answer-label {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.8rem;
}

.btn-back-call {
  position: absolute;
  top: 1rem;
  left: 1rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  z-index: 10;
}

.btn-back-call:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn-back-call svg {
  width: 20px;
  height: 20px;
  stroke: white;
  fill: none;
  stroke-width: 2;
}

/* --- VIEW 3: Active Demo --- */
.view-demo {
  display: flex;
  flex-direction: column;
  height: 100%;
}

@media (min-width: 1024px) {
  .view-demo {
    flex-direction: row;
  }
}

.demo-main {
  flex: 1;
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.demo-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Scenario badge in demo view */
.demo-scenario-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  padding: 0.4rem 0.85rem 0.4rem 0.6rem;
  z-index: 10;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.demo-scenario-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--badge-color, var(--accent));
  flex-shrink: 0;
}

.demo-scenario-icon svg {
  width: 14px;
  height: 14px;
  stroke: white;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.demo-scenario-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
}

/* Demo intro toast */
.demo-toast {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 2.5rem 1rem 1.25rem;
  max-width: calc(100% - 2rem);
  width: 420px;
  z-index: 15;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.demo-toast.visible {
  opacity: 1;
  pointer-events: all;
  transform: translateX(-50%) translateY(0);
}

.demo-toast-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

.demo-toast-prompt {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
  font-style: italic;
}

.demo-toast-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  transition: color 0.2s;
}

.demo-toast-close:hover {
  color: var(--text-primary);
}

@media (min-width: 1024px) {
  .demo-toast {
    top: 3.5rem;
  }
}

.demo-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  z-index: 10;
}

.demo-close:hover {
  background: rgba(0, 0, 0, 0.6);
  transform: scale(1.1);
}

.demo-close svg {
  width: 18px;
  height: 18px;
  stroke: white;
  fill: none;
  stroke-width: 2;
}

/* --- AI Panel (sidebar desktop) --- */
.ai-panel {
  display: none;
  width: 280px;
  background: var(--panel-bg);
  border-left: 1px solid var(--border);
  padding: 1.25rem;
  overflow-y: auto;
  flex-shrink: 0;
}

@media (min-width: 1024px) {
  .ai-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }
}

.ai-panel-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: 0.5rem;
}

.ai-step {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--panel-step-bg);
  border: 1px solid var(--border);
  opacity: 0.4;
  transition: var(--transition);
}

.ai-step.active {
  opacity: 1;
  background: var(--panel-step-active);
  border-color: var(--accent);
}

.ai-step.done {
  opacity: 0.7;
}

.ai-step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-tertiary);
  flex-shrink: 0;
  transition: var(--transition);
}

.ai-step.active .ai-step-dot {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  animation: pulse 1.5s infinite;
}

.ai-step.done .ai-step-dot {
  background: var(--accent);
}

.ai-step-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.ai-step.active .ai-step-label {
  color: var(--text-primary);
  font-weight: 500;
}

/* --- AI Panel Mobile (bottom pill + bottom sheet) --- */
.ai-pill {
  display: flex;
  position: absolute;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  gap: 0.5rem;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  z-index: 20;
  transition: var(--transition);
  max-width: calc(100% - 2rem);
}

@media (min-width: 1024px) {
  .ai-pill,
  .ai-sheet {
    display: none !important;
  }
}

.ai-pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.5s infinite;
  flex-shrink: 0;
}

.ai-pill-text {
  font-size: 0.75rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Bottom Sheet */
.ai-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--panel-bg);
  border-top: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 1rem 1.25rem 1.5rem;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 30;
  max-height: 50dvh;
  overflow-y: auto;
}

.ai-sheet.open {
  transform: translateY(0);
}

.ai-sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--text-tertiary);
  margin: 0 auto 1rem;
  opacity: 0.5;
}

.ai-sheet .ai-step {
  margin-bottom: 0.5rem;
}

/* --- VIEW 4: Closing CTA --- */
.view-closing {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 2rem;
  background: var(--bg-primary);
}

.closing-content {
  text-align: center;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  animation: fadeIn 0.6s ease;
}

.closing-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(101, 206, 81, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.closing-icon svg {
  stroke: var(--accent);
}

.closing-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

@media (min-width: 640px) {
  .closing-title {
    font-size: 1.75rem;
  }
}

.closing-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.closing-text strong {
  color: var(--text-primary);
}

.closing-highlight {
  font-size: 1.05rem;
  color: var(--text-primary);
  font-weight: 500;
  margin-top: 0.5rem;
}

.closing-highlight strong {
  color: var(--accent);
}

.closing-cta {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.85rem 2rem;
  background: var(--accent);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 999px;
  text-decoration: none;
  transition: var(--transition);
  box-shadow: 0 0 20px var(--accent-glow);
}

.closing-cta:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 24px var(--accent-glow);
}

.closing-secondary {
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 0.85rem;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0.5rem 1rem;
  transition: var(--transition);
}

.closing-secondary:hover {
  color: var(--text-secondary);
}

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

@keyframes ring {
  0% { box-shadow: 0 0 0 0 var(--accent-glow); }
  70% { box-shadow: 0 0 0 20px rgba(101, 206, 81, 0); }
  100% { box-shadow: 0 0 0 0 rgba(101, 206, 81, 0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* --- Utility --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
