/**
 * listing-form.css
 * Business Listing Submission Form — Frontend Styles
 *
 * Design: Refined editorial — deep navy anchors, warm off-white surface,
 * Playfair Display for headings, clean structured form inputs.
 * Optimised for Core Web Vitals: no @import web fonts (use <link> in header),
 * no layout shift triggers, minimal repaints on interaction.
 *
 * Responsive: Single-column on mobile, two-column row on ≥600px.
 * ============================================================
 */

/* ── Google Fonts preconnect is added via PHP (see plugin file).
   Use this @import only if you prefer CSS-only font loading.
   For best CWV, add <link> preconnect tags in wp_head instead. */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=DM+Sans:wght@400;500;600&display=swap');


/* ── CSS Custom Properties ──────────────────────────────────── */
.bls-section {
    /* Brand palette */
    --bls-navy:          #1a3c5e;
    --bls-navy-mid:      #255080;
    --bls-navy-light:    #3a6ea8;
    --bls-accent:        #e07b39;      /* Warm amber — CTA contrast */
    --bls-accent-hover:  #c96a28;

    /* Neutrals */
    --bls-bg:            #fdfcfa;      /* Warm off-white */
    --bls-surface:       #ffffff;
    --bls-border:        #d8dfe8;
    --bls-border-focus:  #3a6ea8;
    --bls-text:          #1e2733;
    --bls-text-muted:    #6b7a8d;
    --bls-text-light:    #9aa5b4;
    --bls-error-color:   #c0392b;
    --bls-error-bg:      #fdf2f2;
    --bls-success-color: #1e7e4b;
    --bls-success-bg:    #f0faf4;

    /* Layout */
    --bls-radius:        8px;
    --bls-radius-lg:     14px;
    --bls-shadow:        0 2px 16px rgba(26,60,94,.10);
    --bls-shadow-focus:  0 0 0 3px rgba(58,110,168,.25);

    /* Typography */
    --bls-font-display:  'Playfair Display', Georgia, serif;
    --bls-font-body:     'DM Sans', system-ui, -apple-system, sans-serif;

    /* Transition */
    --bls-ease:          cubic-bezier(.25,.46,.45,.94);
}


/* ── Section wrapper ─────────────────────────────────────────── */
.bls-section {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    padding: 0 16px 48px;
    box-sizing: border-box;
    font-family: var(--bls-font-body);
    font-size: 15px;
    color: var(--bls-text);
    -webkit-font-smoothing: antialiased;
}


/* ── Form Header ─────────────────────────────────────────────── */
.bls-form-header {
    text-align: center;
    padding: 48px 24px 36px;
    /* Prevents layout shift — fixed height for the stacked badge + title */
}

.bls-header-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--bls-navy);
    border-radius: 50%;
    margin: 0 auto 18px;
    color: #fff;
}

.bls-header-badge svg {
    width: 26px;
    height: 26px;
}

.bls-form-title {
    font-family: var(--bls-font-display);
    font-size: clamp(26px, 5vw, 36px); /* Fluid type — no layout shift */
    font-weight: 700;
    color: var(--bls-navy);
    margin: 0 0 10px;
    line-height: 1.2;
    letter-spacing: -.3px;
}

.bls-form-subtitle {
    font-size: 15px;
    color: var(--bls-text-muted);
    margin: 0;
    line-height: 1.55;
    max-width: 400px;
    margin-inline: auto;
}


/* ── Notice Banners (success / error) ────────────────────────── */
.bls-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    border-radius: var(--bls-radius);
    margin-bottom: 28px;
    font-size: 14px;
    line-height: 1.55;
    /* `hidden` attribute used in HTML instead of display:none
       to avoid CLS — element takes no space until JS removes [hidden] */
}

.bls-notice[hidden] { display: none; }

.bls-notice--success {
    background: var(--bls-success-bg);
    border: 1px solid #a8d5ba;
    color: var(--bls-success-color);
}

.bls-notice--error {
    background: var(--bls-error-bg);
    border: 1px solid #e8b4af;
    color: var(--bls-error-color);
}

.bls-notice__icon {
    flex-shrink: 0;
    margin-top: 1px;
}

.bls-notice p {
    margin: 0;
    font-weight: 500;
}


/* ── Form card ───────────────────────────────────────────────── */
.bls-form {
    background: var(--bls-surface);
    border: 1px solid var(--bls-border);
    border-radius: var(--bls-radius-lg);
    padding: 36px 40px 40px;
    box-shadow: var(--bls-shadow);
    /* Explicit height not set — prevents layout shift via bottom padding */
}

@media (max-width: 540px) {
    .bls-form {
        padding: 28px 20px 32px;
    }
}


/* ── Field wrapper ───────────────────────────────────────────── */
.bls-field {
    margin-bottom: 22px;
}

.bls-field:last-of-type {
    margin-bottom: 0;
}

/* Two-column row for Phone + Email on wider screens */
.bls-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 22px;
}

