/**
 * DSG Smart Forms — Conversational (Typeform-like) frontend styles.
 * Activates per form via settings.render_mode = 'conversational'.
 * All declarations scoped under .dsg-sf-conv to not pollute the theme.
 */

.dsg-sf-conv {
    /* DSG brand defaults; per-form overrides via inline style vars. */
    --dsgsf-bg: #0A0A0B;
    --dsgsf-text: #FFFFFF;
    --dsgsf-accent: #E53935;
    --dsgsf-muted: #94A3B8;
    --dsgsf-border: rgba(255, 255, 255, 0.1);
    --dsgsf-error: #FF5252;

    position: relative;
    background: var(--dsgsf-bg);
    color: var(--dsgsf-text);
    border-radius: 14px;
    min-height: 520px;
    padding: 0;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 17px;
    line-height: 1.5;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35);
}

.dsg-sf-conv * { box-sizing: border-box; }

/* Always honor the [hidden] attribute — button rules like `display: inline-flex`
 * otherwise override the browser default `[hidden] { display: none }`. */
.dsg-sf-conv [hidden] { display: none !important; }

/* ---- Progress bar ---- */
.dsg-sf-conv__progress {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: rgba(0,0,0,0.06);
    z-index: 2;
}
.dsg-sf-conv__bar {
    height: 100%;
    width: 0%;
    background: var(--dsgsf-accent);
    transition: width .3s ease;
}

/* ---- Form ---- */
.dsg-sf-conv__form { position: relative; min-height: 520px; }

/* ---- Step ---- */
.dsg-sf-conv__step {
    display: none;
    padding: 64px 48px 80px;
    min-height: 520px;
    flex-direction: column;
    justify-content: center;
    animation: dsgsfConvFade .25s ease;
}
.dsg-sf-conv__step.is-active { display: flex; }
.dsg-sf-conv__step--welcome { align-items: flex-start; }

