/**
 * ELP Source-of-Truth Form — elso.css  v2.7.0
 * Mobile-first, matches ELP Cargo brand colours.
 * Supports both inline ([elp_source_of_truth]) and modal ([elp_sot_modal]) variants.
 */

/* ── CSS custom properties ──────────────────────────────────────────────────── */
:root {
    --elso-brand:        #17B89A;
    --elso-brand-dark:   #0E9E84;
    --elso-brand-light:  #e6f7f4;
    --elso-text:         #1a1a1a;
    --elso-muted:        #6b7280;
    --elso-border:       #d1d5db;
    --elso-error:        #dc2626;
    --elso-error-bg:     #fef2f2;
    --elso-success:      #059669;
    --elso-success-bg:   #ecfdf5;
    --elso-radius:       8px;
    --elso-shadow:       0 2px 12px rgba(0,0,0,.10);
    --elso-font:         -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* ── Overlay (modal only) ───────────────────────────────────────────────────── */
.elso-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, .55);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 24px 12px env(safe-area-inset-bottom, 0) 12px;
    box-sizing: border-box;
}

/* ── Trigger button (modal variant) ────────────────────────────────────────── */
.elso-btn-wrap {
    display: inline-block;
}
.elso-trigger-btn {
    display: inline-block;
    padding: 13px 28px;
    background: var(--elso-btn-bg, var(--elso-brand));
    color: var(--elso-btn-color, #fff);
    border: none;
    border-radius: var(--elso-radius);
    font-family: var(--elso-font);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, transform .1s;
    -webkit-tap-highlight-color: transparent;
}
.elso-trigger-btn:hover  { background: var(--elso-brand-dark); }
.elso-trigger-btn:active { transform: scale(.97); }

/* ── Page wrap (inline variant) ─────────────────────────────────────────────── */
.elso-page-wrap {
    width: 100%;
    max-width: min(960px, 94vw);
    margin: 0 auto;
    padding: 0 16px;
    box-sizing: border-box;
}

/* ── Form wrap (shared) ─────────────────────────────────────────────────────── */
.elso-form-wrap {
    background: #fff;
    border-radius: var(--elso-radius);
    box-shadow: var(--elso-shadow);
    padding: 28px 24px 32px;
    font-family: var(--elso-font);
    color: var(--elso-text);
    width: 100%;
    max-width: min(960px, 94vw);
    box-sizing: border-box;
    position: relative;
}
.elso-modal-inner {
    margin: auto;
}

/* ── Close button (modal only) ──────────────────────────────────────────────── */
.elso-modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 26px;
    line-height: 1;
    color: var(--elso-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color .15s, background .15s;
    -webkit-tap-highlight-color: transparent;
}
.elso-modal-close:hover { color: var(--elso-text); background: #f3f4f6; }

/* ── Progress bar ───────────────────────────────────────────────────────────── */
.elso-progress-bar {
    height: 5px;
    background: #e5e7eb;
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 6px;
}
.elso-progress-fill {
    height: 100%;
    background: var(--elso-brand);
    border-radius: 99px;
    transition: width .35s ease;
}
.elso-step-label {
    font-size: 12px;
    color: var(--elso-muted);
    margin-bottom: 20px;
}

/* ── Step titles ────────────────────────────────────────────────────────────── */
.elso-step-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--elso-text);
}
.elso-step-desc {
    font-size: 13px;
    color: var(--elso-muted);
    margin: 0 0 20px;
    line-height: 1.5;
}

/* ── Steps visibility ───────────────────────────────────────────────────────── */
.elso-step { display: none; }
.elso-step.elso-step-active { display: block; }

/* ── Fields ─────────────────────────────────────────────────────────────────── */
.elso-field {
    margin-bottom: 16px;
}
.elso-field label,
.elso-service-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--elso-text);
    margin-bottom: 5px;
}
.elso-req {
    color: var(--elso-error);
    margin-left: 2px;
}
.elso-hint {
    font-size: 12px;
    color: var(--elso-muted);
    margin: -2px 0 6px;
    line-height: 1.4;
}
.elso-learn-more {
    font-size: 11px;
    font-weight: 400;
    color: var(--elso-brand);
    text-decoration: none;
    margin-left: 6px;
    white-space: nowrap;
}
.elso-learn-more:hover { text-decoration: underline; }

/* ── Inputs / selects / textareas ───────────────────────────────────────────── */
.elso-form input[type="text"],
.elso-form input[type="email"],
.elso-form input[type="tel"],
.elso-form input[type="date"],
.elso-form input[type="number"],
.elso-form select,
.elso-form textarea {
    width: 100%;
    padding: 10px 12px;
    font-family: var(--elso-font);
    font-size: 14px;
    color: var(--elso-text);
    background: #fff;
    border: 1.5px solid var(--elso-border);
    border-radius: var(--elso-radius);
    box-sizing: border-box;
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none;
    appearance: none;
}
.elso-form input:focus,
.elso-form select:focus,
.elso-form textarea:focus {
    outline: none;
    border-color: var(--elso-brand);
    box-shadow: 0 0 0 3px rgba(23,184,154,.15);
}
.elso-form textarea {
    resize: vertical;
    min-height: 120px;
}
.elso-form select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* Error state */
.elso-form input.elso-is-error,
.elso-form select.elso-is-error,
.elso-form textarea.elso-is-error {
    border-color: var(--elso-error);
    box-shadow: 0 0 0 3px rgba(220,38,38,.12);
}
.elso-radio-group.elso-is-error {
    outline: 2px solid var(--elso-error);
    outline-offset: 4px;
    border-radius: 4px;
}
.elso-confirm-field.elso-is-error label {
    color: var(--elso-error);
}

