/* Language switcher — appears in the top-right of hub/welcome/results. */
.estanar-ma-page .estanar-ma-lang-switch-wrap {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}
.estanar-ma-page .estanar-ma-lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff !important;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none !important;
    transition: background 0.2s, transform 0.15s;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.estanar-ma-page .estanar-ma-lang-switch:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: translateY(-1px);
    color: #ffffff !important;
}
[dir="rtl"] .estanar-ma-page .estanar-ma-lang-switch-wrap {
    justify-content: flex-end;
}

/**
 * Estanar Mini Assessments — public base styles.
 *
 * Visual identity matches the CIP landing experience: dark purple (#100047)
 * background, gold (#EDDC82) accents, cyan (#91CDEF) highlights, CTA blue
 * (#2246FF) buttons. Cairo type. Everything is scoped under `.estanar-ma-page`
 * (added to <body> by class-public.php and also wrapped around every public
 * view) so these dark-theme styles never leak into the rest of the site
 * (CIP plugin pages, Tutor courses, WooCommerce, etc.).
 *
 * IMPORTANT: shared design-system class names (.estanar-question-card,
 * .estanar-likert-scale__option) are styled in quiz.css, ALSO scoped under
 * `.estanar-ma-quiz` so the sibling estanar-cip-assessment plugin's UI is
 * never affected.
 */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&display=swap');

/* ---------------------------------------------------------------------------
 * Brand palette — exact CIP/Estanar values, scoped to .estanar-ma-page only
 * ------------------------------------------------------------------------- */

.estanar-ma-page {
    --ma-clr-dark: #100047;
    --ma-clr-purple: #4E36C9;
    --ma-clr-gold: #EDDC82;
    --ma-clr-cyan: #91CDEF;
    --ma-clr-cta-main: #2246FF;
    --ma-clr-cta-main-hover: #1a38cc;
    --ma-clr-cta-secondary: #8BA4FF;
    --ma-clr-cta-secondary-hover: #7b94ef;
    --ma-clr-white: #ffffff;
    --ma-clr-white-muted: rgba(255, 255, 255, 0.8);
    --ma-clr-white-subtle: rgba(255, 255, 255, 0.6);
    --ma-clr-card-bg: rgba(255, 255, 255, 0.08);
    --ma-clr-card-border: rgba(255, 255, 255, 0.15);
    --ma-clr-card-bg-solid: #ffffff;
    --ma-shadow-card: 0 4px 24px rgba(0, 0, 0, 0.15);
    --ma-shadow-card-hover: 0 8px 32px rgba(0, 0, 0, 0.2);
    --ma-radius-sm: 8px;
    --ma-radius-md: 12px;
    --ma-radius-lg: 20px;
    --ma-radius-pill: 999px;
}

/* ---------------------------------------------------------------------------
 * Self-contained dark section: the inline `<div class="estanar-ma-page">`
 * wrapper around every public view needs to look right even when dropped on
 * a page whose theme template renders a narrow light `<div class="entry-content">`
 * around it. We:
 *
 *   1. Force a full-bleed dark background so it visually breaks out of any
 *      narrow content wrapper (no awkward light gutters either side).
 *   2. Double the class for higher specificity so theme typography rules
 *      (font-family, color on h1..h3, link colours) don't override us.
 *   3. Reset margin & padding so the section truly fills the viewport edges.
 *
 * The body-level `.estanar-ma-page` class is also tagged on plugin pages
 * (hub via shortcode + standalone /quiz/ URLs) — those benefit from the same
 * dark theme tokens via the rules below.
 * ------------------------------------------------------------------------- */

body.estanar-ma-page,
.estanar-ma-page.estanar-ma-page {
    font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--ma-clr-dark);
    color: var(--ma-clr-white);
}

/* The inline wrapper <div class="estanar-ma-page"> around every view is the
 * one that actually needs the full-bleed treatment. Body-level applications
 * don't need this since the body is already full-width. */
div.estanar-ma-page {
    position: relative;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding: clamp(2.5rem, 6vw, 5rem) clamp(1rem, 5vw, 3rem);
    overflow-x: hidden;
    box-sizing: border-box;
}

/* Avoid double-padding when an estanar-ma-page wrapper <div> nests inside
 * ANOTHER wrapper <div> (e.g. multiple shortcodes on one page). The body
 * having the class is fine — body is already full-width so the wrapper
 * full-bleed math (100vw + 50%/50vw) still produces the right result. */
