/**
 * Elenchus Forms & Leads — Public Styles
 *
 * Design tokens mirror the Blogos theme:
 *   --blogos-accent       #10b981  (emerald-500)
 *   --blogos-accent-dark  #059669  (emerald-600)
 *   --blogos-navy         #0a0f1c
 *   --blogos-radius-card  1rem
 *   --blogos-transition   200ms cubic-bezier(.4,0,.2,1)
 *
 * BEM namespaces:
 *   .efl-subscribe-form   subscribe block form
 *   .efl-subscribe-success   success panel
 *   .efl-form-*           generic / contact forms
 *
 * @package ElenchusFormsLeads
 */

/* ═══════════════════════════════════════════════════════════════════════════
   0. SHARED UTILITIES
   ═══════════════════════════════════════════════════════════════════════════ */

.efl-form-wrap {
    position: relative;
    width: 100%;
}

/* Screen-reader only */
.efl-form-wrap .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   1. SUBSCRIBE FORM
   Lives inside the dark-green .blogos-subscribe block.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Row: input + button side by side */
.efl-subscribe-form__row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 28rem;
    margin: 0 auto;
}

@media (min-width: 640px) {
    .efl-subscribe-form__row {
        flex-direction: row;
        gap: 8px;
    }
}

/* Input — glass effect on the dark gradient background */
.efl-subscribe-form__input {
    flex: 1;
    min-width: 0;
    padding: 11px 16px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.20);
    background: rgba(255, 255, 255, 0.10);
    color: #ffffff;
    font-size: 0.9rem;
    font-family: inherit;
    line-height: 1.5;
    outline: none;
    transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
    -webkit-appearance: none;
    appearance: none;
}

.efl-subscribe-form__input::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

.efl-subscribe-form__input:focus {
    border-color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.16);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.30);
}

.efl-subscribe-form__input.efl-input--invalid {
    border-color: rgba(252, 165, 165, 0.70);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.20);
}

/* Submit button — matches .blogos-subscribe__btn but with loading state */
.efl-subscribe-form__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-shrink: 0;
    padding: 11px 22px;
    border: none;
    border-radius: 14px;
    background: #ffffff;
    color: #065f46;
    font-size: 0.875rem;
    font-weight: 700;
    font-family: inherit;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18), 0 1px 3px rgba(0, 0, 0, 0.12);
    transition: background 180ms ease, transform 120ms ease, box-shadow 180ms ease;
    -webkit-appearance: none;
    appearance: none;
}

.efl-subscribe-form__btn:hover:not(:disabled) {
    background: #ecfdf5;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.20), 0 1px 4px rgba(0, 0, 0, 0.10);
    transform: translateY(-1px);
}

.efl-subscribe-form__btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.efl-subscribe-form__btn:disabled {
    opacity: 0.75;
    cursor: not-allowed;
    transform: none;
}

/* Spinner — hidden by default, shown via .is-loading class on button */
.efl-subscribe-form__spinner {
    display: none;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.efl-subscribe-form__btn.is-loading .efl-subscribe-form__spinner {
    display: block;
    animation: efl-spin 0.7s linear infinite;
}

.efl-subscribe-form__btn.is-loading .efl-subscribe-form__btn-label {
    opacity: 0.7;
}

@keyframes efl-spin {
    to { transform: rotate(360deg); }
}

/* Error message — below the row, on the dark background */
.efl-subscribe-form__error {
    display: none;
    max-width: 28rem;
    margin: 10px auto 0;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.18);
    border: 1px solid rgba(252, 165, 165, 0.40);
    color: #fecaca;
    font-size: 0.85rem;
    line-height: 1.5;
    text-align: center;
}

.efl-subscribe-form__error--visible {
    display: block;
    animation: efl-fade-in 200ms ease;
}

/* Privacy line */
.efl-subscribe-form__privacy {
    margin-top: 12px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.40);
    text-align: center;
    line-height: 1.5;
}

/* ── Success panel ──────────────────────────────────────────────────────── */

.efl-subscribe-success {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    animation: efl-fade-in 320ms ease;
}

.efl-subscribe-success--visible {
    display: flex;
}

