/**
 * Estilos para Formulario de Crédito Multi-Paso
 * Colores de marca: #039595 (Turquesa) y #de1a12 (Rojo Pirámide)
 * Fuente: Rubik
 */

.formulario-credito-wrapper {
  max-width: 1400px;
  margin: 40px auto;
  padding: 0 20px;
  font-family: "Rubik", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
}

.credito-header {
  background: linear-gradient(135deg, #039595 0%, #027272 100%);
  color: white;
  padding: 40px 30px;
  border-radius: 16px 16px 0 0;
  text-align: center;
  box-shadow: 0 4px 16px rgba(3, 149, 149, 0.2);
}

.credito-header h1 {
  margin: 0;
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.5px;
  color: #fff;
}

.credito-content {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 30px;
  background: #f5f7fa;
  padding: 30px;
  border-radius: 0 0 16px 16px;
}

/* Columna del formulario */
.credito-form-column {
  background: white;
  padding: 40px;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

/* Progress indicator */
.form-progress {
  display: flex;
  justify-content: space-between;
  margin-bottom: 40px;
  position: relative;
  padding: 0 10px;
}

.form-progress::before {
  content: "";
  position: absolute;
  top: 20px;
  left: 10%;
  right: 10%;
  height: 3px;
  background: #e8ecef;
  z-index: 0;
  border-radius: 2px;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
  flex: 1;
  cursor: pointer;
  transition: all 0.3s ease;
}

.step-number {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: white;
  border: 3px solid #e8ecef;
  color: #8b95a1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 10px;
  transition: all 0.3s ease;
}

.progress-step.active .step-number {
  background: linear-gradient(135deg, #039595 0%, #027272 100%);
  border-color: #039595;
  color: white;
  box-shadow: 0 4px 16px rgba(3, 149, 149, 0.35);
  transform: scale(1.05);
}

.progress-step.completed .step-number {
  background: #039595;
  border-color: #039595;
  color: white;
}

.progress-step.completed .step-number::after {
  content: "✓";
  font-size: 18px;
}

.step-label {
  font-size: 13px;
  color: #8b95a1;
  text-align: center;
  max-width: 130px;
  line-height: 1.3;
  transition: color 0.3s ease;
}

.progress-step.active .step-label {
  color: #039595;
  font-weight: 600;
}

/* Form steps */
.form-step {
  display: none;
}

.form-step.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.form-step h2 {
  font-size: 28px;
  margin-bottom: 10px;
  color: #1a2332;
  font-weight: 600;
}

.form-step h3 {
  font-size: 20px;
  margin: 35px 0 20px;
  color: #039595;
  padding-bottom: 12px;
  border-bottom: 2px solid #e8ecef;
  font-weight: 600;
}

.step-description {
  color: #5f6c7b;
  margin-bottom: 25px;
  font-size: 14px;
}

/* Caja de información del producto desde URL */
.producto-info-box {
  background: linear-gradient(135deg, #f0fafa 0%, #e6f9f9 100%);
  border: 2px solid #039595;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 30px;
}

.producto-info-box h3 {
  margin: 0 0 15px 0 !important;
  color: #039595 !important;
  font-size: 18px !important;
  font-weight: 600 !important;
  padding: 0 !important;
  border: none !important;
}

.producto-info-content p {
  margin: 8px 0;
  color: #1a2332;
  font-size: 14px;
  line-height: 1.6;
}

.producto-info-content strong {
  color: #039595;
  font-weight: 600;
  min-width: 140px;
  display: inline-block;
}

/* Progress bar dentro de cada paso */
.form-progress-bar {
  height: 8px;
  background: #e8ecef;
  border-radius: 4px;
  margin-bottom: 30px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #de1a12 0%, #ff3b2f 100%);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(222, 26, 18, 0.3);
}

/* Form groups */
.form-group {
  margin-bottom: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-group.half {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #1a2332;
  font-weight: 500;
  font-size: 14px;
}

.required {
  color: #de1a12;
  margin-left: 2px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group textarea {
  width: 100%;
  padding: 5px 10px;
  border: 2px solid #e8ecef;
  border-radius: 10px;
  font-size: 15px;
  font-family: "Rubik", sans-serif;
  transition: all 0.3s ease;
  background: #ffffff;
  color: #1a2332;
}

.form-group input[type="text"]:hover,
.form-group input[type="email"]:hover,
.form-group input[type="tel"]:hover,
.form-group select:hover,
.form-group textarea:hover {
  border-color: #039595;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="tel"]:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #039595;
  box-shadow: 0 0 0 4px rgba(3, 149, 149, 0.1);
  background: #ffffff;
}

.form-group input.error,
.form-group select.error,
.form-group textarea.error {
  border-color: #de1a12;
  background: #fff5f5;
}

.form-group input.error:focus,
.form-group select.error:focus,
.form-group textarea.error:focus {
  box-shadow: 0 0 0 4px rgba(222, 26, 18, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-group small {
  display: block;
  margin-top: 8px;
  color: #5f6c7b;
  font-size: 13px;
  line-height: 1.4;
}

/* Radio buttons */
.radio-group {
  display: flex;
  gap: 24px;
  padding: 10px 0;
}

.radio-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: normal;
  padding: 10px 16px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.radio-label:hover {
  background: #f5f7fa;
}

.radio-label input[type="radio"] {
  margin-right: 10px;
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: #039595;
}

.radio-group.error {
  padding: 12px;
  background: #fff5f5;
  border-radius: 8px;
  border: 2px solid #de1a12;
}

/* Checkbox */
.checkbox-label {
  display: flex;
  align-items: flex-start;
  cursor: pointer;
  padding: 16px;
  border: 2px solid #e8ecef;
  border-radius: 10px;
  transition: all 0.3s ease;
  background: white;
}

.checkbox-label:hover {
  border-color: #039595;
  background: #f0fafa;
}

.checkbox-label.error {
  border-color: #de1a12;
  background: #fff5f5;
}

.checkbox-label input[type="checkbox"] {
  margin-right: 14px;
  width: 22px;
  height: 22px;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
  accent-color: #039595;
}

/* File inputs */
.form-group input[type="file"] {
  width: 100%;
  padding: 14px;
  border: 2px dashed #e8ecef;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #fafbfc;
  font-size: 14px;
}

.form-group input[type="file"]:hover {
  border-color: #039595;
  background: #f0fafa;
}

.form-group input[type="file"]:focus {
  outline: none;
  border-color: #039595;
  box-shadow: 0 0 0 4px rgba(3, 149, 149, 0.1);
}

/* Error messages */
.error-message {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #de1a12;
  font-size: 13px;
  margin-top: 8px;
  font-weight: 500;
  animation: slideDown 0.3s ease;
}

.error-message::before {
  content: "⚠";
  font-size: 14px;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Navigation buttons */
.form-navigation {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-top: 40px;
  padding-top: 30px;
  border-top: 2px solid #e8ecef;
}

.btn-prev,
.btn-next,
.btn-submit {
  padding: 16px 36px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  font-family: "Rubik", sans-serif;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn-prev {
  background: #f5f7fa;
  color: #5f6c7b;
  border: 2px solid #e8ecef;
}

.btn-prev:hover {
  background: #e8ecef;
  color: #1a2332;
  border-color: #d0d5dd;
  transform: translateX(-3px);
}

.btn-next,
.btn-submit {
  background: linear-gradient(135deg, #039595 0%, #027272 100%);
  color: white;
  margin-left: auto;
  box-shadow: 0 4px 12px rgba(3, 149, 149, 0.25);
}

.btn-next:hover,
.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(3, 149, 149, 0.35);
}

.btn-next:active,
.btn-submit:active {
  transform: translateY(0);
}

.btn-submit {
  background: linear-gradient(135deg, #de1a12 0%, #b91510 100%);
  box-shadow: 0 4px 12px rgba(222, 26, 18, 0.25);
  position: relative;
}

.btn-submit:hover {
  box-shadow: 0 6px 20px rgba(222, 26, 18, 0.35);
}

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Loading spinner para botón submit */
.btn-submit.loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
  to {
    transform: rotate(360deg);
  }
}

/* Columna del carrito */
.credito-cart-column {
  position: sticky;
  top: 200px;
  align-self: flex-start;
}

.cart-summary {
  background: white;
  padding: 30px;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  border: 2px solid #e8ecef;
}

.cart-summary h3 {
  margin: 0 0 20px 0;
  font-size: 20px;
  color: #1a2332;
  font-weight: 600;
}

.cart-items {
  margin-bottom: 25px;
  max-height: 500px;
  overflow-y: auto;
  padding-right: 5px;
}

/* Scrollbar personalizado */
.cart-items::-webkit-scrollbar {
  width: 6px;
}

.cart-items::-webkit-scrollbar-track {
  background: #f5f7fa;
  border-radius: 3px;
}

.cart-items::-webkit-scrollbar-thumb {
  background: #039595;
  border-radius: 3px;
}

.cart-items::-webkit-scrollbar-thumb:hover {
  background: #027272;
}

.cart-item {
  display: flex;
  gap: 15px;
  padding: 15px 0;
  border-bottom: 1px solid #e8ecef;
  transition: all 0.2s ease;
}

.cart-item:hover {
  background: #fafbfc;
}

.cart-item:last-child {
  border-bottom: none;
}

.item-image {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #f5f7fa;
  border: 2px solid #e8ecef;
}

.item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-details {
  display: flex;
  flex-direction: column;
  align-items: end;
  gap: 8px;
}

.item-details h4 {
  margin: 0 0 6px 0;
  font-size: 14px;
  color: #1a2332;
  line-height: 1.4;
  font-weight: 600;
}

.item-details .sku {
  margin: 0 0 6px 0;
  font-size: 12px;
  color: #8b95a1;
}

.item-details .price {
  margin: 0 0 4px 0;
  font-size: 14px;
  color: #039595;
  font-weight: 600;
}

.item-details del {
  display: none;
}

.item-details .quantity {
  margin: 0;
  font-size: 12px;
  color: #5f6c7b;
}

/* Cart totals */
.cart-totals {
  padding-top: 20px;
  border-top: 2px solid #e8ecef;
}

.total-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  font-size: 14px;
  color: #5f6c7b;
}

.total-row.final {
  padding: 18px 0 0 0;
  margin-top: 12px;
  border-top: 2px solid #e8ecef;
  font-size: 16px;
  font-weight: 600;
  color: #1a2332;
}

.total-amount {
  color: #de1a12;
  font-size: 22px;
  font-weight: 700;
}

.empty-cart {
  text-align: center;
  padding: 40px 20px;
  color: #8b95a1;
}

/* Success message */
.success-message {
  text-align: center;
  padding: 80px 40px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  animation: fadeInScale 0.5s ease;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.success-icon {
  width: 90px;
  height: 90px;
  margin: 0 auto 25px;
  background: linear-gradient(135deg, #039595 0%, #027272 100%);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  font-weight: bold;
  box-shadow: 0 8px 24px rgba(3, 149, 149, 0.3);
  animation: successPulse 0.6s ease;
}

@keyframes successPulse {
  0% {
    transform: scale(0);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

.success-message h2 {
  margin: 0 0 15px 0;
  color: #1a2332;
  font-size: 32px;
  font-weight: 600;
}

.success-message p {
  margin: 0 0 35px 0;
  color: #5f6c7b;
  font-size: 16px;
  line-height: 1.6;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

/* Credito ID Box */
.credito-id-box {
  background: linear-gradient(135deg, #f0f9f9 0%, #e6f5f5 100%);
  border: 2px solid #039595;
  border-radius: 12px;
  padding: 25px;
  margin: 25px auto;
  max-width: 400px;
}

.credito-id-box strong {
  display: block;
  color: #1a2332;
  font-size: 15px;
  margin-bottom: 12px;
  font-weight: 600;
}

.credito-id {
  font-size: 28px;
  font-weight: 700;
  color: #039595;
  letter-spacing: 1px;
  font-family: 'Courier New', monospace;
  background: white;
  padding: 12px 20px;
  border-radius: 8px;
  display: inline-block;
  box-shadow: 0 2px 8px rgba(3, 149, 149, 0.15);
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 25px;
}

.btn-whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 28px;
  background: linear-gradient(135deg, #25D366 0%, #1ebe57 100%);
  color: white;
  text-decoration: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 15px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.btn-whatsapp:hover {
  background: linear-gradient(135deg, #1ebe57 0%, #128c42 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 211, 102, 0.4);
  color: white;
}

.btn-whatsapp svg {
  flex-shrink: 0;
}

.btn-home {
  display: inline-block;
  padding: 16px 36px;
  background: linear-gradient(135deg, #039595 0%, #027272 100%);
  color: white;
  text-decoration: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 16px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(3, 149, 149, 0.25);
}

.btn-home:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(3, 149, 149, 0.35);
  color: white;
}

/* Responsive */
@media (max-width: 1024px) {
  .credito-content {
    grid-template-columns: 1fr;
  }

  .credito-cart-column {
    position: static;
    order: -1; /* Mostrar carrito primero en móvil */
  }

  .cart-summary {
    margin-bottom: 20px;
  }

  .form-progress {
    flex-direction: column;
    gap: 15px;
  }

  .form-progress::before {
    display: none;
  }

  .progress-step {
    flex-direction: row;
    justify-content: flex-start;
    gap: 15px;
  }

  .step-label {
    text-align: left;
  }
}

@media (max-width: 768px) {
  .credito-header {
    padding: 30px 20px;
  }

  .credito-header h1 {
    font-size: 28px;
  }

  .credito-content {
    padding: 20px 15px;
  }

  .credito-form-column {
    padding: 30px 20px;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .form-group.half {
    margin-bottom: 20px;
  }

  .form-navigation {
    flex-direction: column;
  }

  .btn-next,
  .btn-submit {
    margin-left: 0;
    width: 100%;
  }

  .btn-prev {
    width: 100%;
  }

  .form-step h2 {
    font-size: 24px;
  }

  .form-step h3 {
    font-size: 18px;
  }

  .cart-items {
    max-height: 300px;
  }
}

@media (max-width: 480px) {
  .credito-header h1 {
    font-size: 24px;
  }

  .credito-content {
    padding: 15px 10px;
  }

  .cart-summary {
    padding: 20px 15px;
  }

  .radio-group {
    flex-direction: column;
    gap: 10px;
  }

  .radio-label {
    width: 100%;
  }

  .step-number {
    width: 40px;
    height: 40px;
  }

  .success-message {
    padding: 50px 20px;
  }

  .success-message h2 {
    font-size: 26px;
  }
  
  .credito-id-box {
    padding: 20px 15px;
    margin: 20px auto;
  }
  
  .credito-id {
    font-size: 22px;
    padding: 10px 15px;
  }
  
  .action-buttons {
    flex-direction: column;
    gap: 12px;
  }
  
  .btn-whatsapp,
  .btn-home {
    width: 100%;
    justify-content: center;
  }
}

/* Accesibilidad - Focus visible mejorado */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #039595;
  outline-offset: 2px;
}

/* Animaciones reducidas para usuarios que prefieren menos movimiento */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
