/* ============ VARIABLES Y ESTILOS GLOBALES ============ */
:root {
  --primary: #913f8f;
  --primary-dark: #7a3578;
  --primary-light: #ab68a9;
  --primary-ultralight: #f9f5fb;
  --primary-glow: rgba(145, 63, 143, 0.15);
  --background: #fcfbfe;
  --surface: #ffffff;
  --text-primary: #2c2c2c;
  --text-secondary: #616161;
  --gray-light: #f3eff5;
  --gray-medium: #e4dde6;
  --error: #dc3545;
  --success: #28a745;
  --warning: #ffc107;
  /* COLORES REFINADOS */
  --border-radius-lg: 24px;
  --border-radius-md: 16px;
  --transition-speed: 0.3s;
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.1);
}

/* ============ ANIMACIONES ============ */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  50% {
    transform: scale(1.05);
  }
}

@keyframes cta-pulse {

  /* NUEVA ANIMACIÓN PARA BOTONES CTA */
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(145, 63, 143, 0.4);
  }

  70% {
    transform: scale(1.05);
    box-shadow: 0 0 0 10px rgba(145, 63, 143, 0);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(145, 63, 143, 0);
  }
}

/* ============ ESTILOS BASE ============ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--background);
  color: var(--text-primary);
  font-size: 17px;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
}

/* ============ LAYOUT PRINCIPAL ============ */
.container {
  width: 100%;
  max-width: 800px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.form-card {
  background: var(--surface);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  border: 1px solid var(--gray-medium);
  position: relative;
}

/* ============ SECCIÓN DE BIENVENIDA ============ */
.welcome-info {
  margin: 2.5rem auto 1.5rem;
  padding: 0 1rem;
  max-width: 600px;
  text-align: left;
}

.welcome-point {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.welcome-point .icon {
  font-size: 1.6rem;
  color: var(--primary);
  flex-shrink: 0;
  width: 40px;
  text-align: center;
  margin-top: 4px;
}

.welcome-point p {
  margin: 0;
  font-size: 1rem;
  color: var(--text-secondary);
}

.welcome-point p strong {
  color: var(--text-primary);
  font-weight: 600;
  display: block;
  margin-bottom: 2px;
}

/* ============ CABECERA Y PROGRESO ============ */
.header {
  padding: 2rem 1.5rem;
  text-align: center;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: white;
}

.logo-container {
  background: var(--surface);
  display: inline-flex;
  padding: 1.2rem;
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

.logo {
  max-width: 250px;
  height: auto;
  display: block;
}

.subtitle {
  font-size: 1.1rem;
  font-weight: 500;
  opacity: 0.9;
}

.progress-container {
  padding: 1.2rem 2rem;
  background: var(--surface);
  border-bottom: 1px solid var(--gray-light);
  position: sticky;
  top: 0;
  z-index: 10;
}

.progress-bar {
  height: 12px;
  background-color: var(--gray-light);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.8rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-light), var(--primary));
  border-radius: 6px;
  width: 0%;
  transition: width 0.5s cubic-bezier(0.65, 0, 0.35, 1);
}

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

.progress-text span:first-child {
  color: var(--primary);
}

/* ============ CONTENIDO DE SECCIONES Y FORMULARIO ============ */
.section-content {
  padding: 2rem 3rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.section {
  display: none;
}

.section.active {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  animation: fadeIn 0.5s ease-out;
}

.section h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  text-align: center;
  color: var(--primary);
}

.section .section-intro {
  text-align: center;
  color: var(--text-secondary);
  margin: 0 auto 2.5rem;
  max-width: 550px;
  font-size: 1.1rem;
}

.form-group {
  margin-bottom: 1.5rem;
  background: var(--surface);
  padding: 1.5rem;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--gray-light);
  box-shadow: var(--shadow-sm);
}

fieldset {
  border: none;
}

legend.label-title {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1.2rem;
  text-align: center;
  margin-bottom: 1.5rem;
}

