/*
 * Front-end styling for imamali-secure-registrations.
 *
 * Every colour below is taken from the active "imamali" theme
 * (wp-content/themes/imamali/style.css) rather than invented, so the forms
 * read as part of the site instead of as a bolted-on plugin:
 *   #448c8b  primary teal (header, buttons, links)
 *   #347c7b  darker teal (hover)
 *   #539b9a  lighter teal (accents, gradient)
 *   #22282a  heading ink
 *   #5a5a5a  body text
 *   #e3e6e8  borders      #d3d6d8  stronger borders
 *   #f9f9f9  subtle surface
 *
 * The site runs dir="RTL" with an LTR-capable language switcher, so all
 * directional spacing uses logical properties (padding-inline-start rather
 * than padding-left) and layout uses CSS grid, which follows the writing
 * direction on its own. Avoid left/right in this file.
 */

:root {
    --iasr-teal: #448c8b;
    --iasr-teal-dark: #347c7b;
    --iasr-teal-light: #539b9a;
    --iasr-teal-tint: #f2f8f8;
    --iasr-ink: #22282a;
    --iasr-text: #5a5a5a;
    --iasr-muted: #8a9494;
    --iasr-border: #e3e6e8;
    --iasr-border-strong: #d3d6d8;
    --iasr-surface: #ffffff;
    --iasr-surface-alt: #f9f9f9;
    --iasr-error: #c0392b;
    --iasr-error-bg: #fdf0ef;
    --iasr-error-ink: #7a2019;
    --iasr-radius: 8px;
    --iasr-focus-ring: rgba(68, 140, 139, .18);
}

/* ------------------------------------------------------- form language --- */

/*
 * The site is lang="fa-IR" dir="RTL" and the theme body font (Mitra,
 * Nassim) draws ASCII digits with Persian glyphs - the same substitution
 * that made the footer's organisation number unreadable. A form showing
 * Norwegian or English text therefore needs an explicit Latin stack, or
 * "6-30 tegn" comes out as Persian numerals in the wrong order.
 *
 * Forms.php tags each card with its own lang/dir, so direction is handled
 * by the browser and only the font needs overriding here. The Persian
 * variant deliberately inherits the theme font.
 */
.iasr-form-card[lang="nb"],
.iasr-form-card[lang="en"] {
    font-family: Arial, Helvetica, sans-serif;
}

.iasr-form-card[lang="nb"] input,
.iasr-form-card[lang="nb"] textarea,
.iasr-form-card[lang="nb"] button,
.iasr-form-card[lang="en"] input,
.iasr-form-card[lang="en"] textarea,
.iasr-form-card[lang="en"] button {
    font-family: inherit;
}

/*
 * Section numbers deliberately inherit the card font rather than being
 * forced to one script: Latin 1/2/3 on the Norwegian and English forms,
 * Persian numerals on the Persian one, which is what a reader of each
 * expects.
 */

/* ---------------------------------------------------------------- card --- */

.iasr-form-card {
    background: var(--iasr-surface);
    border: 1px solid var(--iasr-border);
    border-radius: var(--iasr-radius);
    box-shadow: 0 1px 2px rgba(34, 40, 42, .04), 0 8px 24px rgba(34, 40, 42, .06);
    max-width: 760px;
    margin: 0 auto 2.5rem;
    overflow: hidden;
}

.iasr-card-header {
    background: linear-gradient(135deg, var(--iasr-teal) 0%, var(--iasr-teal-dark) 100%);
    color: #fff;
    padding: 26px 32px;
}

.iasr-card-title {
    margin: 0;
    color: #fff;
    font-size: 24px;
    line-height: 1.3;
}

.iasr-card-intro {
    margin: 8px 0 0;
    color: rgba(255, 255, 255, .88);
    font-size: 14px;
    line-height: 1.6;
}

.iasr-card-body {
    padding: 28px 32px 32px;
}

/* --------------------------------------------------------------- fields --- */

/*
 * Two columns for short fields; anything tagged .iasr-field-full spans the
 * whole row. Grid resolves start/end against the page direction, so this
 * needs no RTL override.
 */
.iasr-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 20px;
}

.iasr-field-full {
    grid-column: 1 / -1;
}

.iasr-field label {
    display: block;
    margin: 0;
    font-weight: 600;
    color: var(--iasr-ink);
}

.iasr-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13.5px;
    letter-spacing: .01em;
}

.iasr-required {
    color: var(--iasr-error);
    font-weight: 700;
}

.iasr-hint {
    display: block;
    margin-top: 5px;
    font-size: 12.5px;
    font-weight: 400;
    color: var(--iasr-muted);
    line-height: 1.5;
}

