/* 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;
  }

  /* Recuadro de Términos y Condiciones */
  .terms-card-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px;
    margin: 1rem 0 1.25rem 0;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  }

  .terms-card-box:hover {
    border-color: #cbd5e1;
    background: #f1f5f9;
  }

  .terms-link {
    color: #2563eb !important;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s ease;
  }

  .terms-link:hover {
    color: #1d4ed8 !important;
  }

  /* Selector de Rango de Edad */
  .age-tier-selector-gratis button,
  .age-tier-selector button {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #64748b;
  }

  .age-tier-selector-gratis button:focus,
  .age-tier-selector button:focus {
    outline: 2px solid rgba(16, 185, 129, 0.4);
    outline-offset: 1px;
  }

  .age-tier-selector-gratis button.active#btn-gratis-age-adult,
  .age-tier-selector-gratis button.active#btn-gratis-age-adult-partial {
    background: rgba(16, 185, 129, 0.1);
    border: 1.5px solid #10b981;
    color: #047857;
    font-weight: 600;
  }

  .age-tier-selector-gratis button.active#btn-gratis-age-minor,
  .age-tier-selector-gratis button.active#btn-gratis-age-minor-partial {
    background: rgba(2, 132, 199, 0.1);
    border: 1.5px solid #0284c7;
    color: #0284c7;
    font-weight: 600;
  }

  html[data-theme="dark"] .age-tier-selector-gratis button:not(.active),
  html[data-theme="dark"] .age-tier-selector button:not(.active) {
    background: rgba(15, 23, 42, 0.75) !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
    color: rgba(255, 255, 255, 0.75) !important;
  }

  html[data-theme="dark"] .age-tier-selector-gratis button.active#btn-gratis-age-adult,
  html[data-theme="dark"] .age-tier-selector-gratis button.active#btn-gratis-age-adult-partial {
    background: rgba(16, 185, 129, 0.2) !important;
    border-color: #34d399 !important;
    color: #6ee7b7 !important;
  }

  html[data-theme="dark"] .age-tier-selector-gratis button.active#btn-gratis-age-minor,
  html[data-theme="dark"] .age-tier-selector-gratis button.active#btn-gratis-age-minor-partial {
    background: rgba(2, 132, 199, 0.2) !important;
    border-color: #38bdf8 !important;
    color: #7dd3fc !important;
  }

  html[data-theme="dark"] #minor-info-gratis,
  html[data-theme="dark"] #minor-info-gratis-partial,
  html[data-theme="dark"] #minor-info-box {
    background: rgba(14, 165, 233, 0.15) !important;
    border-color: rgba(56, 189, 248, 0.35) !important;
    color: #bae6fd !important;
  }

  html[data-theme="dark"] .terms-card-box {
    background: rgba(15, 23, 42, 0.75) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25) !important;
  }

  html[data-theme="dark"] .terms-card-box:hover {
    background: rgba(15, 23, 42, 0.9) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
  }

  html[data-theme="dark"] .terms-link {
    color: #38bdf8 !important;
  }

  html[data-theme="dark"] .terms-link:hover {
    color: #7dd3fc !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,
  #form-verificar-email-inicial .form-control {
    border-radius: 12px;
    font-size: 0.96rem;
    font-weight: 500;
    padding: 0.8rem 1rem;
    border: 1.5px solid rgba(203, 213, 225, 0.85);
    background: #ffffff;
    color: #0f172a;
    margin-bottom: 0.25rem;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    height: auto;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  }

  #form-registro .form-control::placeholder,
  #form-login .form-control::placeholder,
  #form-verificar-email-inicial .form-control::placeholder {
    color: #94a3b8;
    font-size: 0.92rem;
  }

  #form-registro .form-control:focus,
  #form-login .form-control:focus,
  #form-verificar-email-inicial .form-control:focus {
    border-color: #00adb5;
    box-shadow: 0 0 0 3px rgba(0, 173, 181, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
    background: #ffffff;
    outline: none;
  }

  #form-registro label,
  #form-login label,
  #form-verificar-email-inicial label {
    font-weight: 600;
    font-size: 0.88rem;
    color: #334155;
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    text-align: left;
    width: 100%;
    letter-spacing: -0.01em;
  }

  .formbg {
    width: 100%;
    max-width: 440px;
    margin: 0 auto 1.25rem;
    padding: 1.75rem 1.6rem;
    border-radius: 20px;
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: 0 12px 36px rgba(15, 23, 42, 0.06), 0 2px 8px rgba(15, 23, 42, 0.02);
    position: relative;
    box-sizing: border-box;
  }

  #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, #10b981 0%, #059669 100%);
    border: none;
    color: #ffffff !important;
    font-weight: 700;
    border-radius: 12px;
    padding: 0.85rem 1.6rem;
    font-size: 1.02rem;
    letter-spacing: 0.01em;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.28);
    width: 100%;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    text-align: center;
    cursor: pointer;
  }

  .btn-success-custom span,
  .btn-success-custom i {
    color: inherit !important;
  }

  .btn-success-custom:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(16, 185, 129, 0.38);
    filter: brightness(1.05);
  }

  .btn-success-custom:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
  }

  .btn-success-custom:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
  }

  @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;
}

html[data-theme="dark"] .password-toggle-btn {
  color: #94a3b8;
}

html[data-theme="dark"] .password-toggle-btn:hover,
html[data-theme="dark"] .password-toggle-btn:focus {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.1);
}
