/* ============================================================
   ESTILOS PRINCIPALES - INSULTÓMETRO FIJATE.COM
   Diseño responsivo, estético y adaptable a tema oscuro y claro
   ============================================================ */

:root {
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Paleta Tema Oscuro (por defecto) */
  --bg-body: #0b0f17;
  --bg-card: #131b2e;
  --bg-card-alt: #1a243b;
  --bg-input: #0f172a;
  --border-color: #1e293b;
  --border-focus: #f43f5e;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-flame: #f43f5e;
  --accent-flame-hover: #e11d48;
  --accent-glow: rgba(244, 63, 94, 0.25);

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

  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
}

[data-theme="light"],
body.light-theme {
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-alt: #f1f5f9;
  --bg-input: #ffffff;
  --border-color: #e2e8f0;
  --border-focus: #e11d48;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --accent-flame: #e11d48;
  --accent-flame-hover: #be123c;
  --accent-glow: rgba(225, 29, 72, 0.15);

  --shadow-card: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
}

/* Reset y estructura general */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
}

.text-mono {
  font-family: var(--font-mono);
}

/* Contenedor principal */
.tool-layout {
  max-width: 1100px;
  width: 100%;
  margin: 1.5rem auto 3rem;
  padding: 0 1.25rem;
  box-sizing: border-box;
  flex: 1 0 auto;
}

/* Migas de pan canónicas */
.tool-breadcrumbs {
  margin-bottom: 1.5rem;
}

.breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.breadcrumb-item a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.breadcrumb-item a:hover {
  color: var(--accent-flame);
}

.breadcrumb-item + .breadcrumb-item::before {
  content: "/";
  margin-right: 0.5rem;
  color: var(--text-muted);
}

.breadcrumb-item.active {
  color: var(--text-primary);
  font-weight: 500;
}

/* Hero y cabecera de herramienta */
.tool-hero {
  text-align: center;
  margin-bottom: 2rem;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: rgba(244, 63, 94, 0.12);
  color: var(--accent-flame);
  border: 1px solid rgba(244, 63, 94, 0.25);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.tool-hero h2 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.tool-hero p {
  color: var(--text-secondary);
  max-width: 720px;
  margin: 0 auto;
  font-size: 1.05rem;
}

/* Tarjeta del formulario de análisis */
.analyzer-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: clamp(1.25rem, 3vw, 2rem);
  box-shadow: var(--shadow-card);
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

.analyzer-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #f43f5e, #fb923c, #fbbf24);
}

.analyzer-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-row-main {
  display: flex;
  gap: 1rem;
  align-items: stretch;
}

@media (max-width: 768px) {
  .form-row-main {
    flex-direction: column;
  }
}

.input-wrapper {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  position: relative;
}

@media (max-width: 768px) {
  .input-wrapper {
    width: 100%;
    flex: none;
  }
}

.insult-input {
  width: 100%;
  min-height: 52px;
  height: 52px;
  padding: 0 1.25rem;
  font-size: 1.1rem;
  font-family: var(--font-main);
  background: var(--bg-input);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.insult-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.select-wrapper {
  width: 220px;
  min-width: 180px;
  position: relative;
}

@media (max-width: 768px) {
  .select-wrapper {
    width: 100%;
    max-width: 100%;
  }
}

.region-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 52px;
  height: 52px;
  padding: 0 40px 0 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  font-size: 0.95rem;
  font-family: var(--font-main);
  background-color: var(--bg-input);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  transition: border-color 0.2s ease;
}

.region-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.region-select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

.btn-analyze {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 52px;
  height: 52px;
  padding: 0 1.75rem;
  background: linear-gradient(135deg, var(--accent-flame), #e11d48);
  color: #ffffff;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 14px rgba(244, 63, 94, 0.35);
  white-space: nowrap;
}

.btn-analyze:hover {
  background: linear-gradient(135deg, #e11d48, #be123c);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(244, 63, 94, 0.45);
}

.btn-analyze:active {
  transform: translateY(1px);
}

@media (max-width: 768px) {
  .btn-analyze {
    width: 100%;
  }
}

/* Píldoras de prueba rápida */
.quick-tests {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.quick-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.pills-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.quick-pill {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.quick-pill:hover {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-flame);
  border-color: rgba(244, 63, 94, 0.35);
  transform: translateY(-1px);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-xl);
  color: var(--text-muted);
}

.empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-card-alt);
  color: var(--accent-flame);
}