.iasr-form input[type="text"],
.iasr-form input[type="email"],
.iasr-form input[type="tel"],
.iasr-form input[type="date"],
.iasr-form input[type="number"],
.iasr-form input[type="password"],
.iasr-form textarea,
.iasr-form select {
    box-sizing: border-box;
    width: 100%;
    margin: 0;
    padding: 10px 14px;
    background: var(--iasr-surface);
    border: 1px solid var(--iasr-border-strong);
    border-radius: 5px;
    color: var(--iasr-ink);
    font-size: 15px;
    line-height: 1.5;
    font-weight: 400;
    box-shadow: none;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.iasr-form textarea {
    min-height: 88px;
    resize: vertical;
}

.iasr-form input:hover,
.iasr-form textarea:hover {
    border-color: var(--iasr-teal-light);
}

.iasr-form input:focus,
.iasr-form textarea:focus,
.iasr-form select:focus {
    border-color: var(--iasr-teal) !important;
    box-shadow: 0 0 0 3px var(--iasr-focus-ring);
    outline: 0;
}

/*
 * Invalid-field styling.
 *
 * This must be :user-invalid, not :invalid. A required field is :invalid
 * from the moment the page loads, so :invalid alone paints every empty
 * required field red before the visitor has typed anything - which is
 * exactly what an earlier ":not(:placeholder-shown):invalid" rule here did,
 * because none of these inputs carry a placeholder attribute and so
 * :not(:placeholder-shown) always matched. :user-invalid only matches once
 * the field has actually been edited or submission attempted.
 */
.iasr-form input:user-invalid,
.iasr-form textarea:user-invalid {
    border-color: var(--iasr-error);
    background-color: #fffafa;
}

.iasr-form input:user-invalid:focus,
.iasr-form textarea:user-invalid:focus {
    border-color: var(--iasr-error) !important;
    box-shadow: 0 0 0 3px rgba(192, 57, 43, .14);
}

/* Dates and phone numbers read left-to-right even on the RTL page. */
.iasr-form input[type="date"],
.iasr-form input[type="email"],
.iasr-form input[type="tel"] {
    direction: ltr;
    text-align: start;
}

/* ------------------------------------------------------------- sections --- */

/*
 * The marriage form is long enough that a flat list of inputs is hard to
 * scan, so it is split into numbered sections (groom / bride / ceremony).
 */
.iasr-section {
    border-top: 1px solid var(--iasr-border);
    margin-top: 28px;
    padding-top: 22px;
}

.iasr-section:first-of-type {
    border-top: 0;
    margin-top: 0;
    padding-top: 0;
}

.iasr-section-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.iasr-section-number {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--iasr-teal-tint);
    border: 1px solid var(--iasr-teal-light);
    color: var(--iasr-teal-dark);
    font-size: 13px;
    font-weight: 700;
    direction: ltr;
}

.iasr-section-title {
    margin: 0;
    padding: 0;
    border: 0;
    color: var(--iasr-ink);
    font-size: 17px;
    line-height: 1.3;
}

/* Legacy: earlier markup used bare <h4> headings inside the form. */
.iasr-form h4 {
    color: var(--iasr-ink);
    border-bottom: 1px solid var(--iasr-border);
    padding-bottom: 8px;
    margin: 1.75rem 0 1rem;
}

/* ------------------------------------------------------------ checkbox --- */

.iasr-checkbox-field {
    grid-column: 1 / -1;
    background: var(--iasr-surface-alt);
    border: 1px solid var(--iasr-border);
    border-radius: 5px;
    padding: 14px 16px;
}

.iasr-checkbox-field label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-weight: 500;
    font-size: 14px;
    color: var(--iasr-text);
    cursor: pointer;
}

.iasr-checkbox-field input[type="checkbox"] {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    margin: 2px 0 0;
    accent-color: var(--iasr-teal);
}

/* -------------------------------------------------------------- footer --- */

.iasr-form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 26px;
    padding-top: 22px;
    border-top: 1px solid var(--iasr-border);
}

.iasr-required-note {
    margin: 0;
    font-size: 12.5px;
    color: var(--iasr-muted);
}

.iasr-privacy-note {
    margin: 18px 0 0;
    padding: 12px 16px;
    background: var(--iasr-teal-tint);
    border-inline-start: 3px solid var(--iasr-teal-light);
    border-radius: 4px;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--iasr-teal-dark);
}

/* ------------------------------------------------------------- buttons --- */

