/**
 * Estilos adicionales para el formulario de envío de tiendas
 */

/* Animaciones para el modal */
@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes modalOverlayFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@keyframes shine {
  0% {
    background-position: -100px;
  }
  40%,
  100% {
    background-position: 300px;
  }
}

@keyframes float {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
  100% {
    transform: translateY(0px);
  }
}

/* Estilos para el modal */
#store-submission-modal {
  animation: modalOverlayFadeIn 0.3s ease-out;
}

#store-submission-modal > div:last-child {
  animation: modalFadeIn 0.4s ease-out;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

#store-submission-modal > div:last-child.animate-fadeOut {
  animation: modalFadeOut 0.3s ease-out forwards;
}

/* Efectos para inputs al enfocar */
#store-submission-form input:focus,
#store-submission-form textarea:focus {
  background-image: linear-gradient(
    to right,
    rgba(251, 191, 36, 0.05),
    rgba(251, 191, 36, 0.02)
  );
  transition: all 0.3s ease;
  border-color: rgba(251, 191, 36, 0.5);
}

/* Estilos para inputs válidos e inválidos */
#store-submission-form input.border-green-300,
#store-submission-form textarea.border-green-300 {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2334D399'%3E%3Cpath fill-rule='evenodd' d='M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z' clip-rule='evenodd' /%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 20px 20px;
  padding-right: 40px;
  border-color: #34d399;
}

#store-submission-form input.border-red-300,
#store-submission-form textarea.border-red-300 {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23EF4444'%3E%3Cpath fill-rule='evenodd' d='M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z' clip-rule='evenodd' /%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 20px 20px;
  padding-right: 40px;
  border-color: #ef4444;
}

/* Estilos para el botón de envío */
#submit-store-btn {
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

#submit-store-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

#submit-store-btn:active {
  transform: translateY(0);
}

#submit-store-btn::after {
  content: "";
  position: absolute;
  top: -50%;
  right: -50%;
  bottom: -50%;
  left: -50%;
  background: linear-gradient(
    to bottom,
    rgba(229, 231, 235, 0),
    rgba(255, 255, 255, 0.2) 50%,
    rgba(229, 231, 235, 0)
  );
  transform: rotateZ(60deg) translate(-5em, 7.5em);
  opacity: 0;
  transition: opacity 0.5s;
}

#submit-store-btn:hover::after {
  opacity: 1;
  animation: shine 1.5s ease;
}

/* Mejoras para los checkboxes y labels */
.store-category {
  cursor: pointer;
}

.store-category + label {
  transition: all 0.2s ease;
  display: block;
  width: 100%;
  border-radius: 0.75rem;
}

.store-category:checked + label {
  color: #b45309; /* amber-700 */
  background-color: rgba(251, 191, 36, 0.2);
  font-weight: 500;
}

.store-category:focus + label {
  outline: 2px solid rgba(251, 191, 36, 0.5);
  outline-offset: 2px;
}

/* Estilos para los botones de despliegue de submenús */
.submenu-toggle {
  cursor: pointer;
  transition: all 0.2s ease;
}

.submenu-toggle:hover {
  background-color: rgba(251, 191, 36, 0.2);
}

.submenu-toggle svg {
  transition: transform 0.3s ease;
}

.submenu-toggle svg.rotate-180 {
  transform: rotate(180deg);
}

/* Mejoras para el contenedor de categorías en el modal */
#store-submission-modal .category-item {
  position: relative;
  margin-bottom: 0.5rem;
}

#store-submission-modal .category-item .pl-4 {
  border-left: 2px solid rgba(251, 191, 36, 0.3);
  margin-left: 0.5rem;
  padding-top: 0.5rem;
  padding-bottom: 0.25rem;
  display: none; /* Oculto por defecto */
}

/* Aseguramos que las subcategorías sean visibles cuando se muestran */
#store-submission-modal .category-item .pl-4.show,
#store-submission-modal .category-item .pl-4:not(.hidden) {
  display: block;
}

/* Aumentamos el z-index de los botones de submenu para asegurar que sean clickeables */
#store-submission-modal .submenu-toggle {
  z-index: 10;
  position: relative;
}

/* Mejoramos la visualización de las categorías seleccionadas */
#store-submission-modal .store-category:checked + label {
  color: #b45309; /* amber-700 */
  background-color: rgba(251, 191, 36, 0.2);
  font-weight: 500;
  border-radius: 0.75rem;
  padding: 0.5rem 1rem;
}

