/* ==========================================================================
   Smartmind Forms — CSS base del front (independiente de Elementor y de Ultra)
   --------------------------------------------------------------------------
   · Todo va dentro de @layer smf-forms: cualquier CSS normal (Ultra, tema,
     smartmind-core.css legacy) tiene prioridad sobre este, sin importar el
     orden de carga ni la especificidad. Ultra solo tiene que sobrescribir.
   · Personalización recomendada: redefinir las variables --smf-* en
     .smartmind-form (o en :root) desde Ultra.
   · Para desactivar este CSS por completo:
       add_filter('smf_load_front_css', '__return_false');
   ========================================================================== */
@layer smf-forms {

  .smartmind-form,
  .smform-success {
    --smf-gap: 1em;
    --smf-font-size: 13px;
    --smf-line-height: 24px;
    --smf-label-weight: 500;
    --smf-text: #000;
    --smf-muted: #555;
    --smf-input-bg: #fff;
    --smf-input-color: #000;
    --smf-input-border: 0;
    --smf-input-radius: 20px;
    --smf-input-padding: 15px 30px;
    --smf-input-shadow: 0 1px 20px -5px #ddd;
    --smf-focus-border: 2px solid #000;
    --smf-error: #ff0d68;
    --smf-accent: #04724D;
    --smf-btn-bg: #000;
    --smf-btn-color: #fff;
    --smf-btn-radius: 100px;
    --smf-btn-padding: 10px 30px;
    --smf-btn-transform: uppercase;
    --smf-btn-weight: normal;
    --smf-btn-hover-bg: var(--smf-accent);
    --smf-btn2-bg: #252E42;
    --smf-success-bg: #f7fbff;
    --smf-success-border: #e6e8ef;
    --smf-consent-size: 12px;
    --smf-info-size: 11px;
  }

  /* ---------- Campos ---------- */
  .smartmind-field { margin-bottom: var(--smf-gap); }
  .smartmind-field label { font-weight: var(--smf-label-weight); display: block; }
  .smartmind-form .info-icon { margin-left: 6px; font-size: .85em; cursor: help; color: var(--smf-muted); }

  .smartmind-field select,
  .smartmind-field input[type="text"],
  .smartmind-field input[type="email"],
  .smartmind-field input[type="password"],
  .smartmind-field input[type="tel"],
  .smartmind-field input[type="url"],
  .smartmind-field input[type="number"],
  .smartmind-field input[type="date"],
  .smartmind-field textarea {
    width: 100%;
    font-size: var(--smf-font-size);
    line-height: var(--smf-line-height);
    background: var(--smf-input-bg);
    color: var(--smf-input-color);
    border: var(--smf-input-border);
    padding: var(--smf-input-padding);
    box-shadow: var(--smf-input-shadow);
    border-radius: var(--smf-input-radius);
    max-width: 100%;
    box-sizing: border-box;
  }

  .smartmind-field input:focus-visible,
  .smartmind-field textarea:focus-visible,
  .smartmind-field select:focus-visible { outline: var(--smf-focus-border); outline-offset: 1px; }

  .smartmind-error,
  .smform-error { border: 1.5px solid var(--smf-error); background: #fff0f0; }

  /* ---------- Botones ---------- */
  .smartmind-form .smform-submit,
  .smartmind-form input[type="submit"] {
    position: relative;
    min-width: 120px;
    background: var(--smf-btn-bg);
    color: var(--smf-btn-color);
    border: 0;
    border-radius: var(--smf-btn-radius);
    text-transform: var(--smf-btn-transform);
    font-weight: var(--smf-btn-weight);
    width: 100%;
    text-align: center;
    padding: var(--smf-btn-padding);
    margin: 20px 0;
    cursor: pointer;
  }
  .smartmind-form .smform-submit:hover,
  .smartmind-form .smform-submit:focus-visible { background: var(--smf-btn-hover-bg); }
  .smartmind-form .smform-submit:disabled { opacity: .7; cursor: progress; }

  .smartmind-form .smform-next,
  .smartmind-form .smform-prev {
    background: var(--smf-btn2-bg);
    color: #fff;
    padding: 14px 32px;
    border-radius: 50px;
    display: inline-block;
    border: 0;
    cursor: pointer;
  }
  .smartmind-form .smform-next:hover,
  .smartmind-form .smform-prev:hover { background: var(--smf-btn-hover-bg); }

  /* ---------- Estados ---------- */
  .smartmind-form[aria-busy="true"] { opacity: .6; pointer-events: none; }
  .smartmind-form .smartmind-errors { color: var(--smf-error); margin: 10px 0; }

  /* ---------- Mensaje de éxito ---------- */
  .smform-success { margin-top: 16px; }
  .smform-success-card {
    border: 1px solid var(--smf-success-border);
    border-radius: 12px;
    padding: 18px;
    background: var(--smf-success-bg);
    box-shadow: 0 6px 20px rgba(0,0,0,.06);
  }
  .smform-success-title { margin: 0 0 6px; font-size: 1.1rem; }
  .smform-success-text { margin: 0; opacity: .9; }

  /* ---------- Consentimiento estándar (RGPD) ---------- */
  .smf-consent { margin: 12px 0; }
  .smf-consent .smf-consent-item { margin: 0 0 8px; }
  .smf-consent .smf-consent-label {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    font-weight: 400;
    font-size: var(--smf-consent-size);
    line-height: 1.45;
  }
  .smf-consent .smf-consent-label input { margin: 3px 0 0; flex: 0 0 auto; width: 16px; height: 16px; accent-color: var(--smf-accent); }
  .smf-consent-info { font-size: var(--smf-info-size); line-height: 1.45; opacity: .75; margin: 8px 0 0; }

  /* ---------- Textos dinámicos por paso (landings) ---------- */
  .step2, .step3, .smf-text-step2, .smf-text-step3 { display: none; }
  .smf-step-2-active .step1, .smf-step-2-active .step3,
  .smf-step-2-active .smf-text-step1, .smf-step-2-active .smf-text-step3 { display: none; }
  .smf-step-2-active .step2, .smf-step-2-active .smf-text-step2 { display: block; }
  .smf-step-3-active .step1, .smf-step-3-active .step2,
  .smf-step-3-active .smf-text-step1, .smf-step-3-active .smf-text-step2 { display: none; }
  .smf-step-3-active .step3, .smf-step-3-active .smf-text-step3 { display: block; }

  /* ---------- Variante .smf-cool (labels flotantes) ---------- */
  .smf-cool .smform-step { display: flex; flex-wrap: wrap; }
  .smf-cool .smartmind-field { width: 100%; margin: 10px 5px; }
  .smf-cool .smartmind-field.smf-nombre,
  .smf-cool .smartmind-field.smf-apellidos { width: calc(50% - 10px); }
  .smf-cool .smf-consent { width: 100%; }
  .smf-cool .smform-submit { font-size: 16px; line-height: 24px; font-weight: 600; text-transform: none; }

  .smf-cool .smartmind-field select,
  .smf-cool .smartmind-field input[type="text"],
  .smf-cool .smartmind-field input[type="email"],
  .smf-cool .smartmind-field input[type="password"],
  .smf-cool .smartmind-field input[type="tel"],
  .smf-cool .smartmind-field input[type="url"],
  .smf-cool .smartmind-field input[type="number"],
  .smf-cool .smartmind-field textarea { border: 1px solid #9a9a9a; box-shadow: none; border-radius: 8px; }

  .smf-cool .smartmind-field select {
    appearance: none;
    background-image: url('../../../assets/imgs/arrowdown.svg');
    background-position: 98% center;
    background-size: 25px;
    background-repeat: no-repeat;
  }
  .smf-cool .smartmind-field select.has-value { background-image: url('../../../assets/imgs/arrowup.svg'); }

  .smf-cool .smartmind-form .smartmind-field:not(.smf-privacidad):not(.smf-novedades) { position: relative; }
  .smf-cool .smartmind-form .smartmind-field:not(.smf-privacidad):not(.smf-novedades) :is(input, textarea, select) {
    width: 100%;
    transition: border-color .2s ease, box-shadow .2s ease;
  }
  .smf-cool .smartmind-form .smartmind-field:not(.smf-privacidad):not(.smf-novedades) :is(input, textarea, select):focus-visible {
    border: 2px solid #000;
    outline: none;
  }
  .smf-cool .smartmind-form .smartmind-field:not(.smf-privacidad):not(.smf-novedades) > label {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    line-height: 1;
    color: #333;
    font-weight: 300;
    pointer-events: none;
    transition: top .18s ease, transform .18s ease, font-size .18s ease;
    background-color: #fff;
    padding: 0 6px;
    z-index: 1;
    max-width: calc(100% - 60px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .smf-cool .smartmind-form .smartmind-field.smf-has-value:not(.smf-privacidad):not(.smf-novedades) > label {
    top: -0.75em;
    transform: none;
    font-size: 12px;
  }
  .smf-cool .smf-privacidad { margin: 10px 5px -15px; }
  .smf-cool .smf-privacidad label { display: flex; align-items: center; gap: 15px; font-size: 12px; line-height: 24px; font-weight: 400; }
  .smf-cool .smf-privacidad input { transform: scale(1.5); margin: 0 5px; accent-color: var(--smf-accent); }
  .smf-cool .smf-consent { margin: 4px 5px 0; }

  @media (max-width: 600px) {
    .smf-cool .smartmind-field.smf-nombre,
    .smf-cool .smartmind-field.smf-apellidos { width: 100%; }
  }
}