div.estanar-ma-page div.estanar-ma-page {
    width: auto;
    margin-left: 0;
    margin-right: 0;
    padding: 0;
}

/* Reset link colour inside our pages so theme defaults don't fight us. */
.estanar-ma-page a,
.estanar-ma-page a:hover,
.estanar-ma-page a:focus,
.estanar-ma-page a:visited {
    color: inherit;
    text-decoration: none;
}

/* Inner content container constrains line length on wide displays. */
.estanar-ma-page .estanar-ma-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0;
}

/* ---------------------------------------------------------------------------
 * Typography
 * ------------------------------------------------------------------------- */

/* Doubled-class selectors to overpower theme typography rules — many themes
 * style h1..h3 with their own colour/font-family at high specificity. */
.estanar-ma-page.estanar-ma-page h1,
.estanar-ma-page.estanar-ma-page h2,
.estanar-ma-page.estanar-ma-page h3,
.estanar-ma-page .estanar-ma-page h1,
.estanar-ma-page .estanar-ma-page h2,
.estanar-ma-page .estanar-ma-page h3 {
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
    color: var(--ma-clr-white);
    line-height: 1.2;
    margin: 0;
}

.estanar-ma-page.estanar-ma-page p,
.estanar-ma-page .estanar-ma-page p {
    line-height: 1.7;
    color: var(--ma-clr-white-muted);
    margin: 0;
}

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

.estanar-ma-page .estanar-ma-btn-primary,
.estanar-ma-page .estanar-ma-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.95rem 2rem;
    border: 2px solid transparent;
    border-radius: var(--ma-radius-pill);
    font-size: clamp(0.95rem, 1.6vw, 1.05rem);
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease,
        border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.estanar-ma-page .estanar-ma-btn-primary {
    background: var(--ma-clr-cta-main);
    color: var(--ma-clr-white);
    border-color: var(--ma-clr-cta-main);
}

.estanar-ma-page .estanar-ma-btn-primary:hover,
.estanar-ma-page .estanar-ma-btn-primary:focus-visible {
    background: var(--ma-clr-cta-main-hover);
    border-color: var(--ma-clr-cta-main-hover);
    color: var(--ma-clr-white);
    transform: translateY(-2px);
    box-shadow: var(--ma-shadow-card-hover);
}

.estanar-ma-page .estanar-ma-btn-secondary {
    background: transparent;
    color: var(--ma-clr-cta-secondary);
    border-color: var(--ma-clr-cta-secondary);
}

.estanar-ma-page .estanar-ma-btn-secondary:hover,
.estanar-ma-page .estanar-ma-btn-secondary:focus-visible {
    background: var(--ma-clr-cta-secondary);
    color: var(--ma-clr-dark);
    transform: translateY(-2px);
}

/* ---------------------------------------------------------------------------
 * HUB — grid of test cards
 * ------------------------------------------------------------------------- */

.estanar-ma-page .estanar-ma-hub {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    color: var(--ma-clr-white);
}

.estanar-ma-page.estanar-ma-page .estanar-ma-hub__title {
    font-family: 'Cairo', sans-serif;
    font-size: clamp(1.9rem, 4vw, 2.75rem);
    font-weight: 700;
    color: var(--ma-clr-white);
    text-align: center;
    margin: 0 0 1rem;
    line-height: 1.2;
}

/* Gold underline accent under the title — echoes the CIP landing. */
.estanar-ma-page .estanar-ma-hub__title::after {
    content: "";
    display: block;
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, var(--ma-clr-gold), var(--ma-clr-cta-main));
    border-radius: var(--ma-radius-pill);
    margin: 1rem auto 0;
}

[dir="rtl"] .estanar-ma-page .estanar-ma-hub__title::after {
    background: linear-gradient(270deg, var(--ma-clr-gold), var(--ma-clr-cta-main));
}

.estanar-ma-page.estanar-ma-page .estanar-ma-hub__intro {
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    color: var(--ma-clr-white-muted);
    text-align: center;
    max-width: 640px;
    margin: 0 auto;
    line-height: 1.6;
}

.estanar-ma-page .estanar-ma-hub__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.75rem;
    margin-top: clamp(2rem, 4vw, 3rem);
}

/* Solid white cards on dark background — strongest contrast & cleanest look. */
.estanar-ma-page .estanar-ma-hub__card {
    background: var(--ma-clr-card-bg-solid);
    color: var(--ma-clr-dark);
    border-radius: var(--ma-radius-md);
    padding: 2rem 1.75rem;
    box-shadow: var(--ma-shadow-card);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: relative;
    overflow: hidden;
}