/* ============ INPUTS Y ERRORES ============ */
input,
select {
  width: 100%;
  padding: 0.9rem 1.2rem;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--gray-medium);
  font-size: 1rem;
  background: var(--gray-light);
  color: var(--text-primary);
  font-family: 'Poppins', sans-serif;
  transition: all var(--transition-speed) ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.error-message {
  color: var(--error);
  font-size: 0.9rem;
  margin-top: 0.5rem;
  text-align: center;
  display: none;
  font-weight: 600;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

input.invalid,
select.invalid {
  border-color: var(--error);
}

/* ============ ESCALA DE EMOJIS ============ */
.scale {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.8rem;
}

.scale-option {
  cursor: pointer;
  text-align: center;
  padding: 0.8rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  border: 2px solid transparent;
  border-radius: var(--border-radius-md);
  transition: all var(--transition-speed) ease;
  background-color: var(--gray-light);
}

.scale-option:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-sm);
}

.scale-option input[type="radio"] {
  position: absolute;
  opacity: 0;
}

.scale-option .option-emoji {
  font-size: 2.5rem;
  transition: transform 0.2s ease;
}

.scale-option .emoji-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.scale-option.scale-option-checked {
  border-color: var(--primary);
  background-color: var(--surface);
}

.scale-option.scale-option-checked .option-emoji {
  transform: scale(1.2);
}

.scale-option.scale-option-checked .emoji-label {
  color: var(--primary);
  font-weight: 600;
}

/* ============ BOTONES ============ */
.buttons {
  display: flex;
  gap: 1rem;
  padding: 1.5rem 2.5rem;
  border-top: 1px solid var(--gray-light);
  background: var(--surface);
}

