/* Form Studio — runtime. Todos los colores y tipografía se controlan
   por variables CSS, que se inyectan desde los Ajustes globales del plugin. */

.fs {
    /* Fallbacks: si no hay ajustes guardados, usa el preset oscuro */
    --fs-bg: #0b0b09;
    --fs-accent: #c8a368;
    --fs-text: #ffffff;
    --fs-muted: rgba(255, 255, 255, .6);
    --fs-line: rgba(255, 255, 255, .25);
    --fs-accent-text: #0b0b09;

    box-sizing: border-box;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0 auto;
    padding: 5vh clamp(20px, 6vw, 64px) calc(5vh + env(safe-area-inset-bottom));
    background: var(--fs-bg);
    color: var(--fs-text);
    font-family: inherit;
    -webkit-font-smoothing: antialiased;
}

.fs *,
.fs *::before,
.fs *::after {
    box-sizing: border-box;
}

body.fs-page {
    margin: 0;
    background: var(--fs-bg, #0b0b09);
}

/* Barra de progreso */
.fs-progress {
    position: sticky;
    top: 0;
    width: 100%;
    max-width: 760px;
    margin: 0 auto 8px;
    height: 4px;
    background: var(--fs-line);
    border-radius: 6px;
    overflow: hidden;
}
.fs-progress-bar {
    height: 100%;
    width: 0;
    background: var(--fs-accent);
    transition: width .4s ease;
}

/* Preguntas */
.fs-form {
    position: relative;
    flex: 1;
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    display: flex;
    align-items: center;
}
.fs-slide { display: none; width: 100%; }
.fs-slide.is-active { display: block; animation: fs-in .45s ease both; }
@keyframes fs-in {
    from { opacity: 0; transform: translateY(28px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fs-slide-inner { padding: 24px 0; }

.fs-step {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--fs-accent);
    font-weight: 600;
    font-size: 16px;
    letter-spacing: .02em;
    margin-bottom: 14px;
}
.fs-arrow { opacity: .7; }

.fs-question {
    display: block;
    font-size: clamp(26px, 4.2vw, 40px);
    font-weight: 600;
    line-height: 1.25;
    margin: 0 0 10px;
    letter-spacing: .01em;
}
.fs-required { color: var(--fs-accent); }

.fs-description {
    font-size: clamp(16px, 2vw, 20px);
    color: var(--fs-muted);
    margin: 0 0 26px;
    line-height: 1.5;
    font-weight: 500;
}

/* Inputs: text / textarea / email / date / select */
.fs-input {
    width: 100%;
    border: none;
    border-bottom: 2px solid var(--fs-line);
    background: transparent;
    font-family: inherit;
    font-size: clamp(20px, 3vw, 26px);
    font-weight: 500;
    line-height: 1.5;
    padding: 10px 2px;
    color: var(--fs-text);
    outline: none;
    transition: border-color .2s ease;
}
.fs-input::placeholder { color: var(--fs-muted); opacity: .55; }
.fs-input:focus { border-bottom-color: var(--fs-accent); }

/* Texto largo: caja con borde, visiblemente multi-línea desde el inicio. */
.fs-textarea {
    border: 2px solid var(--fs-line);
    border-radius: 10px;
    padding: 16px 18px;
    min-height: 140px;
    line-height: 1.55;
    resize: none;
    overflow: hidden;
    font-size: clamp(17px, 2.2vw, 20px);
}
.fs-textarea:focus { border-color: var(--fs-accent); }
.fs-slide.has-error .fs-textarea { border-color: #e0664f; }

.fs-counter {
    text-align: right;
    color: var(--fs-muted);
    font-size: 13px;
    margin-top: 6px;
    font-variant-numeric: tabular-nums;
}
.fs-counter.is-near { color: var(--fs-accent); }

.fs-select,
.fs-date {
    -webkit-appearance: none;
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--fs-accent) 50%),
                      linear-gradient(135deg, var(--fs-accent) 50%, transparent 50%);
    background-position: calc(100% - 18px) 22px, calc(100% - 12px) 22px;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 32px;
}
.fs-date {
    background-image: none;
    padding-right: 2px;
    color-scheme: dark light;
}

.fs-slide.has-error .fs-input { border-bottom-color: #e0664f; }

.fs-error {
    color: #e0664f;
    font-size: 15px;
    font-weight: 500;
    min-height: 22px;
    margin-top: 8px;
}

/* Opciones (radio + checkbox) */
.fs-choices {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 6px;
}
.fs-choice {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 2px solid var(--fs-line);
    border-radius: 6px;
    font-size: clamp(17px, 2vw, 19px);
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.fs-choice:hover { border-color: var(--fs-accent); }
.fs-choice input { position: absolute; opacity: 0; pointer-events: none; }
.fs-choice-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1.5px solid var(--fs-line);
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--fs-muted);
    flex: 0 0 28px;
    transition: all .15s ease;
}
.fs-choice:has(input:checked) {
    border-color: var(--fs-accent);
    background: color-mix(in srgb, var(--fs-accent) 14%, transparent);
}
.fs-choice:has(input:checked) .fs-choice-key {
    background: var(--fs-accent);
    color: var(--fs-accent-text);
    border-color: var(--fs-accent);
}
.fs-choice-text { flex: 1; }

/* Calificación (estrellas) */
.fs-rating {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.fs-star {
    background: transparent;
    border: none;
    color: var(--fs-line);
    font-size: 42px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: color .15s ease, transform .15s ease;
}
.fs-star:hover { transform: scale( 1.05 ); }
.fs-star.is-on { color: var(--fs-accent); }
.fs-star:focus { outline: none; }

/* Botón Siguiente / Enviar */
.fs-actions { margin-top: 28px; }
.fs-next {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: var(--fs-accent);
    color: var(--fs-accent-text);
    border: none;
    border-radius: 6px;
    padding: 14px 28px;
    font-family: inherit;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: .03em;
    cursor: pointer;
    transition: filter .2s ease, opacity .2s ease;
}
.fs-next:hover { filter: brightness(1.08); }
.fs-next:disabled { opacity: .6; cursor: default; }
.fs-next.is-loading .fs-next-label { opacity: .5; }

/* Navegación arriba/abajo flotante */
.fs-nav {
    position: fixed;
    right: clamp(16px, 4vw, 40px);
    bottom: calc(20px + env(safe-area-inset-bottom));
    display: flex;
    gap: 6px;
    z-index: 5;
}
.fs-nav button {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--fs-accent);
    color: var(--fs-accent-text);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    border-radius: 4px;
    transition: opacity .2s ease;
}
.fs-nav button:disabled { opacity: .3; cursor: default; }

/* Pantalla de gracias */
.fs-thanks { text-align: center; }
.fs-thanks-icon {
    width: 76px;
    height: 76px;
    margin: 0 auto 22px;
    border-radius: 50%;
    background: var(--fs-accent);
    color: var(--fs-accent-text);
    font-size: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.fs-thanks-text {
    font-size: clamp(26px, 4vw, 38px);
    font-weight: 600;
    margin: 0;
}
.fs-thanks-subtitle {
    margin: 14px 0 0;
    color: var(--fs-muted);
    font-size: clamp(17px, 2vw, 20px);
    font-weight: 500;
    line-height: 1.5;
}
.fs-thanks-back {
    display: inline-block;
    margin-top: 28px;
    background: var(--fs-accent);
    color: var(--fs-accent-text);
    text-decoration: none;
    border-radius: 6px;
    padding: 14px 28px;
    font-family: inherit;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: .03em;
    transition: filter .2s ease;
}
.fs-thanks-back:hover { filter: brightness(1.08); color: var(--fs-accent-text); }

/* Footer de marca */
.fs-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 48px;
    padding-top: 24px;
}
.fs-logo { height: 56px; width: auto; display: block; }
.fs-brand {
    font-family: inherit;
    font-size: clamp(22px, 3vw, 30px);
    font-weight: 600;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--fs-text);
    white-space: nowrap;
}

/* Móvil */
@media (max-width: 600px) {
    .fs { padding: 32px 20px calc(24px + env(safe-area-inset-bottom)); }
    .fs-slide-inner { padding: 16px 0; }
    .fs-next { width: 100%; justify-content: center; }
    .fs-nav button { width: 40px; height: 40px; }
    .fs-footer { gap: 12px; margin-top: 36px; }
    .fs-logo { height: 44px; }
    .fs-brand { font-size: 20px; letter-spacing: .14em; }
    .fs-star { font-size: 36px; }
    .fs-choice { padding: 12px 14px; font-size: 17px; }
}
