/* ==============================================
   PASADA 1: Sistema de Estrellas Editorial
   ============================================== */

/* Estrellas base - estilo editorial */
.editorial-star {
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.5rem;
  transition: all 0.3s ease-out;
  background: transparent;
  border: none;
}

.editorial-star:focus {
  outline: none;
  box-shadow: 0 0 0 2px #FCD34D, 0 0 0 4px white;
}

.editorial-star .star-svg {
  color: #D6D3D1; /* stone-300 */
}

.editorial-star .star-outline {
  transition: all 0.3s ease;
}

.editorial-star .star-fill {
  opacity: 0;
  transition: opacity 0.4s ease-out;
}

.editorial-star .star-clip-rect {
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform: translateY(0);
}

/* Hover en estrellas */
.editorial-star:hover .star-svg {
  color: #FBBF24; /* amber-400 */
  transform: scale(1.15);
  filter: drop-shadow(0 2px 4px rgba(217, 119, 6, 0.3));
}

/* Estrellas seleccionadas - efecto ink fill */
.editorial-star.selected .star-svg {
  color: #F59E0B; /* amber-500 */
  filter: drop-shadow(0 1px 3px rgba(180, 83, 9, 0.4));
}

.editorial-star.selected .star-fill {
  opacity: 1;
}

.editorial-star.selected .star-clip-rect {
  transform: translateY(-24px);
}

/* Animación escalonada para llenado */
.editorial-star.selected:nth-child(1) .star-clip-rect { transition-delay: 0ms; }
.editorial-star.selected:nth-child(2) .star-clip-rect { transition-delay: 50ms; }
.editorial-star.selected:nth-child(3) .star-clip-rect { transition-delay: 100ms; }
.editorial-star.selected:nth-child(4) .star-clip-rect { transition-delay: 150ms; }
.editorial-star.selected:nth-child(5) .star-clip-rect { transition-delay: 200ms; }

/* Hover preview para estrellas */
.editorial-star.hover-preview .star-svg {
  color: #FCD34D; /* amber-300 */
  transform: scale(1.08);
}

/* Efecto pulso al seleccionar */
.editorial-star.pulse-select {
  animation: starPulse 0.3s ease-out;
}

@keyframes starPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Feedback text animado */
.rating-feedback {
  font-family: 'Georgia', 'Times New Roman', serif;
}

.rating-group:has(.selected) .rating-feedback {
  opacity: 1;
  transform: translateX(0);
}

/* Legend estilo editorial */
.rating-legend {
  letter-spacing: 0.15em;
}

/* Separadores elegantes entre campos - Optimizado */
.rating-field-group {
  position: relative;
  padding-bottom: 0.75rem;
}

.rating-field-group::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(217, 119, 6, 0.1), transparent);
}

@media (min-width: 768px) {
  .rating-field-group:nth-child(odd)::after {
    right: -1rem;
  }
  .rating-field-group:nth-child(even)::after {
    left: -1rem;
  }
}

.rating-field-group:last-child::after,
.rating-field-group:nth-last-child(2):nth-child(odd)::after {
  display: none;
}

/* ==============================================
   PASADA 2: Formulario Estilo Magazine
   ============================================== */

/* Contenedor del formulario editorial */
.editorial-form {
  background: linear-gradient(135deg, #ffffff 0%, #fffbeb 50%, #ffffff 100%);
}

/* Labels estilo magazine */
.editorial-label {
  display: flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #57534e; /* stone-600 */
  margin-bottom: 0.5rem;
}

/* Input con borde inferior solamente */
.editorial-input-wrapper {
  position: relative;
}

.editorial-input {
  width: 100%;
  padding: 0.75rem 0;
  font-size: 1rem;
  color: #1c1917; /* stone-900 */
  background: transparent;
  border: none;
  border-bottom: 1.5px solid #d6d3d1; /* stone-300 */
  transition: border-color 0.3s ease;
}

.editorial-input::placeholder {
  color: #a8a29e; /* stone-400 */
  font-style: italic;
}

.editorial-input:focus {
  outline: none;
  border-bottom-color: #d97706; /* amber-600 */
}

/* Línea animada que crece desde el centro */
.input-underline {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #f59e0b, #d97706);
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  transform: translateX(-50%);
}

.editorial-input:focus ~ .input-underline {
  width: 100%;
}

/* Textarea editorial con comillas */
.editorial-textarea {
  width: 100%;
  padding: 1rem;
  padding-left: 1.5rem;
  font-size: 0.875rem;
  line-height: 1.6;
  color: #1c1917;
  background: white;
  border: 1px solid #e7e5e4; /* stone-200 */
  border-radius: 0.5rem;
  resize: none;
  transition: all 0.3s ease;
}

.editorial-textarea::placeholder {
  color: #a8a29e;
  font-style: italic;
}

.editorial-textarea:focus {
  outline: none;
  border-color: #d97706;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.1);
}

/* Barra de progreso de caracteres */
.char-progress-bar {
  background: #f5f5f4; /* stone-100 */
}

#char-progress {
  min-width: 0;
}

#char-progress.warning {
  background: linear-gradient(90deg, #f59e0b, #ea580c);
}

#char-progress.valid {
  background: linear-gradient(90deg, #22c55e, #16a34a);
}

