/* =========================================
   Diagnostic 360 — Form Styles
   Depende de: site-styles.css
   ========================================= */

#form {

  & .form__container {
    width: 100%;
    max-width: 680px;
    margin-inline: auto;
    border-radius: 20px;
    padding: 48px 40px 40px;
    box-shadow: 0 8px 48px rgba(0, 0, 0, 0.08);
    border: none;
    outline: none;

    /* Cabecera */
    & > div:first-child {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin-bottom: 8px;

      h2 {
        font-size: clamp(1.5rem, 2vw, 1.875rem);
        font-weight: 700;
        color: var(--stb-dark-gray);
      }

      p {
        font-size: 0.95rem;
        color: var(--stb-gray);
      }
    }

    & .form-content {
      width: 100%;

      & .wpcf7 {
        width: 100%;
      }

      & form .form-grid {
        display: flex;
        flex-direction: column;
        gap: 20px;

        /* ---- Form group base ---- */
        .form-group {
          display: flex;
          flex-direction: column;
          gap: 8px;
          width: 100%;
        }

        /* ---- Labels ---- */
        label {
          display: block;
          font-size: 0.68rem;
          font-weight: 600;
          text-transform: uppercase;
          letter-spacing: 0.1em;
          color: var(--stb-gray-dark);
        }

        /* ---- Inputs, Textareas, Selects ---- */
        input[type="text"],
        input[type="email"],
        input[type="number"],
        input[type="tel"],
        textarea,
        select {
          width: 100%;
          background-color: #f5f5f5;
          border: 1.5px solid transparent;
          border-radius: 8px;
          padding: 12px 16px;
          font-size: 0.95rem;
          color: var(--stb-dark-gray);
          outline: none;
          transition: border-color 0.2s ease, background-color 0.2s ease;
          font-family: inherit;
          appearance: none;
          -webkit-appearance: none;
          box-sizing: border-box;

          &::placeholder {
            color: #b8b8b8;
          }

          &:focus {
            border-color: var(--stb-pink);
            background-color: #ffffff;
          }
        }

        /* ---- Select con flecha ---- */
        select {
          background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235A5A5A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
          background-repeat: no-repeat;
          background-position: right 14px center;
          padding-right: 42px;
          cursor: pointer;
        }

        /* ---- Textarea ---- */
        textarea {
          resize: vertical;
          min-height: 110px;
          line-height: 1.5;
        }

        /* ---- Slider (range-group) ---- */
        .range-group {

          label {
            display: flex;
            align-items: center;
            gap: 8px;

            &::after {
              content: "(Opcional)";
              font-size: 0.7rem;
              font-weight: 500;
              text-transform: none;
              letter-spacing: 0;
              color: var(--stb-pink);
            }
          }

          /* Badge de valor — inyectado por JS justo antes del input range */
          .range-badge {
            display: flex;
            justify-content: center;
            margin-bottom: 4px;

            span {
              background: var(--stb-gradient-pink-to-yellow-orange);
              color: #fff;
              font-size: 0.82rem;
              font-weight: 700;
              padding: 4px 16px;
              border-radius: 20px;
            }
          }

          /* Span wrapper que CF7 pone alrededor del input range */
          .wpcf7-form-control-wrap {
            display: block;
            width: 100%;
          }

          /* El input range ocupa todo el ancho */
          input[type="range"] {
            -webkit-appearance: none;
            appearance: none;
            width: 100%;
            display: block;
            height: 4px;
            border-radius: 2px;
            background: linear-gradient(
              to right,
              var(--stb-pink) 0%,
              var(--stb-pink) var(--range-progress, 0%),
              #e0e0e0 var(--range-progress, 0%),
              #e0e0e0 100%
            ) !important;
            border: none !important;
            padding: 0 !important;
            margin: 0;
            cursor: pointer;
            box-sizing: border-box;
            background-color: transparent !important;

            &:focus {
              border-color: transparent !important;
              background-color: transparent !important;
              outline: none;
            }

            &::-webkit-slider-thumb {
              -webkit-appearance: none;
              appearance: none;
              width: 20px;
              height: 20px;
              border-radius: 50%;
              background: var(--stb-pink);
              box-shadow: 0 2px 8px rgba(245, 87, 126, 0.45);
              cursor: pointer;
              transition: transform 0.15s ease, box-shadow 0.15s ease;
            }

            &::-moz-range-thumb {
              width: 20px;
              height: 20px;
              border-radius: 50%;
              background: var(--stb-pink);
              box-shadow: 0 2px 8px rgba(245, 87, 126, 0.45);
              border: none;
              cursor: pointer;
            }

            &:active::-webkit-slider-thumb {
              transform: scale(1.2);
              box-shadow: 0 4px 14px rgba(245, 87, 126, 0.55);
            }
          }

          /* Etiquetas min / centro / max */
          .range-values>p {
            display: flex;
            justify-content: space-between;
            font-size: 0.68rem;
            color: var(--stb-gray);
            text-transform: uppercase;
            letter-spacing: 0.05em;
            margin-top: 4px;
          }
        }

        /* ---- Botón submit ---- */
        p:has(.wpcf7-submit),
        .form-group:has(.wpcf7-submit) {
          position: relative;

          .wpcf7-submit {
            width: 100%;
            height: 52px;
            border: none;
            cursor: pointer;
            border-radius: 10px;
            background: var(--stb-gradient-pink-to-yellow-orange);
            color: #fff;
            font-size: 1rem;
            font-weight: 600;
            letter-spacing: 0.01em;
            transition: filter 0.2s ease, transform 0.15s ease;
            font-family: inherit;

            &:hover {
              filter: brightness(108%);
            }

            &:active {
              transform: scale(0.99);
            }
          }

          .wpcf7-spinner {
            position: absolute;
            top: 50%;
            translate: 0 -50%;
            right: 20px;
            margin: 0;
          }
        }

        /* ---- Mensajes de validación ---- */
        .wpcf7-not-valid-tip {
          font-size: 0.75rem;
          color: #e53e3e;
          margin-top: 2px;
          display: block;
        }

        .wpcf7-not-valid {
          border-color: #fc8181 !important;
          background-color: #fff5f5 !important;
        }

        .wpcf7-response-output {
          margin-top: 4px;
          padding: 12px 16px;
          border-radius: 8px;
          font-size: 0.85rem;
          border: none !important;
        }

        .wpcf7-mail-sent-ok {
          background-color: #f0fff4;
          color: #276749;
        }

        .wpcf7-mail-sent-ng,
        .wpcf7-aborted {
          background-color: #fff5f5;
          color: #9b2c2c;
        }

        .wpcf7-validation-errors,
        .wpcf7-acceptance-missing {
          background-color: #fffbeb;
          color: #92600a;
        }
      }
    }
  }
}

/* ---- Fila 2 columnas (fallback fuera de anidado) ---- */
.form-row.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 640px) {
  .form-row.grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}