.efl-subscribe-success__icon {
    width: 44px;
    height: 44px;
    color: #6ee7b7;
    filter: drop-shadow(0 0 12px rgba(110, 231, 183, 0.50));
    animation: efl-pop 400ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes efl-pop {
    from { transform: scale(0.6); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.efl-subscribe-success__text {
    font-size: 0.95rem;
    font-weight: 600;
    color: #d1fae5;
    line-height: 1.5;
    margin: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   2. GENERIC / CONTACT FORMS
   Light background context (page, sidebar, widget).
   ═══════════════════════════════════════════════════════════════════════════ */

.efl-form-contact,
.efl-form-enquiry,
.efl-form-list-property {
    --efl-radius:      10px;
    --efl-border:      #e2e8f0;
    --efl-border-focus:#10b981;
    --efl-input-bg:    #ffffff;
    --efl-input-color: #0f172a;
    --efl-placeholder: #94a3b8;
    --efl-label-color: #374151;
    --efl-ring:        rgba(16, 185, 129, 0.25);
}

/* Dark mode overrides */
@media (prefers-color-scheme: dark) {
    .efl-form-contact,
    .efl-form-enquiry,
    .efl-form-list-property {
        --efl-border:      #334155;
        --efl-border-focus:#10b981;
        --efl-input-bg:    #1e293b;
        --efl-input-color: #f1f5f9;
        --efl-placeholder: #64748b;
        --efl-label-color: #cbd5e1;
    }
}

/* Also respect .dark class (Blogos theme uses class-based dark mode) */
.dark .efl-form-contact,
.dark .efl-form-enquiry,
.dark .efl-form-list-property {
    --efl-border:      #334155;
    --efl-border-focus:#10b981;
    --efl-input-bg:    #1e293b;
    --efl-input-color: #f1f5f9;
    --efl-placeholder: #64748b;
    --efl-label-color: #cbd5e1;
}

/* Field wrapper */
.efl-form-wrap .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Label */
.efl-form-wrap .label {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--efl-label-color, #374151);
    line-height: 1.4;
}

/* Inputs and textareas */
.efl-form-wrap .input,
.efl-form-wrap input[type="text"],
.efl-form-wrap input[type="email"],
.efl-form-wrap input[type="tel"],
.efl-form-wrap textarea,
.efl-form-wrap select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--efl-border, #e2e8f0);
    border-radius: var(--efl-radius, 10px);
    background: var(--efl-input-bg, #fff);
    color: var(--efl-input-color, #0f172a);
    font-size: 0.9rem;
    font-family: inherit;
    line-height: 1.5;
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
}

.efl-form-wrap .input::placeholder,
.efl-form-wrap input::placeholder,
.efl-form-wrap textarea::placeholder {
    color: var(--efl-placeholder, #94a3b8);
}

.efl-form-wrap .input:focus,
.efl-form-wrap input:focus,
.efl-form-wrap textarea:focus,
.efl-form-wrap select:focus {
    border-color: var(--efl-border-focus, #10b981);
    box-shadow: 0 0 0 3px var(--efl-ring, rgba(16,185,129,0.25));
}

/* Validation states */
.efl-form-wrap .efl-input--invalid,
.efl-form-wrap input.efl-input--invalid {
    border-color: #f87171 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

/* Generic / contact form feedback */
.efl-form-wrap .efl-message {
    display: none;
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--efl-radius, 10px);
    border: 1px solid transparent;
    font-size: 0.875rem;
    line-height: 1.6;
    text-align: center;
    animation: efl-fade-in 200ms ease;
}

.efl-form-wrap .efl-message--success {
    background: #ecfdf5;
    border-color: #6ee7b7;
    color: #065f46;
}

.efl-form-wrap .efl-message--error {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #991b1b;
}

@media (prefers-color-scheme: dark) {
    .efl-form-wrap .efl-message--success {
        background: rgba(6, 78, 59, 0.35);
        border-color: #059669;
        color: #6ee7b7;
    }
    .efl-form-wrap .efl-message--error {
        background: rgba(127, 29, 29, 0.35);
        border-color: #dc2626;
        color: #fca5a5;
    }
}

.dark .efl-form-wrap .efl-message--success {
    background: rgba(6, 78, 59, 0.35);
    border-color: #059669;
    color: #6ee7b7;
}

.dark .efl-form-wrap .efl-message--error {
    background: rgba(127, 29, 29, 0.35);
    border-color: #dc2626;
    color: #fca5a5;
}

/* ── Submit buttons (generic forms) ─────────────────────────────────────── */

.efl-form-wrap .btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 24px;
    border: none;
    border-radius: var(--efl-radius, 10px);
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 700;
    font-family: inherit;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.35);
    transition: opacity 160ms ease, transform 120ms ease, box-shadow 160ms ease;
    -webkit-appearance: none;
    appearance: none;
}

.efl-form-wrap .btn-primary:hover:not(:disabled) {
    opacity: 0.92;
    transform: translateY(-1px);
    box-shadow: 0 4px 18px rgba(5, 150, 105, 0.40);
}

.efl-form-wrap .btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.efl-form-wrap .btn-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

/* ── Help text ───────────────────────────────────────────────────────────── */

.efl-form-wrap .help {
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.5;
    margin: 0;
}

.dark .efl-form-wrap .help {
    color: #94a3b8;
}

/* ═══════════════════════════════════════════════════════════════════════════
   3. LOADING STATE
   ═══════════════════════════════════════════════════════════════════════════ */

[data-elenchus-form] {
    position: relative;
}

/* ═══════════════════════════════════════════════════════════════════════════
   4. ANIMATIONS
   ═══════════════════════════════════════════════════════════════════════════ */

@keyframes efl-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   5. ACCESSIBILITY
   ═══════════════════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    .efl-subscribe-success__icon,
    .efl-subscribe-success,
    .efl-subscribe-form__error--visible,
    .efl-form-wrap .efl-message,
    .efl-subscribe-form__spinner {
        animation: none !important;
        transition: none !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   6. CONTACT / GENERIC FORM LAYOUT HELPERS
   (Additions that replace Tailwind utility dependencies in the template)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Two-column field row */
.efl-form-wrap .efl-field-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (min-width: 560px) {
    .efl-form-wrap .efl-field-row {
        grid-template-columns: 1fr 1fr;
    }
}

/* Single form-group spacing when not in a row */
.efl-form-wrap .form-group {
    margin-bottom: 1rem;
}

.efl-form-wrap .efl-field-row .form-group {
    margin-bottom: 0;
}

/* Required / optional markers */
.efl-form-wrap .efl-required {
    color: #ef4444;
}

.efl-form-wrap .efl-optional {
    font-size: 0.75rem;
    font-weight: 400;
    color: #94a3b8;
}

/* Submit button layout */
.efl-form-wrap .btn-primary {
    margin-top: 0.5rem;
    position: relative;
}

.efl-form-wrap .efl-btn-spinner {
    display: none;
}

.efl-form-wrap .btn-primary.is-loading .efl-btn-label {
    opacity: 0.5;
}

.efl-form-wrap .btn-primary.is-loading .efl-btn-spinner {
    display: inline-flex;
}

.efl-form-wrap .btn-primary.is-loading .efl-btn-arrow {
    opacity: 0;
}

.efl-btn-spinner .efl-subscribe-form__spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    animation: efl-spin 0.7s linear infinite;
}

.efl-btn-arrow {
    flex-shrink: 0;
    transition: transform 200ms ease;
}

.efl-form-wrap .btn-primary:hover:not(:disabled) .efl-btn-arrow {
    transform: translateX(3px);
}

/* Privacy note below submit */
.efl-form-wrap .efl-form-privacy {
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: #94a3b8;
    text-align: center;
    line-height: 1.5;
}

/* Feedback message block — generic forms */
.efl-form-wrap .efl-message {
    width: 100%;
    padding: 0.875rem 1rem;
    border-radius: 0.625rem;
    border: 1px solid transparent;
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: 1rem;  /* space between message and submit button */
    animation: efl-fade-in 200ms ease;
}

.efl-form-wrap .efl-message--success {
    background: #ecfdf5;
    border-color: #6ee7b7;
    color: #065f46;
    display: block !important;
}

.efl-form-wrap .efl-message--error {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #991b1b;
    display: block !important;
}

.dark .efl-form-wrap .efl-message--success,
.pa-enquiry__form .efl-message--success {
    background: rgba(6, 78, 59, 0.35);
    border-color: #059669;
    color: #6ee7b7;
}

.dark .efl-form-wrap .efl-message--error,
.pa-enquiry__form .efl-message--error {
    background: rgba(127, 29, 29, 0.35);
    border-color: #dc2626;
    color: #fca5a5;
}

/* Dark-context input overrides (advertise page enquiry panel) */
.pa-enquiry__form .efl-form-wrap .input,
.pa-enquiry__form .efl-form-wrap input,
.pa-enquiry__form .efl-form-wrap textarea,
.pa-enquiry__form .efl-form-wrap select {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.12);
    color: #f1f5f9;
}

.pa-enquiry__form .efl-form-wrap .input::placeholder,
.pa-enquiry__form .efl-form-wrap input::placeholder,
.pa-enquiry__form .efl-form-wrap textarea::placeholder {
    color: #64748b;
}

.pa-enquiry__form .efl-form-wrap .label {
    color: #94a3b8;
}

.pa-enquiry__form .efl-form-wrap .input:focus,
.pa-enquiry__form .efl-form-wrap input:focus,
.pa-enquiry__form .efl-form-wrap textarea:focus,
.pa-enquiry__form .efl-form-wrap select:focus {
    border-color: #10b981;
    background: rgba(255,255,255,0.09);
}