/* Checkbox editorial */
.editorial-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #fefce8 0%, #ffffff 100%);
  border-radius: 0.5rem;
  border: 1px solid #fef3c7;
  transition: all 0.3s ease;
}

.editorial-checkbox-label:hover {
  border-color: #fcd34d;
  background: linear-gradient(135deg, #fef9c3 0%, #ffffff 100%);
}

.editorial-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkbox-custom {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  background: white;
  border: 1.5px solid #d6d3d1;
  border-radius: 0.25rem;
  transition: all 0.2s ease;
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.editorial-checkbox:checked + .checkbox-custom {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-color: #d97706;
}

.editorial-checkbox:focus + .checkbox-custom {
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.2);
}

/* Botón de envío editorial */
.editorial-submit-btn {
  background-position: left;
}

.editorial-submit-btn:hover {
  background-position: right;
}

.editorial-submit-btn:active {
  transform: scale(0.98);
}

.editorial-submit-btn.loading .button-content {
  display: none;
}

.editorial-submit-btn.loading .button-loading {
  display: flex !important;
}

/* Fieldset editorial */
.editorial-fieldset {
  border: 1px solid #e7e5e4;
  border-radius: 1rem;
  background: linear-gradient(180deg, #fefce8 0%, #ffffff 20%);
}

/* Animaciones para mensajes de feedback */
.review-message {
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    transform: translateY(-10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ==============================================
   PASADA 5: Microinteracciones y Polish
   ============================================== */

/* Entrada escalonada de reseñas (fade-in stagger) */
.editorial-review-card {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.6s ease-out forwards;
}

.editorial-review-card:nth-child(1) { animation-delay: 0.1s; }
.editorial-review-card:nth-child(2) { animation-delay: 0.2s; }
.editorial-review-card:nth-child(3) { animation-delay: 0.3s; }
.editorial-review-card:nth-child(4) { animation-delay: 0.4s; }
.editorial-review-card:nth-child(5) { animation-delay: 0.5s; }

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

/* Resumen premium - entrada con escala */
.editorial-summary {
  animation: scaleIn 0.5s ease-out;
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Botón de envío - efecto press suave */
.editorial-submit-btn:active {
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.3);
}

/* Mensaje de éxito con animación check */
#review-message.bg-green-100 {
  animation: successPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes successPop {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  50% {
    transform: scale(1.02);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Success icon animation */
.success-check-icon {
  animation: checkDraw 0.4s ease-out 0.2s both;
}

@keyframes checkDraw {
  from {
    stroke-dashoffset: 50;
  }
  to {
    stroke-dashoffset: 0;
  }
}

/* Barras de progreso animadas */
.rating-bar-row .h-full {
  animation: barGrow 0.8s ease-out;
  transform-origin: left center;
}

@keyframes barGrow {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

/* Hover en tarjetas más refinado */
.editorial-review-card {
  transition: all 0.4s ease-out;
}

.editorial-review-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

/* Skeleton loading editorial */
.skeleton-editorial {
  background: linear-gradient(90deg, #f5f5f4 25%, #fafaf9 50%, #f5f5f4 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 0.75rem;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Transiciones globales */
* {
  transition-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Focus visible para accesibilidad */
.editorial-star:focus-visible,
.editorial-submit-btn:focus-visible,
.editorial-checkbox:focus-visible + .checkbox-custom {
  outline: 2px solid #D97706;
  outline-offset: 2px;
}

/* Scroll indicator suave */
.scroll-indicator {
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-6px);
  }
  60% {
    transform: translateY(-3px);
  }
}

/* Números que crecen */
.editorial-summary .text-7xl,
.editorial-summary .text-8xl {
  animation: countUp 0.8s ease-out;
}

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

/* Estrellas que brillan al hacer hover en el resumen */
.editorial-summary .text-amber-400 {
  transition: all 0.3s ease;
}

.editorial-summary:hover .text-amber-400 {
  filter: drop-shadow(0 0 4px rgba(251, 191, 36, 0.6));
}

/* Polish para inputs */
.editorial-input:not(:placeholder-shown) {
  border-bottom-color: #D97706;
}

.editorial-textarea:not(:placeholder-shown) {
  border-color: #D97706;
}

/* Animación del icono de flecha en el botón */
.editorial-submit-btn .fa-arrow-right {
  transition: transform 0.3s ease;
}

.editorial-submit-btn:hover .fa-arrow-right {
  transform: translateX(4px);
}

/* Loading button state */
.editorial-submit-btn.loading {
  pointer-events: none;
  opacity: 0.8;
}

.editorial-submit-btn .button-loading {
  display: none;
}

.editorial-submit-btn.loading .button-content {
  display: none;
}

.editorial-submit-btn.loading .button-loading {
  display: flex;
}

/* ==============================================
   Inputs Modernos - Nombre y Email
   ============================================== */

.editorial-input-modern {
  font-family: inherit;
}

.editorial-input-modern:focus {
  outline: none;
}

.editorial-input-modern::placeholder {
  font-style: normal;
}

/* Estado con valor */
.editorial-input-modern:not(:placeholder-shown) {
  border-color: #D97706;
  background-color: white;
}

/* Estado de error */
.editorial-input-modern.border-red-500 {
  border-color: #ef4444 !important;
  background-color: #fef2f2;
}

.editorial-input-modern.border-red-500:focus {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}