/* Subtle top accent stripe in gold. */
.estanar-ma-page .estanar-ma-hub__card::before {
    content: "";
    position: absolute;
    inset-block-start: 0;
    inset-inline-start: 0;
    inset-inline-end: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--ma-clr-cta-main), var(--ma-clr-gold));
}

.estanar-ma-page .estanar-ma-hub__card:hover {
    transform: translateY(-6px);
    box-shadow: var(--ma-shadow-card-hover);
}

.estanar-ma-page .estanar-ma-hub__icon {
    width: 64px;
    height: 64px;
    object-fit: contain;
    margin-bottom: 0.25rem;
}

.estanar-ma-page.estanar-ma-page .estanar-ma-hub__card-title {
    font-family: 'Cairo', sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--ma-clr-dark);
    margin: 0;
    line-height: 1.3;
}

.estanar-ma-page.estanar-ma-page .estanar-ma-hub__card-desc {
    font-size: 0.97rem;
    color: rgba(16, 0, 71, 0.75);
    line-height: 1.65;
    margin: 0;
    flex: 1;
}

.estanar-ma-page.estanar-ma-page .estanar-ma-hub__card-meta {
    font-size: 0.85rem;
    color: rgba(16, 0, 71, 0.6);
    margin: 0;
    font-weight: 500;
}

.estanar-ma-page .estanar-ma-hub__minutes::before {
    content: "\23F1\FE0F";
    margin-inline-end: 0.4rem;
}

.estanar-ma-page .estanar-ma-hub__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--ma-clr-cta-main);
    color: var(--ma-clr-white);
    padding: 0.85rem 1.6rem;
    border-radius: var(--ma-radius-pill);
    text-decoration: none;
    font-weight: 600;
    text-align: center;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    align-self: flex-start;
    margin-top: 0.5rem;
}

.estanar-ma-page .estanar-ma-hub__cta:hover,
.estanar-ma-page .estanar-ma-hub__cta:focus-visible {
    background: var(--ma-clr-cta-main-hover);
    color: var(--ma-clr-white);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(34, 70, 255, 0.35);
}

/* RTL: CTA aligns to the right edge of the card. */
[dir="rtl"] .estanar-ma-page .estanar-ma-hub__cta {
    align-self: flex-end;
}

/* ---------------------------------------------------------------------------
 * WELCOME — Stage 1 of the assessment flow
 * ------------------------------------------------------------------------- */

.estanar-ma-page .estanar-ma-welcome {
    color: var(--ma-clr-white);
    min-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.estanar-ma-page .estanar-ma-welcome__inner {
    text-align: center;
    max-width: 760px;
    color: var(--ma-clr-white);
}

.estanar-ma-page .estanar-ma-welcome__header {
    margin-bottom: 2.25rem;
}

.estanar-ma-page.estanar-ma-page .estanar-ma-welcome__title {
    font-family: 'Cairo', sans-serif;
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 700;
    color: var(--ma-clr-white);
    margin: 0 0 1rem;
    line-height: 1.15;
    text-align: center;
}

.estanar-ma-page.estanar-ma-page .estanar-ma-welcome__desc {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: var(--ma-clr-white-muted);
    line-height: 1.7;
    margin: 0;
    text-align: center;
}

.estanar-ma-page .estanar-ma-welcome__scale-ref {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 480px;
    margin: 1.75rem auto;
    font-size: 0.9rem;
    color: var(--ma-clr-white-subtle);
}

.estanar-ma-page .estanar-ma-welcome__scale-track {
    flex: 1;
    height: 3px;
    background: linear-gradient(90deg, var(--ma-clr-cyan) 0%, var(--ma-clr-gold) 100%);
    border-radius: var(--ma-radius-pill);
}

[dir="rtl"] .estanar-ma-page .estanar-ma-welcome__scale-track {
    background: linear-gradient(90deg, var(--ma-clr-gold) 0%, var(--ma-clr-cyan) 100%);
}

.estanar-ma-page .estanar-ma-welcome__scale-end {
    white-space: nowrap;
}

.estanar-ma-page .estanar-ma-welcome__scale-end--high {
    color: var(--ma-clr-gold);
    font-weight: 600;
}

.estanar-ma-page .estanar-ma-welcome__expectations {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.estanar-ma-page .estanar-ma-welcome__chip {
    background: var(--ma-clr-card-bg);
    border: 1px solid var(--ma-clr-card-border);
    border-radius: var(--ma-radius-pill);
    padding: 0.75rem 1.4rem;
    display: inline-flex;
    align-items: baseline;
    gap: 0.5rem;
    backdrop-filter: blur(6px);
}

.estanar-ma-page .estanar-ma-welcome__chip strong {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ma-clr-white);
}

.estanar-ma-page .estanar-ma-welcome__chip span {
    font-size: 0.9rem;
    color: var(--ma-clr-white-muted);
}

/* Credibility note — gold left-border, glassy background. */
.estanar-ma-page .estanar-ma-welcome__credibility {
    background: var(--ma-clr-card-bg);
    border: 1px solid var(--ma-clr-card-border);
    border-inline-start: 4px solid var(--ma-clr-gold);
    border-radius: var(--ma-radius-md);
    padding: 1.1rem 1.5rem;
    margin: 0 auto 2rem;
    max-width: 600px;
    text-align: start;
    font-size: 0.95rem;
    color: var(--ma-clr-white-muted);
    line-height: 1.65;
}

.estanar-ma-page .estanar-ma-welcome__cta {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--ma-clr-cta-main);
    color: var(--ma-clr-white);
    border: 2px solid var(--ma-clr-cta-main);
    border-radius: var(--ma-radius-pill);
    padding: 1.1rem 2.5rem;
    font-size: clamp(1rem, 2vw, 1.15rem);
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
}