.iasr-submit-button,
.iasr-vipps-button {
    display: inline-block;
    background-color: var(--iasr-teal);
    color: #fff !important;
    border: 1px solid var(--iasr-teal);
    border-radius: 5px;
    padding: 0 30px;
    height: 44px;
    line-height: 42px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    text-decoration: none !important;
    text-shadow: none;
    cursor: pointer;
    transition: background-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.iasr-submit-button:hover,
.iasr-vipps-button:hover,
.iasr-submit-button:focus,
.iasr-vipps-button:focus {
    background-color: var(--iasr-teal-dark);
    border-color: var(--iasr-teal-dark);
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(52, 124, 123, .28);
    transform: translateY(-1px);
}

.iasr-submit-button:active,
.iasr-vipps-button:active {
    transform: translateY(0);
    box-shadow: none;
}

/* ---------------------------------------------------- language switcher --- */

.iasr-language-switcher {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 6px;
    margin-bottom: 22px;
    padding: 9px 14px;
    background: var(--iasr-surface-alt);
    border: 1px solid var(--iasr-border);
    border-radius: 5px;
    font-size: 13px;
    color: var(--iasr-text);
}

.iasr-language-switcher a,
.iasr-language-switcher .iasr-lang-current {
    padding: 3px 9px;
    border-radius: 3px;
    text-decoration: none;
}

.iasr-language-switcher a {
    color: var(--iasr-teal-dark);
}

.iasr-language-switcher a:hover {
    background: var(--iasr-teal-tint);
    color: var(--iasr-teal-dark);
}

.iasr-language-switcher .iasr-lang-current {
    background: var(--iasr-teal);
    color: #fff;
}

.iasr-language-switcher .iasr-lang-current strong {
    color: #fff;
    font-weight: 700;
}

/* ------------------------------------------------------------- notices --- */

.iasr-notice {
    padding: 14px 18px;
    border-radius: 5px;
    margin-bottom: 22px;
    border: 1px solid transparent;
    border-inline-start-width: 4px;
}

.iasr-notice p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
}

.iasr-notice-success {
    background: var(--iasr-teal-tint);
    border-color: #cfe4e3;
    border-inline-start-color: var(--iasr-teal);
    color: var(--iasr-teal-dark);
}

.iasr-notice-error {
    background: var(--iasr-error-bg);
    border-color: #f0cec9;
    border-inline-start-color: var(--iasr-error);
    color: var(--iasr-error-ink);
}

/* --------------------------------------------------------------- vipps --- */

.iasr-vipps-box {
    background: var(--iasr-surface-alt);
    border: 1px dashed var(--iasr-border-strong);
    border-radius: 5px;
    padding: 16px 18px;
    margin-bottom: 22px;
}

.iasr-vipps-box p {
    margin: 0 0 12px;
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--iasr-text);
}

.iasr-vipps-verified {
    background: var(--iasr-teal-tint);
    border: 1px solid var(--iasr-teal-light);
    border-style: solid;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.iasr-vipps-badge {
    color: var(--iasr-teal-dark);
    font-weight: 600;
    font-size: 14px;
}

.iasr-vipps-clear {
    font-size: 12.5px;
    color: var(--iasr-muted);
}

.iasr-unregistration-card .iasr-vipps-button {
    margin-top: 6px;
}

/* ------------------------------------------ unregistration identity box --- */

.iasr-identity-heading {
    margin: 0 0 10px;
    color: var(--iasr-ink);
    font-size: 17px;
}

.iasr-identity-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--iasr-surface-alt);
    border: 1px solid var(--iasr-border);
    border-radius: 5px;
    margin-bottom: 10px;
    overflow: hidden;
}

.iasr-identity-table th,
.iasr-identity-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--iasr-border);
    font-size: 14px;
    text-align: inherit;
}

.iasr-identity-table th {
    color: var(--iasr-muted);
    font-weight: 600;
    white-space: nowrap;
    width: 1%;
}

.iasr-identity-table td {
    color: var(--iasr-ink);
}

.iasr-identity-table tr:last-child th,
.iasr-identity-table tr:last-child td {
    border-bottom: 0;
}

/* Phone numbers and email addresses stay left-to-right inside the RTL page. */
.iasr-ltr {
    direction: ltr;
    unicode-bidi: embed;
    display: inline-block;
}

.iasr-identity-note {
    font-size: 13px;
    color: var(--iasr-muted);
    margin-bottom: 20px;
    line-height: 1.6;
}

.iasr-unreg-advanced {
    margin-bottom: 18px;
    padding: 12px 16px;
    background: var(--iasr-surface-alt);
    border: 1px solid var(--iasr-border);
    border-radius: 5px;
    font-size: 13px;
}

.iasr-unreg-advanced summary {
    cursor: pointer;
    color: var(--iasr-teal-dark);
    font-weight: 600;
}

.iasr-unreg-advanced .iasr-field {
    margin-top: 14px;
}

/* ---------------------------------------------------------- responsive --- */

@media (max-width: 600px) {
    .iasr-card-header {
        padding: 20px 20px;
    }

    .iasr-card-title {
        font-size: 20px;
    }

    .iasr-card-body {
        padding: 20px 20px 24px;
    }

    /* One column on phones - two 50% inputs are unusable at this width. */
    .iasr-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }

    .iasr-form-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .iasr-submit-button {
        width: 100%;
        text-align: center;
    }

    .iasr-required-note {
        order: 2;
        text-align: center;
    }
}