.empty-state h3 {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

/* Tarjeta de resultado */
.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: clamp(1.5rem, 3.5vw, 2.5rem);
  box-shadow: var(--shadow-card);
  margin-bottom: 2.5rem;
  animation: fadeInResult 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.result-card.hidden {
  display: none;
}

@keyframes fadeInResult {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 2rem;
}

@media (max-width: 640px) {
  .result-header {
    flex-direction: column;
    align-items: stretch;
  }
}

.insult-meta {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.recognized-term {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  color: var(--text-primary);
}

.region-tag {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.verdict-badge {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  border: 1px solid transparent;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* Cuadrícula del resultado: Velocímetro + Veredicto + Desglose */
.result-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2.5rem;
  align-items: center;
  margin-bottom: 2rem;
}

@media (max-width: 860px) {
  .result-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }
}

/* Velocímetro Circular SVG */
.gauge-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.gauge-svg {
  width: 200px;
  height: 200px;
  transform: rotate(-90deg);
}

.gauge-bg {
  fill: none;
  stroke: var(--bg-card-alt);
  stroke-width: 10;
}

.gauge-progress {
  fill: none;
  stroke: var(--accent-flame);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke 0.3s ease;
}

.gauge-inner-data {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.score-value {
  font-family: var(--font-heading);
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-primary);
}

.score-max {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 0.2rem;
}

/* Detalles del veredicto y barras de desglose */
.verdict-details {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.verdict-title {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.verdict-desc {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.5;
}

.breakdown-bars {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.5rem;
}

.bar-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-align: left;
}

.bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.bar-val {
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.bar-track {
  width: 100%;
  height: 10px;
  background: var(--bg-card-alt);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  width: 0%;
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.fill-offense {
  background: linear-gradient(90deg, #f43f5e, #dc2626);
}

.fill-creativity {
  background: linear-gradient(90deg, #3b82f6, #6366f1);
}

.fill-phonetics {
  background: linear-gradient(90deg, #10b981, #059669);
}

/* Secciones de análisis cultural y equivalencias */
.analysis-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

@media (max-width: 768px) {
  .analysis-sections {
    grid-template-columns: 1fr;
  }
}

.cultural-box,
.equivalents-box {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.cultural-box h4,
.equivalents-box h4 {
  font-size: 1.15rem;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cultural-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.tip-box {
  background: rgba(244, 63, 94, 0.08);
  border-left: 3px solid var(--accent-flame);
  padding: 0.85rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.tip-label {
  font-weight: 700;
  color: var(--accent-flame);
  display: block;
  margin-bottom: 0.2rem;
}

.modifiers-box {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border-color);
}

.modifiers-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.35rem;
}

.modifiers-list {
  list-style: none;
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.modifiers-list li::before {
  content: "⚡ ";
  color: var(--accent-flame);
}

/* Cuadrícula de equivalentes internacionales */
.equivalents-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.eq-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.eq-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.eq-term {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.95rem;
  text-align: right;
}

/* Botones de acción al pie de la tarjeta */
.result-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

@media (max-width: 640px) {
  .result-actions {
    flex-direction: column;
  }
}

.btn-action-sec,
.btn-action-pri {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  height: 44px;
  padding: 0 1.25rem;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .btn-action-sec,
  .btn-action-pri {
    width: 100%;
  }
}

.btn-action-sec {
  background: var(--bg-card-alt);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-action-sec:hover {
  background: var(--border-color);
}

.btn-action-pri {
  background: var(--accent-flame);
  color: #ffffff;
  border: none;
}

.btn-action-pri:hover {
  background: var(--accent-flame-hover);
}

/* Guía cultural y sociolingüística SEO */
.seo-guide-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: clamp(1.5rem, 3.5vw, 2.5rem);
  margin-top: 3rem;
}

.seo-guide-section h3 {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.seo-guide-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.7;
}

.seo-guide-content h4 {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

.seo-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.seo-info-card {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.seo-info-card h5 {
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

/* Acordeón FAQ Canónico */
.faq-accordion {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 2rem;
}

.faq-item {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.faq-item:hover {
  border-color: rgba(244, 63, 94, 0.3);
}

.faq-question {
  width: 100%;
  padding: 1.15rem 1.25rem;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.faq-arrow {
  transition: transform 0.3s ease;
  color: var(--text-muted);
}

.faq-item.active .faq-arrow {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out, padding 0.3s ease;
  padding: 0 1.25rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

.faq-item.active .faq-answer {
  max-height: 500px;
  padding-bottom: 1.25rem;
}

/* Toast flotante de notificación */
.toast-notice {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-size: 0.9rem;
  color: var(--text-primary);
  max-width: 380px;
}

.toast-notice.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

@media (max-width: 640px) {
  .toast-notice {
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    max-width: none;
  }
}
