/**
 * OLLMH Forms — front-end styling.
 *
 * Covers: form layout, field styling, multi-step progress bar, error/success
 * messages, Turnstile container, file upload progress, and the newsletter
 * confirmation page.
 */

/* ── Form container ─────────────────────────────────────────────────────── */
.ollmh-form {
    --ollmh-primary: #1a5632;
    --ollmh-primary-dark: #134024;
    --ollmh-error: #c0392b;
    --ollmh-success: #1e8449;
    --ollmh-radius: 6px;
    --ollmh-border: #d4d4d4;
    --ollmh-bg-error: #fdecea;
    --ollmh-bg-success: #eafaf1;

    max-width: 640px;
    margin: 1.5em 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

.ollmh-form * {
    box-sizing: border-box;
}

/* ── Fields ─────────────────────────────────────────────────────────────── */
.ollmh-field {
    margin-bottom: 1rem;
}

.ollmh-field > label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.ollmh-field .required {
    color: var(--ollmh-error);
}

.ollmh-field input[type="text"],
.ollmh-field input[type="email"],
.ollmh-field input[type="tel"],
.ollmh-field input[type="number"],
.ollmh-field input[type="date"],
.ollmh-field input[type="time"],
.ollmh-field input[type="file"],
.ollmh-field select,
.ollmh-field textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--ollmh-border);
    border-radius: var(--ollmh-radius);
    background: #fff;
    font-size: 1rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Custom chevron for <select> dropdowns — replaces the native arrow with
   a Font Awesome-style SVG chevron positioned with comfortable spacing
   from the right edge. The .is-open class (toggled by JS) flips the
   chevron to point up when the dropdown is active. */
.ollmh-field select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 2.5rem;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 1rem;
    cursor: pointer;
}
.ollmh-field select::-ms-expand {
    display: none;
}
.ollmh-field select.is-open {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23005a9c' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='18 15 12 9 6 15'/%3E%3C/svg%3E");
}

.ollmh-field input:focus,
.ollmh-field select:focus,
.ollmh-field textarea:focus {
    border-color: var(--ollmh-primary);
    box-shadow: 0 0 0 3px rgba(26, 86, 50, 0.15);
    outline: none;
}

.ollmh-field textarea {
    resize: vertical;
    min-height: 6rem;
}

.ollmh-field-help {
    font-size: 0.85rem;
    color: #666;
    margin: 0 0 1rem;
}