/* Estilo para el contenedor de categorías */
#store-submission-modal .max-h-80 {
  scrollbar-width: thin;
  scrollbar-color: rgba(251, 191, 36, 0.5) rgba(251, 191, 36, 0.1);
  max-height: 400px; /* Aumentamos la altura máxima para mostrar más opciones */
  background-color: rgba(251, 191, 36, 0.05); /* Fondo ámbar suave */
  border-radius: 1rem;
  padding: 1rem;
}

/* Estilos para scrollbar en navegadores webkit */
#store-submission-modal .max-h-80::-webkit-scrollbar {
  width: 8px;
}

#store-submission-modal .max-h-80::-webkit-scrollbar-track {
  background: rgba(251, 191, 36, 0.1);
  border-radius: 10px;
}

#store-submission-modal .max-h-80::-webkit-scrollbar-thumb {
  background: rgba(251, 191, 36, 0.5);
  border-radius: 10px;
}

#store-submission-modal .max-h-80::-webkit-scrollbar-thumb:hover {
  background: rgba(251, 191, 36, 0.7);
}

/* Estilos responsivos */
@media (max-width: 768px) {
  #store-submission-modal > div:last-child {
    width: 95%;
    max-height: 85vh;
  }

  /* Mejoramos la visualización en móviles */
  #store-submission-modal .max-h-80 {
    max-height: 300px;
  }

  /* Ajustes para el diseño en móviles */
  #store-submission-modal .md\:w-2\/5,
  #store-submission-modal .md\:w-3\/5 {
    width: 100%;
  }

  #store-submission-modal .md\:w-2\/5 {
    border-radius: 0;
    padding-bottom: 2rem;
  }

  /* Ocultamos el testimonio en móviles para ahorrar espacio */
  #store-submission-modal .md\:w-2\/5 .mt-10 {
    display: none;
  }
}

/* Animación para mensajes de éxito */
#submission-success {
  animation: modalFadeIn 0.5s ease-out;
}

#submission-success .bg-green-50 {
  animation: pulse 2s infinite;
}

/* Estilos para categorías jerárquicas */
#store-submission-modal .category-item {
  margin-bottom: 0.5rem;
}

#store-submission-modal .category-item .pl-4 {
  border-left: 2px solid rgba(251, 191, 36, 0.3);
  margin-left: 0.5rem;
  padding-top: 0.5rem;
  padding-bottom: 0.25rem;
}

/* Estilo para mensajes de error */
.text-red-600 {
  animation: modalFadeIn 0.3s ease-out;
}

/* Estilos para el contador de categorías */
.category-counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(251, 191, 36, 0.2);
  color: #b45309; /* amber-700 */
  font-size: 0.75rem;
  font-weight: 600;
  height: 1.5rem;
  min-width: 1.5rem;
  padding: 0 0.5rem;
  border-radius: 9999px;
  margin-left: 0.5rem;
  transition: all 0.3s ease;
}

.category-counter.max-reached {
  background-color: rgba(239, 68, 68, 0.2);
  color: #b91c1c; /* red-700 */
}

/* Estilos para categorías deshabilitadas cuando se alcanza el máximo */
.store-category:disabled + label {
  opacity: 0.5;
  cursor: not-allowed;
  color: #9ca3af; /* gray-400 */
}

/* Mejoramos la visualización del mensaje de error de categorías */
#store-categories-error {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background-color: rgba(239, 68, 68, 0.1);
  border-radius: 0.5rem;
  margin-top: 0.5rem;
}

#store-categories-error::before {
  content: "";
  display: block;
  width: 0.75rem;
  height: 0.75rem;
  background-color: #ef4444; /* red-500 */
  border-radius: 50%;
}

/* Animación para el contador */
@keyframes pulse-count {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

.category-counter.animate {
  animation: pulse-count 0.3s ease-in-out;
}

/* Animación para el botón de abrir modal */
#open-store-modal {
  transition: all 0.3s ease;
}

#open-store-modal:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

#open-store-modal:active {
  transform: translateY(0);
}

/* Estilos para los iconos de beneficios */
#store-submission-modal .flex-shrink-0.w-10.h-10 {
  transition: all 0.3s ease;
}

#store-submission-modal .flex.items-start:hover .flex-shrink-0.w-10.h-10 {
  transform: scale(1.1);
}

/* Efecto de brillo para el badge de "Totalmente gratis" */
#store-submission-modal .bg-amber-200.px-4.py-1\.5 {
  position: relative;
  overflow: hidden;
}

#store-submission-modal .bg-amber-200.px-4.py-1\.5::after {
  content: "";
  position: absolute;
  top: -50%;
  right: -50%;
  bottom: -50%;
  left: -50%;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0),
    rgba(255, 255, 255, 0.5) 50%,
    rgba(255, 255, 255, 0)
  );
  transform: rotateZ(60deg) translate(-5em, 7.5em);
  animation: shine 3s infinite;
}