button {
  flex: 1;
  padding: 0.9rem 1.2rem;
  border: none;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 700;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

button:hover {
  transform: translateY(-3px);
}

button:active {
  transform: translateY(0px) scale(0.98);
}

button:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

.btn-prev {
  background: var(--gray-light);
  color: var(--text-secondary);
}

.btn-next,
.btn-submit {
  background: var(--primary);
  color: white;
}

.btn-submit {
  animation: cta-pulse 2.5s infinite;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}

/* ============ PÁGINA DE RESULTADOS ============ */
.results-page {
  text-align: center;
  animation: fadeIn 1s ease-out;
}

.chart-container {
  position: relative;
  max-width: 600px;
  height: 500px;
  margin: 1rem auto 3rem;
}

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

.highlight-card {
  padding: 1.5rem;
  border-radius: var(--border-radius-md);
  text-align: left;
  color: white;
  box-shadow: var(--shadow-sm);
}

.highlight-card.strength {
  background-color: var(--success);
}

.highlight-card.opportunity {
  background-color: var(--error);
}

.highlight-card h3 {
  font-size: 1.1rem;
  opacity: 0.8;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.highlight-card p {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.highlight-card .highlight-feedback {
  font-size: 0.9rem;
  font-weight: 400;
  opacity: 0.9;
  line-height: 1.6;
}

.show-all-results-btn {
  background: var(--gray-light);
  border: 1px solid var(--gray-medium);
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
  font-size: 1rem;
  margin-top: 2rem;
  padding: 0.8rem 1.5rem;
  border-radius: 50px;
  transition: all 0.3s ease;
}

.show-all-results-btn:hover {
  background-color: var(--gray-medium);
  transform: translateY(-2px);
}

.hidden-cards {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.7s ease-in-out;
}

.hidden-cards.show {
  max-height: 2000px;
}

.analysis-cards-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  text-align: left;
  margin-top: 2rem;
}

.analysis-card {
  background-color: var(--surface);
  border-radius: var(--border-radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-light);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.card-header h3 {
  font-size: 1.25rem;
  color: var(--text-primary);
  font-weight: 700;
}

.card-score {
  text-align: right;
}

.score-value {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1;
}

.score-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  color: white;
  padding: 3px 8px;
  border-radius: 50px;
  display: inline-block;
}

.score-label.high {
  background-color: var(--success);
}

.score-label.medium {
  background-color: var(--warning);
}

.score-label.low {
  background-color: var(--error);
}

.card-feedback {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.cta-section {
  margin-top: 4rem;
  padding: 2.5rem;
  background: var(--gray-light);
  border-radius: var(--border-radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  text-align: center;
}

.cta-content {
  max-width: 500px;
}

.cta-image {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  border: 4px solid white;
}

.cta-section h3 {
  font-size: 1.5rem;
  color: var(--text-primary);
}

.cta-section p {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.whatsapp-btn {
  background-color: #25D366;
  color: white;
  font-size: 1.1rem;
  border-radius: 50px;
  padding: 0.8rem 1.8rem;
  width: auto;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  animation: cta-pulse 2.5s infinite 1s;
}

.whatsapp-btn:hover {
  background-color: #128C7E;
  transform: translateY(-3px) scale(1.02);
  animation: none;
}

/* ============ NOTIFICACIÓN Y FOOTER ============ */
#validation-toast {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background-color: var(--error);
  color: white;
  padding: 1rem 1.5rem;
  text-align: center;
  font-weight: 700;
  z-index: 20;
  display: none;
  justify-content: space-between;
  align-items: center;
  transform: translateY(-100%);
  transition: transform 0.4s ease-out;
}

#validation-toast.show {
  display: flex;
  transform: translateY(0);
}

.toast-close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.5rem;
}

/* ============ FOOTER MEJORADO Y DISCRETO ============ */
.footer {
  text-align: center;
  padding: 1rem;
  background: var(--gray-light);
  border-top: 1px solid var(--gray-medium);
  margin-top: 2rem;
}

.footer-content {
  max-width: 600px;
  margin: 0 auto;
}

.copyright {
  color: var(--text-secondary);
  font-size: 0.75rem;
  margin-bottom: 0.75rem;
  opacity: 0.7;
}

.legal-section {
  margin-top: 0.5rem;
}

.legal-toggle {
  background: none;
  border: 1px solid var(--gray-medium);
  border-radius: 20px;
  padding: 0.4rem 0.8rem;
  font-size: 0.7rem;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.3s ease;
  opacity: 0.8;
}

.legal-toggle:hover {
  background: var(--surface);
  opacity: 1;
  transform: translateY(-1px);
}

.legal-toggle .toggle-icon {
  font-size: 0.6rem;
  transition: transform 0.3s ease;
}

.legal-toggle[aria-expanded="true"] .toggle-icon {
  transform: rotate(180deg);
}

.legal-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  margin-top: 0.5rem;
}

.legal-content.expanded {
  max-height: 200px;
}

.legal-text {
  background: var(--surface);
  border-radius: 12px;
  padding: 0.8rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-medium);
}

.legal-text p {
  margin: 0.3rem 0;
  font-size: 0.7rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.legal-text i {
  color: var(--primary);
  font-size: 0.65rem;
  width: 12px;
}

.legal-text a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.legal-text a:hover {
  text-decoration: underline;
}

/* ============ DISEÑO RESPONSIVO (MÓVIL) ============ */
@media (max-width: 600px) {
  body {
    font-size: 16px;
    padding: 0;
  }

  .container {
    padding: 0;
  }

  .form-card {
    border-radius: 0;
    margin: 0;
    border: none;
  }

  .section-content {
    padding: 1.5rem;
  }

  .section h2 {
    font-size: 1.6rem;
  }

  .section .section-intro {
    font-size: 0.95rem;
  }

  .form-group {
    padding: 1rem;
  }

  legend.label-title {
    font-size: 1.1rem;
  }

  .welcome-info {
    padding: 0;
  }

  .buttons {
    flex-direction: column;
    padding: 1rem;
    gap: 0.8rem;
  }

  #nextBtn {
    order: 1;
  }

  #prevBtn {
    order: 2;
  }

  .scale {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .scale-option {
    padding: 0.5rem;
    gap: 0.25rem;
  }

  .scale-option .option-emoji {
    font-size: 1.5rem;
  }

  .scale-option .emoji-label {
    font-size: 0.8rem;
  }

  .cta-section {
    padding: 1.5rem;
  }

  .summary-highlight {
    grid-template-columns: 1fr;
  }
}