/* Estilos para Reto Gratis (reto/gratis.html) */


  body {
    overflow-x: hidden;
  }

  html[data-theme="dark"] label {
    color: #fff !important;
  }

  html[data-theme="dark"] #main.reto-gratis-center {
    background: linear-gradient(120deg, #0b1020 0%, #0f172a 100%) !important;
    background-image: none !important;
  }

  html[data-theme="dark"] .card.gratis-card {
    background: rgba(15, 23, 42, 0.96) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 16px 48px 0 rgba(0, 0, 0, 0.55), 0 2px 8px 0 rgba(0, 0, 0, 0.25) !important;
  }

  html[data-theme="dark"] #form-registro,
  html[data-theme="dark"] #form-login {
    background: rgba(2, 6, 23, 0.65) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45) !important;
  }

  html[data-theme="dark"] #form-registro label,
  html[data-theme="dark"] #form-login label {
    color: rgba(255, 255, 255, 0.9) !important;
  }

  html[data-theme="dark"] #form-registro .form-control,
  html[data-theme="dark"] #form-login .form-control {
    background: rgba(15, 23, 42, 0.9) !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
    color: rgba(255, 255, 255, 0.92) !important;
  }

  html[data-theme="dark"] #form-registro .form-control:focus,
  html[data-theme="dark"] #form-login .form-control:focus {
    background: rgba(15, 23, 42, 0.95) !important;
    border-color: rgba(16, 185, 129, 0.65) !important;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.35) !important;
  }

  html[data-theme="dark"] #mensaje-error {
    border-color: rgba(248, 113, 113, 0.6) !important;
    background: rgba(127, 29, 29, 0.35) !important;
    color: rgba(254, 226, 226, 0.95) !important;
  }

  html[data-theme="dark"] #acceso-gratis-form .button,
  html[data-theme="dark"] #btn-mostrar-correo {
    background-color: rgba(15, 23, 42, 0.85) !important;
    color: rgba(255, 255, 255, 0.92) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
  }

  html[data-theme="dark"] #acceso-gratis-form .position-relative.my-3 {
    background-color: rgba(255, 255, 255, 0.12) !important;
  }

  html[data-theme="dark"] .text-muted,
  html[data-theme="dark"] small.text-muted {
    color: rgba(255, 255, 255, 0.68) !important;
  }

  html[data-theme="dark"] .card.gratis-card>.text-center.p-3,
  html[data-theme="dark"] .card.gratis-card>.text-center.p-3.p-md-4 {
    background: linear-gradient(135deg, rgba(2, 6, 23, 0.9) 0%, rgba(15, 23, 42, 0.9) 100%) !important;
  }

  html[data-theme="dark"] .card.gratis-card h2,
  html[data-theme="dark"] .card.gratis-card h2 * {
    color: rgba(167, 243, 208, 0.95) !important;
    text-shadow: none !important;
  }

  html[data-theme="dark"] .card.gratis-card .mb-4 {
    background: rgba(15, 23, 42, 0.92) !important;
    color: rgba(255, 255, 255, 0.9) !important;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45) !important;
  }

  html[data-theme="dark"] .card.gratis-card .mb-4 strong {
    color: rgba(255, 255, 255, 0.92) !important;
  }

  html[data-theme="dark"] .card.gratis-card .mb-4 [style*="background: #e8f5e9"],
  html[data-theme="dark"] .card.gratis-card .mb-4 [style*="background:#e8f5e9"],
  html[data-theme="dark"] .card.gratis-card .mb-4 [style*="background: #e8f5e9;"] {
    background: rgba(16, 185, 129, 0.18) !important;
  }

  html[data-theme="dark"] .card.gratis-card .mb-4 i {
    color: rgba(167, 243, 208, 0.95) !important;
  }

  html[data-theme="dark"] .alert.alert-info {
    background: rgba(59, 130, 246, 0.16) !important;
    color: rgba(219, 234, 254, 0.95) !important;
    border: 1px solid rgba(59, 130, 246, 0.22) !important;
  }

  html[data-theme="dark"] .alert.alert-danger {
    background-color: rgba(127, 29, 29, 0.35) !important;
    color: rgba(254, 226, 226, 0.95) !important;
    border-color: rgba(248, 113, 113, 0.6) !important;
  }

  html[data-theme="dark"] #form-verificar-email-inicial,
  html[data-theme="dark"] #form-verificar-email-inicial h2,
  html[data-theme="dark"] #form-login h2,
  html[data-theme="dark"] #form-registro h2 {
    color: rgba(255, 255, 255, 0.92) !important;
  }

  html[data-theme="dark"] #form-verificar-email-inicial {
    background: rgba(2, 6, 23, 0.65) !important;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
  }

  html[data-theme="dark"] #form-verificar-email-inicial input,
  html[data-theme="dark"] #form-login input,
  html[data-theme="dark"] #form-registro input {
    background-color: rgba(15, 23, 42, 0.9) !important;
    color: rgba(255, 255, 255, 0.92) !important;
    box-shadow: rgba(255, 255, 255, 0.12) 0px 0px 0px 1px !important;
  }

  html[data-theme="dark"] #form-login input[readonly],
  html[data-theme="dark"] #form-registro input[readonly] {
    background-color: rgba(15, 23, 42, 0.65) !important;
    color: rgba(255, 255, 255, 0.88) !important;
  }

  html[data-theme="dark"] #volver-email-login,
  html[data-theme="dark"] #volver-email-registro,
  html[data-theme="dark"] #form-login .btn.btn-link,
  html[data-theme="dark"] #form-registro .btn.btn-link {
    color: rgba(255, 255, 255, 0.72) !important;
  }

  html[data-theme="dark"] #btn-cancelar-correo {
    background: rgba(148, 163, 184, 0.18) !important;
    color: rgba(255, 255, 255, 0.85) !important;
  }

  html[data-theme="dark"] #acceso-gratis-form a {
    color: rgba(56, 189, 248, 0.95) !important;
  }

  html[data-theme="dark"] #acceso-gratis-form a:hover {
    color: rgba(125, 211, 252, 0.98) !important;
  }

  /* Estilos para campos con error */
  .form-control.is-invalid {
    border-color: #dc3545;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
  }

  .form-control.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
  }

  .form-check-input.is-invalid {
    border-color: #dc3545;
  }

  .form-check-input.is-invalid:checked {
    background-color: #dc3545;
  }

  .form-check-input.is-invalid:focus {
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
  }

  .invalid-feedback {
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #dc3545;
    display: none;
  }

  .was-validated .form-control:invalid~.invalid-feedback,
  .was-validated .form-check-input:invalid~.invalid-feedback,
  .is-invalid~.invalid-feedback {
    display: block;
  }

  #main.reto-gratis-center {
    min-height: auto;
    padding: 2rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(120deg, #e8f5e8 0%, #f0f8f0 100%);
  }

  .card.gratis-card {
    max-width: 950px;
    width: 90%;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.98);
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 10px 36px 0 rgba(40, 60, 40, 0.16), 0 1.5px 6px 0 rgba(40, 60, 40, 0.07);
    border: 1.5px solid #c3e6c3;
    margin: 2rem auto;
    padding: 2.7rem 2.2rem 2.2rem 2.2rem;
    transition: box-shadow 0.2s;
  }

  .card.gratis-card:hover {
    box-shadow: 0 16px 48px 0 rgba(40, 60, 40, 0.19), 0 2px 8px 0 rgba(40, 60, 40, 0.09);
  }

  #form-registro .form-control,
  #form-login .form-control {
    border-radius: 10px;
    font-size: 1.15rem;
    padding: 0.75rem 2.5rem 0.75rem 1.3rem;
    border: 1.5px solid #a8d4a8;
    background: linear-gradient(90deg, #f8fcf8 80%, #e8f5e8 100%);
    margin-bottom: 0.9rem;
    width: 100%;
    max-width: 370px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    height: auto;
  }

  #form-registro .form-control:focus,
  #form-login .form-control:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 2px #28a74544;
    background: #f0fff0;
  }

  #form-registro label,
  #form-login label {
    font-weight: 700;
    color: #1a331a;
    margin-bottom: 0.25rem;
    display: block;
    text-align: left;
    width: 100%;
    max-width: 370px;
    margin-left: auto;
    margin-right: auto;
    letter-spacing: 0.01em;
  }

  #form-registro {
    background: linear-gradient(120deg, #f7fff7 80%, #e3f0e3 100%);
    border-radius: 16px;
    border: 1.5px solid #c3e6c3;
    padding: 2.3rem 2.3rem 1.8rem 2.3rem;
    margin-bottom: 1.2rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
    transition: box-shadow 0.2s;
  }

  #mensaje-error {
    font-size: 1.13rem;
    border-radius: 10px;
    border: 1.5px solid #e57373;
    background: linear-gradient(90deg, #fff0f0 80%, #ffeaea 100%);
    color: #b71c1c;
    margin-top: 1.1rem;
    margin-bottom: 0.5rem;
    padding: 1.05rem 1.3rem;
    text-align: center;
    max-width: 370px;
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 1px 6px rgba(200, 40, 40, 0.07);
  }

  .spinner-border.spinner-border-sm {
    width: 1.3rem;
    height: 1.3rem;
    border-width: 0.18em;
    margin-right: 0.6rem;
    vertical-align: middle;
    filter: drop-shadow(0 0 2px #a8d4a8);
  }

  .btn-success-custom {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border: none;
    color: white;
    font-weight: 600;
    border-radius: 10px;
    padding: 0.8rem 1.2rem;
    font-size: 1.1rem;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
    min-width: 280px;
  }

  .btn-success-custom:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
    background: linear-gradient(135deg, #218838 0%, #1e7e34 100%);
  }

  @media (max-width: 768px) {
    .card.gratis-card {
      max-width: 100%;
      padding: 1rem 0.5rem;
      margin: 0;
      width: 100%;
      border-radius: 0;
    }

    .btn-comenzar {
      min-width: 100% !important;
      padding: 1rem 0.8rem !important;
      font-size: 1.1rem !important;
      white-space: normal !important;
      word-wrap: break-word !important;
      min-height: auto !important;
      display: flex !important;
      align-items: center !important;
      justify-content: center !important;
      text-align: center !important;
    }

    .btn-comenzar span {
      white-space: normal !important;
      word-wrap: break-word !important;
    }

    #form-registro,
    #form-login {
      padding: 0.7rem 0.2rem 0.7rem 0.2rem;
      max-width: 100%;
    }

    #form-registro .form-control,
    #form-login .form-control,
    #form-registro label,
    #mensaje-error {
      max-width: 100%;
    }
  }

  /* Ensure button stays within viewport */
  .btn-comenzar {
    color: white !important;
    width: 100%;
    max-width: 320px;
    min-height: 60px;
    margin: 1.5rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.3;
    padding: 0.8rem 1.2rem;
  }

  /* Ensure card doesn't overflow on small screens */
  @media (max-width: 768px) {
    .card.gratis-card {
      width: 100%;
      max-width: 100%;
      margin: 0;
      border-radius: 0;
      min-height: auto;
      padding: 0.5rem;
    }

    .mb-4 {
      padding: 1rem !important;
      margin: 0.5rem auto !important;
      width: auto !important;
      max-width: 100% !important;
      display: block !important;
    }
  }


/* Accesibilidad: Reducción de movimiento */
@media (prefers-reduced-motion: reduce) {
    body.user-reduced-motion *, body.user-reduced-motion ::before, body.user-reduced-motion ::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* Botón toggle password */
.password-toggle-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  line-height: 1;
  border-radius: 8px;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease, color 0.2s ease;
  z-index: 5;
  opacity: 0;
  pointer-events: none;
}

input:not(:placeholder-shown) ~ .password-toggle-btn,
input:not(:placeholder-shown) + .password-toggle-btn,
.password-toggle-btn.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.password-toggle-btn:hover,
.password-toggle-btn:focus {
  color: #1e293b;
  background: rgba(0, 0, 0, 0.06);
  outline: none;
}

.password-toggle-btn i {
  font-size: 1.05rem;
  line-height: 1;
}