@media (max-width: 540px) {
    .bls-field-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .bls-field-row .bls-field {
        margin-bottom: 22px;
    }
    .bls-field-row .bls-field:last-child {
        margin-bottom: 0;
    }
}


/* ── Labels ──────────────────────────────────────────────────── */
.bls-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--bls-navy);
    margin-bottom: 7px;
    letter-spacing: .2px;
    text-transform: uppercase;
}

.bls-required {
    color: var(--bls-accent);
    text-decoration: none;
    margin-left: 2px;
    font-style: normal;
}


/* ── Inputs ──────────────────────────────────────────────────── */
.bls-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 11px 14px;
    font-family: var(--bls-font-body);
    font-size: 15px;
    color: var(--bls-text);
    background: var(--bls-bg);
    border: 1.5px solid var(--bls-border);
    border-radius: var(--bls-radius);
    outline: none;
    transition:
        border-color .18s var(--bls-ease),
        box-shadow   .18s var(--bls-ease),
        background   .18s var(--bls-ease);
    /* Prevent iOS from zooming on focus (font-size ≥ 16px prevents zoom,
       but we keep 15px for visual rhythm — use viewport meta tag instead) */
    -webkit-appearance: none;
    appearance: none;
}

.bls-input::placeholder {
    color: var(--bls-text-light);
}

.bls-input:hover {
    border-color: var(--bls-navy-light);
}

.bls-input:focus {
    border-color: var(--bls-border-focus);
    box-shadow: var(--bls-shadow-focus);
    background: #fff;
}

/* Error state — added by JS */
.bls-field--error .bls-input {
    border-color: var(--bls-error-color);
    background: var(--bls-error-bg);
}

.bls-field--error .bls-input:focus {
    box-shadow: 0 0 0 3px rgba(192,57,43,.20);
}

/* Valid state — added by JS after blur with valid value */
.bls-field--valid .bls-input {
    border-color: #60b77e;
}


/* ── URL input with "https://" prefix ───────────────────────── */
.bls-input-prefix-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.bls-input-prefix {
    position: absolute;
    left: 14px;
    font-size: 14px;
    color: var(--bls-text-muted);
    font-weight: 500;
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
}

.bls-input--has-prefix {
    padding-left: 76px; /* Width of "https://" prefix text + padding */
}


/* ── Inline field errors ─────────────────────────────────────── */
.bls-field-error {
    display: block;
    min-height: 0;               /* No reserved space — avoids CLS */
    overflow: hidden;
    font-size: 12.5px;
    color: var(--bls-error-color);
    margin-top: 5px;
    line-height: 1.4;
    font-weight: 500;
    transition: max-height .2s var(--bls-ease);
}

.bls-field-error:empty {
    display: none;               /* Collapses when empty */
}


/* ── Submit button ───────────────────────────────────────────── */
.bls-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-top: 30px;
    padding: 14px 28px;
    font-family: var(--bls-font-body);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .3px;
    color: #fff;
    background: var(--bls-accent);
    border: none;
    border-radius: var(--bls-radius);
    cursor: pointer;
    transition:
        background .18s var(--bls-ease),
        transform  .12s var(--bls-ease),
        box-shadow .18s var(--bls-ease);
    position: relative;
    overflow: hidden;
    /* Reserve height so spinner swap doesn't cause layout shift */
    min-height: 50px;
}

.bls-submit-btn:hover:not(:disabled) {
    background: var(--bls-accent-hover);
    box-shadow: 0 4px 16px rgba(224,123,57,.35);
}

.bls-submit-btn:active:not(:disabled) {
    transform: translateY(1px);
}

.bls-submit-btn:disabled {
    opacity: .72;
    cursor: not-allowed;
}

/* Loading state — label fades, spinner appears */
.bls-submit-btn.is-loading .bls-btn-label {
    opacity: 0;
}

.bls-submit-btn.is-loading .bls-btn-spinner {
    opacity: 1;
}

.bls-btn-label {
    transition: opacity .15s;
}

/* CSS-only spinner — no GIF, no layout shift */
.bls-btn-spinner {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255,255,255,.35);
    border-top-color: #fff;
    border-radius: 50%;
    opacity: 0;
    transition: opacity .15s;
    animation: bls-spin .7s linear infinite;
}

@keyframes bls-spin {
    to { transform: rotate(360deg); }
}


/* ── Trust line ──────────────────────────────────────────────── */
.bls-trust-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 16px 0 0;
    font-size: 12px;
    color: var(--bls-text-light);
    text-align: center;
    line-height: 1.4;
}

.bls-trust-line svg {
    flex-shrink: 0;
    opacity: .7;
}


/* ── Reduced motion: disable all transitions/animations ──────── */
@media (prefers-reduced-motion: reduce) {
    .bls-input,
    .bls-submit-btn,
    .bls-btn-label,
    .bls-btn-spinner {
        transition: none;
        animation: none;
    }
}


/* ── Print: hide the form ────────────────────────────────────── */
@media print {
    .bls-section { display: none; }
}