@keyframes dsgsfConvFade {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- Question number ---- */
.dsg-sf-conv__number {
    font-size: 14px;
    font-weight: 500;
    color: var(--dsgsf-accent);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.dsg-sf-conv__number::after {
    content: "→";
    color: var(--dsgsf-accent);
    font-weight: 400;
}

/* ---- Question ---- */
.dsg-sf-conv__question {
    font-size: 28px;
    font-weight: 600;
    line-height: 1.25;
    margin: 0 0 8px;
    color: var(--dsgsf-text);
}
.dsg-sf-conv__req { color: var(--dsgsf-accent); margin-left: 4px; font-weight: 400; }

.dsg-sf-conv__hint {
    font-size: 15px;
    color: var(--dsgsf-muted);
    margin: 0 0 28px;
}

/* ---- Input area ---- */
.dsg-sf-conv__input { margin-top: 12px; }
.dsg-sf-conv__input .dsg-sf-field { margin: 0; }

/* Override classic input styles for conversational look */
.dsg-sf-conv__input .dsg-sf-input {
    font-size: 22px;
    padding: 14px 0;
    border: 0;
    border-bottom: 2px solid var(--dsgsf-border);
    border-radius: 0;
    background: transparent;
    color: var(--dsgsf-text);
    box-shadow: none;
    transition: border-color .15s;
}
.dsg-sf-conv__input .dsg-sf-input:focus {
    outline: none;
    border-bottom-color: var(--dsgsf-accent);
    box-shadow: none;
}
.dsg-sf-conv__input textarea.dsg-sf-input { min-height: 80px; font-size: 20px; }

.dsg-sf-conv__input select.dsg-sf-input,
.dsg-sf-conv__input select.dsg-sf-input--multi {
    padding: 14px 8px;
}

/* Options (radio / checkbox / multi-select) in conversational style */
.dsg-sf-conv__input .dsg-sf-options {
    gap: 10px;
    margin-top: 4px;
}
.dsg-sf-conv__input .dsg-sf-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 2px solid var(--dsgsf-border);
    border-radius: 6px;
    background: var(--dsgsf-bg);
    cursor: pointer;
    transition: all .15s;
    font-size: 17px;
}
.dsg-sf-conv__input .dsg-sf-option:hover {
    border-color: var(--dsgsf-accent);
    background: rgba(34,113,177,0.05);
}
.dsg-sf-conv__input .dsg-sf-option input[type="radio"],
.dsg-sf-conv__input .dsg-sf-option input[type="checkbox"] { accent-color: var(--dsgsf-accent); }
.dsg-sf-conv__input .dsg-sf-option::before {
    content: attr(data-hotkey);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    background: var(--dsgsf-bg);
    border: 1.5px solid var(--dsgsf-border);
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    color: var(--dsgsf-muted);
}

/* Compound fields: grid tighter */
.dsg-sf-conv__input .dsg-sf-compound { gap: 16px; }
.dsg-sf-conv__input .dsg-sf-sub__label { font-size: 13px; color: var(--dsgsf-muted); }

.dsg-sf-conv__input .dsg-sf-consent {
    padding: 12px 16px;
    border: 2px solid var(--dsgsf-border);
    border-radius: 6px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

/* ---- Error row ---- */
.dsg-sf-conv__error {
    margin-top: 10px;
    min-height: 18px;
    color: var(--dsgsf-error);
    font-size: 14px;
}

/* ---- Welcome screen ---- */
.dsg-sf-conv__big-title {
    font-size: 36px;
    font-weight: 700;
    line-height: 1.15;
    margin: 0 0 16px;
    color: var(--dsgsf-text);
}
.dsg-sf-conv__big-message {
    font-size: 18px;
    color: var(--dsgsf-muted);
    margin: 0 0 32px;
    max-width: 560px;
}

/* ---- Done screen ---- */
.dsg-sf-conv__screen--done {
    padding: 80px 48px;
    text-align: center;
}
.dsg-sf-conv__icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 24px;
    background: var(--dsgsf-accent);
    color: #fff;
    border-radius: 50%;
    font-size: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.dsg-sf-conv__title {
    font-size: 28px;
    font-weight: 600;
    color: var(--dsgsf-text);
    margin: 0;
}

/* ---- Buttons ---- */
.dsg-sf-conv__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border: 2px solid transparent;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: var(--dsgsf-text);
    transition: all .15s;
    line-height: 1;
}
.dsg-sf-conv__btn:focus { outline: 2px solid var(--dsgsf-accent); outline-offset: 2px; }

.dsg-sf-conv__btn--primary {
    background: var(--dsgsf-accent);
    color: #fff;
    border-color: var(--dsgsf-accent);
}
.dsg-sf-conv__btn--primary:hover { filter: brightness(0.92); }

.dsg-sf-conv__btn--ghost {
    padding: 10px 14px;
    border-color: var(--dsgsf-border);
    color: var(--dsgsf-muted);
}
.dsg-sf-conv__btn--ghost:hover { border-color: var(--dsgsf-accent); color: var(--dsgsf-accent); }
.dsg-sf-conv__btn--ghost:disabled { opacity: 0.3; cursor: not-allowed; }

/* ---- Controls bar ---- */
.dsg-sf-conv__controls {
    position: absolute;
    right: 24px;
    bottom: 40px;
    display: flex;
    gap: 10px;
    align-items: center;
    z-index: 2;
}

/* ---- Footer ---- */
.dsg-sf-conv__footer {
    position: absolute;
    left: 24px;
    bottom: 14px;
    font-size: 12px;
    color: var(--dsgsf-muted);
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
    .dsg-sf-conv { border-radius: 0; min-height: 480px; }
    .dsg-sf-conv__step { padding: 40px 22px 100px; }
    .dsg-sf-conv__big-title { font-size: 28px; }
    .dsg-sf-conv__question { font-size: 22px; }
    .dsg-sf-conv__controls { right: 16px; bottom: 22px; }
    .dsg-sf-conv__footer { display: none; }
}