/* Efecto de flotación para el testimonio */
#store-submission-modal .mt-10.bg-white {
  animation: float 6s ease-in-out infinite;
}

/* Mejoras para los inputs con iconos */
#store-submission-modal .relative .absolute svg {
  transition: all 0.3s ease;
}

#store-submission-modal .relative:focus-within .absolute svg {
  color: #b45309; /* amber-700 */
}

/* Efecto de gradiente para el fondo del modal */
#store-submission-modal .bg-gradient-to-r,
#store-submission-modal .bg-gradient-to-b {
  background-size: 200% 200%;
  animation: gradientAnimation 15s ease infinite;
}

@keyframes gradientAnimation {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Mejoras para el botón de cierre */
#store-submission-modal .close-modal {
  transition: all 0.3s ease;
}

#store-submission-modal .close-modal:hover {
  transform: rotate(90deg);
}

/* Estilo para el aviso de privacidad */
#store-submission-modal .bg-amber-50.p-4.rounded-xl {
  position: relative;
  overflow: hidden;
}

#store-submission-modal .bg-amber-50.p-4.rounded-xl::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    45deg,
    rgba(251, 191, 36, 0.1) 0%,
    rgba(251, 191, 36, 0) 70%
  );
  z-index: 0;
}

#store-submission-modal .bg-amber-50.p-4.rounded-xl > * {
  position: relative;
  z-index: 1;
}

/* Animación para el checkmark de éxito */
@keyframes checkmark {
  0% {
    stroke-dashoffset: 100;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

.success-checkmark {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: checkmark 1s ease-in-out forwards;
}

/* Confeti para el mensaje de éxito */
.confetti-container {
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(-100px);
    opacity: 1;
  }
  100% {
    transform: translateY(600px);
    opacity: 0;
  }
}

@keyframes confetti-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(5px);
  }
  50% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(3px);
  }
}

/* Generamos confeti con CSS */
.confetti-container::before,
.confetti-container::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  background-color: #fcd34d; /* amber-300 */
  animation: confetti-fall 3s linear infinite,
    confetti-shake 2s ease-in-out infinite;
}

.confetti-container::before {
  left: 10%;
  top: -10px;
  animation-delay: 0.5s;
}

.confetti-container::after {
  left: 20%;
  top: -20px;
  animation-delay: 1s;
  background-color: #34d399; /* green-400 */
}

/* Generamos más confeti con pseudo-elementos */
.confetti-container::before,
.confetti-container::after,
.confetti-piece {
  content: "";
  position: absolute;
  width: 8px;
  height: 16px;
  background-color: #fcd34d; /* amber-300 */
  animation: confetti-fall 3s linear infinite,
    confetti-shake 2s ease-in-out infinite;
}

/* Creamos múltiples piezas de confeti con JavaScript */
.confetti-piece:nth-child(2n) {
  background-color: #34d399; /* green-400 */
}

.confetti-piece:nth-child(3n) {
  background-color: #60a5fa; /* blue-400 */
}

.confetti-piece:nth-child(4n) {
  background-color: #f87171; /* red-400 */
}

.confetti-piece:nth-child(5n) {
  background-color: #a78bfa; /* purple-400 */
}

/* Animación para los botones de acción en el mensaje de éxito */
#submission-success .inline-block {
  transition: all 0.3s ease;
}

#submission-success .bg-amber-500:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Animación para el título del mensaje de éxito */
#submission-success h3 {
  background: linear-gradient(to right, #b45309, #fbbf24, #b45309);
  background-size: 200% auto;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shine-text 3s linear infinite;
}

@keyframes shine-text {
  to {
    background-position: 200% center;
  }
}

/* Corrección para los iconos solapados en los campos de formulario */
#store-submission-form .relative {
  position: relative;
}

#store-submission-form .relative .absolute {
  position: absolute;
  z-index: 10;
  pointer-events: none;
}

#store-submission-form input[type="url"],
#store-submission-form input[type="text"] {
  padding-left: 2.5rem !important; /* Aseguramos suficiente espacio para el icono */
}

/* Mejoramos la visualización en dispositivos móviles */
@media (max-width: 640px) {
  #store-submission-form input[type="url"],
  #store-submission-form input[type="text"] {
    font-size: 16px; /* Evita el zoom automático en iOS */
  }

  /* Ajustamos el padding para evitar solapamiento en pantallas pequeñas */
  #store-submission-form .relative .absolute {
    left: 0.5rem;
  }

  #store-submission-form input[type="url"],
  #store-submission-form input[type="text"] {
    padding-left: 2rem !important;
  }
}