.estanar-ma-page .estanar-ma-welcome__cta:hover,
.estanar-ma-page .estanar-ma-welcome__cta:focus-visible {
    background: var(--ma-clr-cta-main-hover);
    border-color: var(--ma-clr-cta-main-hover);
    transform: translateY(-3px);
    box-shadow: 0 10px 26px rgba(34, 70, 255, 0.45);
    color: var(--ma-clr-white);
}

.estanar-ma-page .estanar-ma-welcome__cta:focus-visible {
    outline: 2px solid var(--ma-clr-gold);
    outline-offset: 4px;
}

/* ---------------------------------------------------------------------------
 * Inline CTA banner (shortcode used on course pages)
 * ------------------------------------------------------------------------- */

.estanar-ma-page .estanar-ma-cta {
    background: linear-gradient(135deg, var(--ma-clr-dark) 0%, var(--ma-clr-purple) 100%);
    color: var(--ma-clr-white);
    border-radius: var(--ma-radius-lg);
    padding: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--ma-shadow-card);
}

.estanar-ma-page .estanar-ma-cta__title {
    font-family: 'Cairo', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--ma-clr-white);
    margin: 0 0 0.5rem;
}

.estanar-ma-page .estanar-ma-cta__sub {
    color: var(--ma-clr-white-muted);
    margin: 0;
    line-height: 1.6;
}

.estanar-ma-page .estanar-ma-cta__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--ma-clr-gold);
    color: var(--ma-clr-dark);
    padding: 0.9rem 1.8rem;
    border-radius: var(--ma-radius-pill);
    text-decoration: none;
    font-weight: 700;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.estanar-ma-page .estanar-ma-cta__btn:hover,
.estanar-ma-page .estanar-ma-cta__btn:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(237, 220, 130, 0.4);
    color: var(--ma-clr-dark);
}

/* ---------------------------------------------------------------------------
 * Inline result messages (success / error / info)
 * ------------------------------------------------------------------------- */

.estanar-ma-page .estanar-ma-error,
.estanar-ma-page .estanar-ma-message {
    background: var(--ma-clr-card-bg);
    border: 1px solid var(--ma-clr-card-border);
    border-inline-start: 4px solid var(--ma-clr-cyan);
    color: var(--ma-clr-white);
    border-radius: var(--ma-radius-md);
    padding: 1.25rem 1.5rem;
    margin: 1rem auto;
    max-width: 600px;
    line-height: 1.6;
}

.estanar-ma-page .estanar-ma-error {
    border-inline-start-color: #FF6B6B;
}

/* ---------------------------------------------------------------------------
 * Mobile tweaks
 * ------------------------------------------------------------------------- */

@media (max-width: 600px) {
    .estanar-ma-page .estanar-ma-hub__grid {
        gap: 1.25rem;
    }

    .estanar-ma-page .estanar-ma-hub__card {
        padding: 1.5rem 1.25rem;
    }

    .estanar-ma-page .estanar-ma-cta {
        flex-direction: column;
        align-items: flex-start;
        text-align: start;
    }
}