.ollmh-skip-note {
    font-style: italic;
    color: var(--ollmh-primary-dark, #2c5e4a);
}

/* Grid layouts */
.ollmh-form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.ollmh-form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.ollmh-form-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.ollmh-form-row {
    margin-bottom: 0;
}

@media (max-width: 600px) {
    .ollmh-form-grid-2,
    .ollmh-form-grid-3,
    .ollmh-form-grid-4 {
        grid-template-columns: 1fr;
    }
}

/* ── Radio / checkbox groups ────────────────────────────────────────────── */
.ollmh-radio-group {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.ollmh-radio,
.ollmh-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 400;
    cursor: pointer;
}

.ollmh-radio input,
.ollmh-checkbox input {
    margin: 0;
}

.ollmh-checkbox-field {
    margin: 0.5rem 0 1rem;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.ollmh-btn {
    display: inline-block;
    padding: 0.7rem 1.5rem;
    border: 1px solid transparent;
    border-radius: var(--ollmh-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, opacity 0.15s ease;
    text-align: center;
}

.ollmh-btn-primary {
    background: #005a9c;
    color: #fff;
}

.ollmh-btn-primary:hover {
    background: #003c6e;
}

.ollmh-btn-secondary {
    background: #f0f0f0;
    color: #333;
    border-color: var(--ollmh-border);
}

.ollmh-btn-secondary:hover {
    background: #e4e4e4;
}

.ollmh-btn:disabled,
.ollmh-btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

.ollmh-form-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

/* ── Spinner ────────────────────────────────────────────────────────────── */
.ollmh-form-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(26, 86, 50, 0.25);
    border-top-color: var(--ollmh-primary);
    border-radius: 50%;
    animation: ollmh-spin 0.7s linear infinite;
}

.ollmh-form.is-submitting .ollmh-form-spinner {
    display: inline-block;
}

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

/* ── Messages ───────────────────────────────────────────────────────────── */
.ollmh-form-messages {
    margin-bottom: 1rem;
}

.ollmh-form-messages:empty {
    display: none;
}

.ollmh-message {
    padding: 0.75rem 1rem;
    border-radius: var(--ollmh-radius);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.ollmh-message.is-success {
    background: var(--ollmh-bg-success);
    color: var(--ollmh-success);
    border: 1px solid #abebc6;
}

.ollmh-message.is-error {
    background: var(--ollmh-bg-error);
    color: var(--ollmh-error);
    border: 1px solid #f5b7b1;
}

/* ── Field errors ───────────────────────────────────────────────────────── */
.ollmh-field-error {
    display: block;
    color: var(--ollmh-error);
    font-size: 0.82rem;
    margin-top: 0.25rem;
    min-height: 1em;
}

.ollmh-field-error:empty {
    display: none;
}

.ollmh-field.has-error input,
.ollmh-field.has-error select,
.ollmh-field.has-error textarea {
    border-color: var(--ollmh-error);
    background: var(--ollmh-bg-error);
}

/* ── Turnstile container ────────────────────────────────────────────────── */
.ollmh-turnstile-field {
    margin: 1rem 0;
}

.ollmh-turnstile-field .cf-turnstile {
    min-height: 65px;
}

/* ── Multi-step application ─────────────────────────────────────────────── */
.ollmh-application-wrap {
    max-width: 720px;
    margin: 1.5em 0;
}

.ollmh-step {
    display: none;
}

.ollmh-step.is-current {
    display: block;
}

.ollmh-step fieldset {
    border: 1px solid var(--ollmh-border);
    border-radius: var(--ollmh-radius);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.ollmh-step legend {
    font-weight: 700;
    padding: 0 0.5rem;
    color: var(--ollmh-primary-dark);
}

.ollmh-step-actions {
    justify-content: space-between;
}

/* Progress bar */
.ollmh-step-progress {
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 0;
    display: flex;
    counter-reset: step;
    overflow: hidden;
    border-radius: var(--ollmh-radius);
}

.ollmh-step-progress li {
    flex: 1;
    padding: 0.6rem 0.5rem;
    text-align: center;
    background: #ececec;
    color: #777;
    font-size: 0.82rem;
    position: relative;
    counter-increment: step;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.ollmh-step-progress li::before {
    content: counter(step);
    display: inline-block;
    width: 1.4em;
    height: 1.4em;
    line-height: 1.4em;
    border-radius: 50%;
    background: #ccc;
    color: #fff;
    font-weight: 700;
    margin-right: 0.4rem;
}

.ollmh-step-progress li.is-active {
    background: var(--ollmh-primary);
    color: #fff;
}

.ollmh-step-progress li.is-active::before {
    background: #fff;
    color: var(--ollmh-primary);
}

.ollmh-step-progress li.is-complete {
    background: #d4efdf;
    color: var(--ollmh-success);
}

.ollmh-step-progress li.is-complete::before {
    background: var(--ollmh-success);
    color: #fff;
}

@media (max-width: 600px) {
    .ollmh-step-progress {
        flex-direction: column;
    }
    .ollmh-step-progress li {
        text-align: left;
    }
}

/* Review summary — accordion (categorised, single-expand) */
.ollmh-review-accordion {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin: 0;
}
.ollmh-review-accordion-item {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}
.ollmh-review-accordion-item.is-open {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.ollmh-review-accordion-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: none;
    border: none;
    font-size: 0.95rem;
    font-weight: 600;
    color: #334155;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease;
}
.ollmh-review-accordion-header:hover {
    background: #f8fafc;
}
.ollmh-review-accordion-header:focus-visible {
    outline: 2px solid #005a9c;
    outline-offset: -2px;
}
.ollmh-review-accordion-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.ollmh-review-accordion-title > i {
    color: #005a9c;
    font-size: 0.95rem;
    flex-shrink: 0;
}
.ollmh-review-accordion-icon {
    font-size: 0.8rem;
    color: #64748b;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}
.ollmh-review-accordion-item.is-open .ollmh-review-accordion-icon {
    transform: rotate(180deg);
    color: #005a9c;
}
.ollmh-review-accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding: 0 1rem;
}
.ollmh-review-accordion-item.is-open .ollmh-review-accordion-body {
    padding-bottom: 1rem;
}

.ollmh-review-list {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.4rem 1rem;
    margin: 0;
}

.ollmh-review-list dt {
    font-weight: 600;
    color: #555;
}

.ollmh-review-list dd {
    margin: 0;
}

/* ── Upload progress ────────────────────────────────────────────────────── */
.ollmh-upload-progress {
    width: 100%;
    height: 6px;
    margin-top: 0.5rem;
    -webkit-appearance: none;
    appearance: none;
    border: none;
    border-radius: 3px;
    overflow: hidden;
}

.ollmh-upload-progress::-webkit-progress-bar {
    background: #ececec;
}

.ollmh-upload-progress::-webkit-progress-value {
    background: var(--ollmh-primary);
    transition: width 0.2s ease;
}

.ollmh-upload-progress::-moz-progress-bar {
    background: var(--ollmh-primary);
}

.ollmh-upload-field .ollmh-file-status {
    font-size: 0.82rem;
    color: var(--ollmh-success);
    margin-top: 0.25rem;
}

/* ── Event details block ────────────────────────────────────────────────── */
.ollmh-event-details {
    background: #f7f9f7;
    border: 1px solid #e0e8e0;
    border-radius: var(--ollmh-radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.ollmh-event-title {
    margin: 0 0 0.25rem;
    color: var(--ollmh-primary-dark);
}

.ollmh-event-date,
.ollmh-event-location {
    margin: 0;
    font-size: 0.9rem;
    color: #555;
}

/* ── Newsletter ─────────────────────────────────────────────────────────── */
.ollmh-newsletter-form-wrap {
    max-width: 480px;
    margin: 1.5em 0;
    padding: 1.5rem;
    background: #f7f9f7;
    border: 1px solid #e0e8e0;
    border-radius: var(--ollmh-radius);
}

.ollmh-newsletter-heading {
    margin: 0 0 0.5rem;
    color: var(--ollmh-primary-dark);
}

.ollmh-newsletter-description {
    margin: 0 0 1rem;
    font-size: 0.9rem;
    color: #555;
}

.ollmh-newsletter-page {
    max-width: 640px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.ollmh-newsletter-notice {
    padding: 2rem;
    border-radius: var(--ollmh-radius);
    text-align: center;
}

.ollmh-newsletter-notice.is-success {
    background: var(--ollmh-bg-success);
    border: 1px solid #abebc6;
}

.ollmh-newsletter-notice.is-error {
    background: var(--ollmh-bg-error);
    border: 1px solid #f5b7b1;
}

.ollmh-newsletter-notice h1 {
    margin-top: 0;
}

/* ── Unavailable fallback (from core) ───────────────────────────────────── */
.ollmh-form-unavailable,
.ollmh-error {
    color: var(--ollmh-error);
    font-weight: 600;
}

/* ── SweetAlert2 toast theming ──────────────────────────────────────────── */
/* Match the OLLMH color palette so toasts blend with the site identity.   */
.swal2-popup.swal2-toast {
    border-radius: var(--ollmh-radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    font-family: inherit;
}

.swal2-popup.swal2-toast .swal2-title {
    font-size: 0.95rem;
    font-weight: 600;
}

.swal2-icon.swal2-icon-success .swal2-success-ring,
.swal2-icon.swal2-success .swal2-success-line-tip,
.swal2-icon.swal2-success .swal2-success-line-long {
    border-color: var(--ollmh-success) !important;
    color: var(--ollmh-success) !important;
}

.swal2-icon.swal2-error {
    border-color: var(--ollmh-error) !important;
    color: var(--ollmh-error) !important;
}

.swal2-icon.swal2-error [class^='swal2-x-mark-line'] {
    background-color: var(--ollmh-error) !important;
}

.swal2-timer-progress-bar {
    background: var(--ollmh-primary) !important;
}

/* ── SweetAlert2 modal theming (success popup) ──────────────────────────── */
.swal2-popup:not(.swal2-toast) {
    border-radius: 10px;
    font-family: inherit;
}

.swal2-popup:not(.swal2-toast) .swal2-title {
    color: var(--ollmh-primary-dark);
}

.swal2-popup:not(.swal2-toast) .swal2-confirm {
    border-radius: var(--ollmh-radius);
    font-weight: 600;
}

/* ── Unified Declaration & Verification card ──────────────────────────────
   Mirrors the "Contact Us" page card rhythm: white card, 12px radius,
   soft shadow, icon + title + intro header. All interactive elements
   use a 4px hover offset (translateY -4px) for a tactile lift. */
.ollmh-confirm-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.ollmh-confirm-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

/* Card header — icon + title + intro (mirrors .ollmh-contact-card-header).
   No bottom margin so the body content starts flush with the tagline. */
.ollmh-confirm-card-header {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    margin-bottom: 0;
}
.ollmh-confirm-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(0, 90, 156, 0.08);
    color: #005a9c;
    font-size: 1.25rem;
    flex-shrink: 0;
    transition: all 0.2s ease;
}
.ollmh-confirm-card:hover .ollmh-confirm-card-icon {
    background: #005a9c;
    color: #fff;
}
.ollmh-confirm-card-titles {
    display: flex;
    flex-direction: column;
}
.ollmh-confirm-card-titles h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #003c6e;
    margin: 0 0 0.25rem;
}
.ollmh-confirm-card-intro {
    font-size: 0.9rem;
    color: #64748b;
    margin: 0;
}

/* Card body */
.ollmh-confirm-card-body {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 1.25rem;
}

/* Declaration checkbox */
.ollmh-confirm-declaration {
    margin: 0;
}
.ollmh-confirm-checkbox {
    display: inline-flex;
    align-items: flex-start;
    gap: 0.4rem;
    font-size: 1rem;
    font-weight: 600;
    color: #334155;
    line-height: 1.35;
    cursor: pointer;
}
.ollmh-confirm-checkbox input[type="checkbox"] {
    margin-top: 0.15rem;
    flex-shrink: 0;
}
.ollmh-confirm-checkbox .required {
    color: var(--ollmh-error);
    line-height: 1;
}

/* Agreement text section — styled like Contact Us info-card content */
.ollmh-confirm-agreement {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--ollmh-radius);
    padding: 1rem 1.25rem;
}
.ollmh-confirm-agreement-text {
    font-size: 0.9375rem;
    color: #475569;
    line-height: 1.6;
    margin: 0;
}
.ollmh-confirm-agreement-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    list-style: none;
    margin: 1rem 0 0;
    padding: 0;
}
.ollmh-confirm-agreement-links li {
    margin: 0;
}

/* Disclaimer links inside the agreement — 4px hover offset */
.ollmh-confirm-agreement .ollmh-disclaimer-link,
.ollmh-confirm-card .ollmh-disclaimer-link {
    color: #005a9c;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: transform 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    display: inline-block;
}
.ollmh-confirm-agreement .ollmh-disclaimer-link:hover,
.ollmh-confirm-card .ollmh-disclaimer-link:hover {
    color: #003c6e;
    border-bottom-color: #005a9c;
    transform: translateY(-4px);
}

/* Bot verification section */
.ollmh-confirm-turnstile {
    margin: 0;
}
.ollmh-confirm-turnstile-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #334155;
    margin: 0 0 0.5rem;
}
.ollmh-confirm-turnstile .cf-turnstile {
    min-height: 65px;
}

/* Step-4 buttons — 4px hover offset (extends the existing .ollmh-btn hover) */
.ollmh-step-4 .ollmh-btn {
    transition: background-color 0.15s ease, opacity 0.15s ease, transform 0.2s ease;
}
.ollmh-step-4 .ollmh-btn-primary:hover {
    transform: translateY(-4px);
}
.ollmh-step-4 .ollmh-btn-secondary:hover {
    transform: translateY(-4px);
}