/* ── Two-column row ─────────────────────────────────────────────────────────── */
.elso-field-row { display: flex; gap: 14px; }
.elso-field-row .elso-field { flex: 1; min-width: 0; }

/* ── Range slider ───────────────────────────────────────────────────────────── */
.elso-range-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}
.elso-range {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: #e5e7eb;
    border-radius: 99px;
    outline: none;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}
.elso-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--elso-brand);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.elso-range::-moz-range-thumb {
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--elso-brand);
    cursor: pointer;
    border: none;
}
.elso-range-output {
    min-width: 52px;
    text-align: right;
    font-size: 13px;
    font-weight: 600;
    color: var(--elso-brand);
}

/* ── Radio groups ───────────────────────────────────────────────────────────── */
.elso-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}
.elso-radio-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    border: 1.5px solid var(--elso-border);
    border-radius: 99px;
    font-size: 13px;
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.elso-radio-label input[type="radio"] {
    display: none;
}
.elso-radio-label:hover {
    border-color: var(--elso-brand);
    background: var(--elso-brand-light);
}
.elso-radio-label:has(input:checked) {
    border-color: var(--elso-brand);
    background: var(--elso-brand);
    color: #fff;
    font-weight: 600;
}

/* ── Services grid ──────────────────────────────────────────────────────────── */
.elso-services-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}
.elso-service-item {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: var(--elso-radius);
    padding: 14px 16px;
}
.elso-service-label {
    margin-bottom: 10px !important;
}

/* ── Confirmation checkbox ──────────────────────────────────────────────────── */
.elso-confirm-field {
    margin-top: 8px;
}
.elso-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: var(--elso-muted);
    cursor: pointer;
    line-height: 1.5;
}
.elso-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    margin-top: 1px;
    accent-color: var(--elso-brand);
    cursor: pointer;
    border: none !important;
    box-shadow: none !important;
}

/* ── Turnstile ──────────────────────────────────────────────────────────────── */
.elso-turnstile-wrap {
    margin: 16px 0 4px;
}

/* ── Step navigation ────────────────────────────────────────────────────────── */
.elso-step-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    gap: 12px;
}
.elso-btn-prev,
.elso-btn-next,
.elso-btn-submit {
    padding: 11px 24px;
    font-family: var(--elso-font);
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--elso-radius);
    border: none;
    cursor: pointer;
    transition: background .18s, transform .1s, opacity .18s;
    -webkit-tap-highlight-color: transparent;
}
.elso-btn-prev {
    background: #f3f4f6;
    color: var(--elso-text);
}
.elso-btn-prev:hover { background: #e5e7eb; }
.elso-btn-next,
.elso-btn-submit {
    background: var(--elso-brand);
    color: #fff;
    margin-left: auto;
}
.elso-btn-next:hover,
.elso-btn-submit:hover { background: var(--elso-brand-dark); }
.elso-btn-next:active,
.elso-btn-submit:active { transform: scale(.97); }
.elso-btn-submit:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
}

/* ── Messages ───────────────────────────────────────────────────────────────── */
.elso-msg {
    padding: 14px 16px;
    border-radius: var(--elso-radius);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 18px;
    line-height: 1.5;
}
.elso-msg-success {
    background: var(--elso-success-bg);
    color: var(--elso-success);
    border: 1px solid #a7f3d0;
}
.elso-msg-error {
    background: var(--elso-error-bg);
    color: var(--elso-error);
    border: 1px solid #fecaca;
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (min-width: 560px) {
    .elso-services-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .elso-form-wrap {
        padding: 20px 16px 24px;
    }
    .elso-field-row.elso-two-col {
        flex-direction: column;
        gap: 0;
    }
    .elso-step-title {
        font-size: 17px;
    }
    .elso-btn-prev,
    .elso-btn-next,
    .elso-btn-submit {
        padding: 11px 18px;
        font-size: 13px;
    }
    .elso-radio-group {
        gap: 6px;
    }
    .elso-radio-label {
        padding: 6px 11px;
        font-size: 12px;
    }
}

@media (max-width: 360px) {
    .elso-overlay {
        padding: 12px 6px env(safe-area-inset-bottom, 0) 6px;
    }
    .elso-form-wrap {
        padding: 16px 12px 20px;
    }
}

/* Desktop enhancements (>=768px) */
@media (min-width: 768px) {
    .elso-form-wrap { padding: 40px 48px 48px; }
    .elso-services-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }
    .elso-service-item { break-inside: avoid; }
    .elso-vol-calc-link {
        display: inline-flex; align-items: center; gap: 4px;
        font-size: 0.85em; font-weight: 600; color: var(--elso-brand);
        text-decoration: none; padding: 2px 8px;
        border: 1px solid var(--elso-brand); border-radius: 4px; margin-left: 8px;
        transition: background .15s, color .15s;
    }
    .elso-vol-calc-link:hover { background: var(--elso-brand); color: #fff; }
}
