/* ============================================================
   curriculum_waitlist — Section 4 of the Structured Learning
   landing. Visual reference: Section 4.png + Section 4_1.png.
   Two-column layout: form (right in RTL / left in LTR) on one
   side, countdown + counter cards on the other side.
   Palette + wallpaper accents match the rest of the curriculum
   landing. Light / Dark / wallpaper / RTL aware.
   ============================================================ */

.curriculum-waitlist-section {
    position: relative;
    overflow: hidden;
    padding: 32px 0;
}

/* ============================================================
   Top-level layout — form column + metrics column side-by-side.
   The form column is FIRST in DOM so flex-direction:row puts it
   on the start side: right in RTL (Arabic), left in LTR.
   ============================================================ */
.curriculum-waitlist-section__layout {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: clamp(20px, 3vw, 36px);
    width: 100%;
}
.curriculum-waitlist-section__form-col {
    flex: 1 1 60%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.curriculum-waitlist-section__metrics-col {
    flex: 0 0 38%;
    max-width: 38%;
    display: flex;
    flex-direction: column;
    justify-content: center;       /* keep the two cards vertically centered
                                       inside the column — top gap matches the
                                       bottom gap relative to the form col */
    gap: 16px;
}

/* ============================================================
   Shared card surface — lavender + primary border, matches the
   rest of the landing (about_instructor / curriculum_pricing).
   ============================================================ */
.cw-card {
    width: 100%;
    padding: 28px 24px;
    border: 1.5px solid var(--primary);
    border-radius: 24px;
    background: #fbdefcf8;
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    box-shadow: 0 16px 36px rgba(62, 0, 95, 0.10);
    transition: box-shadow .25s ease;
}
body.dark-mode .cw-card {
    background: rgba(31, 15, 51, 0.55);
    border-color: rgba(180, 143, 255, 0.65);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.30);
}

/* ============================================================
   Form column — heading + waitlist form
   ============================================================ */
.cw-card__heading {
    margin: 0 0 8px;
    text-align: center;
    font-weight: 800;
    font-size: clamp(1.3rem, 2vw, 1.8rem);
    line-height: 1.25;
    color: var(--dark);
}
.cw-card__subheading {
    margin: 0 0 20px;
    text-align: center;
    font-size: clamp(0.88rem, 0.95vw, 1rem);
    line-height: 1.6;
    color: var(--gray-500);
}
body.dark-mode .cw-card__heading { color: #ffffff; }
body.dark-mode .cw-card__subheading { color: var(--gray-400); }
body.home-wallpaper-active:not(.dark-mode) .cw-card__heading { color: #6a0d7a; }
body.home-wallpaper-active:not(.dark-mode) .cw-card__subheading { color: #8a3d96; }

/* ============================================================
   Form fields
   ============================================================ */
.cw-field {
    margin: 0 0 12px;
}
.cw-field__input {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.95rem;
    line-height: 1.4;
    color: var(--dark);
    background: rgba(255, 255, 255, 0.95);
    border: 1.5px solid rgba(62, 0, 95, 0.18);
    border-radius: 12px;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.cw-field__input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(62, 0, 95, 0.12);
}
body.dark-mode .cw-field__input {
    background: rgba(15, 5, 30, 0.55);
    color: #ffffff;
    border-color: rgba(180, 143, 255, 0.35);
}

.cw-field--inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    padding: 10px 4px;
}
.cw-field__label {
    flex: 1 1 auto;
    font-size: 0.92rem;
    color: var(--gray-500);
}
body.dark-mode .cw-field__label { color: var(--gray-400); }

.cw-radio {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.92rem;
    color: var(--dark);
}
.cw-radio input { accent-color: var(--primary); }
body.dark-mode .cw-radio { color: #ffffff; }
body.home-wallpaper-active:not(.dark-mode) .cw-radio { color: #6a0d7a; }

/* ============================================================
   Side-by-side mini cards — "Has clarinet?" + Level dropdown
   ============================================================ */
.cw-mini-row {
    display: flex;
    gap: 10px;
    margin: 0 0 12px;
}
.cw-mini {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.85);
    border: 1.5px solid rgba(62, 0, 95, 0.18);
    border-radius: 12px;
}
body.dark-mode .cw-mini {
    background: rgba(15, 5, 30, 0.55);
    border-color: rgba(180, 143, 255, 0.35);
}
.cw-mini__label {
    font-size: 0.85rem;
    color: var(--gray-500);
}
body.dark-mode .cw-mini__label { color: var(--gray-400); }
body.home-wallpaper-active:not(.dark-mode) .cw-mini__label { color: #8a3d96; }

.cw-mini__choices {
    display: flex;
    gap: 14px;
}

/* ============================================================
   Custom <select> replacement — used by the Level field. The
   native open-list can't be styled to match the site, so we use
   a div-based dropdown wired up by the front-blade JS. A hidden
   <input name="level"> serializes the value into the form.
   ============================================================ */
.cw-select { position: relative; }
.cw-select__trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 6px;
    background: transparent;
    border: 0;
    color: var(--gray-500);
    font-size: 0.95rem;
    line-height: 1.4;
    cursor: pointer;
    text-align: start;
    font-family: inherit;
}
.cw-select.is-filled .cw-select__trigger { color: var(--dark); }
body.dark-mode .cw-select__trigger { color: var(--gray-400); }
body.dark-mode .cw-select.is-filled .cw-select__trigger { color: #ffffff; }
body.home-wallpaper-active:not(.dark-mode) .cw-select__trigger { color: #8a3d96; }
body.home-wallpaper-active:not(.dark-mode) .cw-select.is-filled .cw-select__trigger { color: #6a0d7a; }

.cw-select__chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    transition: transform .2s ease;
    flex-shrink: 0;
}
.cw-select.is-open .cw-select__chevron { transform: rotate(180deg); }
body.dark-mode .cw-select__chevron { color: #ffffff; }
body.home-wallpaper-active:not(.dark-mode) .cw-select__chevron { color: #6a0d7a; }

.cw-select__list {
    position: absolute;
    top: calc(100% + 8px);
    inset-inline-start: 0;
    inset-inline-end: 0;
    z-index: 10;
    list-style: none;
    padding: 6px;
    margin: 0;
    background: #ffffff;
    border: 1.5px solid var(--primary);
    border-radius: 12px;
    box-shadow: 0 16px 32px rgba(62, 0, 95, 0.18);
    animation: cw-select-pop .15s ease-out both;
}
.cw-select__option {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.92rem;
    color: var(--dark);
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.cw-select__option:hover,
.cw-select__option:focus,
.cw-select__option.is-selected {
    background: rgba(62, 0, 95, 0.10);
    color: var(--primary);
    font-weight: 700;
}
body.dark-mode .cw-select__list {
    background: #1f0f33;
    border-color: rgba(180, 143, 255, 0.55);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.45);
}
body.dark-mode .cw-select__option { color: #ffffff; }
body.dark-mode .cw-select__option:hover,
body.dark-mode .cw-select__option:focus,
body.dark-mode .cw-select__option.is-selected {
    background: rgba(180, 143, 255, 0.18);
    color: #ffffff;
}
body.home-wallpaper-active:not(.dark-mode) .cw-select__option { color: #6a0d7a; }

@keyframes cw-select-pop {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0);    }
}

/* Native <select> styled to match the rest of the form fields —
   we strip the OS chrome with appearance:none and paint a custom
   chevron via an inline SVG background so the control looks
   intentional on every browser. */
.cw-mini__select {
    width: 100%;
    padding: 8px 30px 8px 6px;        /* extra space on one side for the chevron */
    font-size: 0.95rem;
    line-height: 1.4;
    color: var(--dark);
    background-color: transparent;
    background-repeat: no-repeat;
    background-position: left 8px center;
    background-size: 14px 14px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%233e005f' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    border: 0;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    font-family: inherit;
}
/* In RTL the chevron belongs on the left visual side (where the
   row START is), and the text padding flips so options breathe. */
body.rtl .cw-mini__select {
    padding: 8px 6px 8px 30px;
    background-position: left 8px center;
}
.cw-mini__select:focus {
    color: var(--primary);
}
.cw-mini__select option {
    color: var(--dark);
    background: #ffffff;
    padding: 8px 12px;
}
body.dark-mode .cw-mini__select {
    color: #ffffff;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
}
body.dark-mode .cw-mini__select option {
    background: #1f0f33;
    color: #ffffff;
}
body.home-wallpaper-active:not(.dark-mode) .cw-mini__select {
    color: #6a0d7a;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236a0d7a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
}

/* ============================================================
   Submit button — primary pill, full-width inside the card
   ============================================================ */
.cw-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 26px;
    margin-top: 8px;
    border: 0;
    border-radius: 12px;
    background: var(--primary);
    color: var(--primary-btn-color);
    font-weight: 700;
    font-size: 0.98rem;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(62, 0, 95, 0.25);
    transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease;
}
.cw-submit:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(255, 107, 157, 0.30);
}
.cw-submit:disabled { opacity: 0.55; cursor: wait; }

/* ============================================================
   PDF panel — INSIDE the waitlist card. Multi-line description
   + a clickable file frame (icon + filename + download glyph).
   ============================================================ */
.cw-pdf {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px dashed rgba(62, 0, 95, 0.18);
    display: flex;
    flex-direction: column;
    gap: 12px;
}
body.dark-mode .cw-pdf { border-top-color: rgba(180, 143, 255, 0.30); }

.cw-pdf__description {
    margin: 0;
    text-align: center;
    font-size: clamp(0.85rem, 0.95vw, 0.95rem);
    line-height: 1.7;
    color: var(--gray-500);
}
body.dark-mode .cw-pdf__description { color: var(--gray-400); }
/* Matches the metric-title dark color on the light wallpaper so
   the panel reads on the lavender card surface. */
body.home-wallpaper-active:not(.dark-mode) .cw-pdf__description { color: #6a0d7a; }

/* Clickable file frame — icon + filename + download chevron */
.cw-pdf__frame {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    background: rgba(62, 0, 95, 0.08);
    border: 1.5px solid rgba(62, 0, 95, 0.18);
    color: var(--primary);
    text-decoration: none;
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.cw-pdf__frame:hover {
    background: var(--primary);
    color: var(--primary-btn-color);
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(62, 0, 95, 0.25);
}
.cw-pdf__frame-icon,
.cw-pdf__frame-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.cw-pdf__frame-name {
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;          /* file-name centered between the two icons */
    font-weight: 700;
    font-size: 0.92rem;
    line-height: 1.3;
    word-break: break-word;
}
body.dark-mode .cw-pdf__frame {
    background: rgba(180, 143, 255, 0.10);
    color: #ffffff;
    border-color: rgba(180, 143, 255, 0.45);
}
body.home-wallpaper-active:not(.dark-mode) .cw-pdf__frame {
    background: rgba(62, 0, 95, 0.08);
    border-color: rgba(62, 0, 95, 0.18);
    color: #6a0d7a;
}

/* ============================================================
   Form messages — under each form. Success now shows in a modal
   (below) instead of inline, so this element is only used for
   the error state.
   ============================================================ */
.cw-form-message {
    margin: 12px 0 0;
    min-height: 1.5em;
    text-align: center;
    font-size: 0.88rem;
    line-height: 1.45;
}
.cw-form-message.is-error   { color: #b73838; }
body.home-wallpaper-active:not(.dark-mode) .cw-form-message.is-error   { color: #ffcfcf; }

/* ============================================================
   Success modal — overlay + centered card with a purple-tinted
   check, the success message, and a close button. Auto-dismisses
   after 5s; can be closed via the X button or by clicking the
   overlay. Palette-matched (no green).
   ============================================================ */
.cw-success-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.cw-success-modal.is-visible {
    display: flex;
    animation: cw-modal-fade-in 0.2s ease-out both;
}
.cw-success-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(20, 0, 40, 0.65);
    cursor: pointer;
}
.cw-success-modal__card {
    position: relative;
    width: 100%;
    max-width: 380px;
    padding: 36px 28px 28px;
    text-align: center;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 24px 64px rgba(20, 0, 40, 0.35);
    animation: cw-modal-pop 0.25s ease-out both;
}
.cw-success-modal__close {
    position: absolute;
    top: 12px;
    inset-inline-end: 12px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    border-radius: 50%;
    color: var(--gray-500);
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.cw-success-modal__close:hover {
    background: rgba(62, 0, 95, 0.08);
    color: var(--primary);
}
.cw-success-modal__icon {
    width: 64px;
    height: 64px;
    margin: 4px auto 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary);
    color: var(--primary-btn-color);
    box-shadow: 0 12px 28px rgba(62, 0, 95, 0.25);
}
.cw-success-modal__message {
    margin: 0;
    font-weight: 600;
    font-size: clamp(0.95rem, 1.1vw, 1.05rem);
    line-height: 1.6;
    color: var(--dark);
}
body.dark-mode .cw-success-modal__card {
    background: #1f0f33;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}
body.dark-mode .cw-success-modal__close {
    color: var(--gray-400);
}
body.dark-mode .cw-success-modal__close:hover {
    background: rgba(180, 143, 255, 0.18);
    color: #ffffff;
}
body.dark-mode .cw-success-modal__message { color: #ffffff; }

@keyframes cw-modal-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes cw-modal-pop {
    from { opacity: 0; transform: translateY(8px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

/* ============================================================
   Metrics column — countdown card on top, counter card below.
   Each card has a small title at the top, then its content.
   ============================================================ */
.cw-card__metric-title {
    margin: 0 0 16px;
    text-align: center;
    font-weight: 700;
    font-size: clamp(0.95rem, 1.05vw, 1.1rem);
    line-height: 1.3;
    color: var(--dark);
}
body.dark-mode .cw-card__metric-title { color: #ffffff; }
/* On the light wallpaper, the card surface stays lavender, so the
   metric title stays dark for readability — the previous white +
   text-shadow combo was unreadable against the light lavender. */
body.home-wallpaper-active:not(.dark-mode) .cw-card__metric-title {
    color: #6a0d7a;
}

/* ---- Countdown hero — big "18 / يوم" stacked on top of the 4 boxes ---- */
.cw-countdown-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom: 18px;
}
.cw-countdown-hero__value {
    font-weight: 800;
    font-size: clamp(2.5rem, 4vw, 3.5rem);
    line-height: 1;
    color: var(--primary);
}
.cw-countdown-hero__label {
    font-size: clamp(0.92rem, 1vw, 1.05rem);
    color: var(--gray-500);
}
body.dark-mode .cw-countdown-hero__value { color: var(--accent); }
body.dark-mode .cw-countdown-hero__label { color: var(--gray-400); }
/* On the light wallpaper the lavender card needs dark text — fall
   back to the default primary / gray for readability. */
body.home-wallpaper-active:not(.dark-mode) .cw-countdown-hero__value {
    color: #6a0d7a;
}
body.home-wallpaper-active:not(.dark-mode) .cw-countdown-hero__label {
    color: #8a3d96;
}

/* ---- 4-box countdown grid — DOM order: days, hours, minutes,
       seconds. In LTR the natural order matches a clock (DD:HH:MM:SS
       reads days→seconds left to right). In RTL we flip the row so
       seconds end up on the right and days on the left, matching
       the design reference (Section 4_1.png). ---- */
.cw-countdown-grid {
    display: flex;
    gap: 8px;
}
.cw-countdown-box { flex: 1 1 0; min-width: 0; }
body.rtl .cw-countdown-grid {
    flex-direction: row-reverse;
}
.cw-countdown-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 4px;
    border-radius: 10px;
    background: rgba(62, 0, 95, 0.08);
    border: 1px solid rgba(62, 0, 95, 0.15);
}
.cw-countdown-box__value {
    font-weight: 800;
    font-size: clamp(1rem, 1.3vw, 1.3rem);
    line-height: 1;
    color: var(--primary);
}
.cw-countdown-box__label {
    margin-top: 4px;
    font-size: clamp(0.65rem, 0.75vw, 0.78rem);
    color: var(--gray-500);
}
body.dark-mode .cw-countdown-box {
    background: rgba(180, 143, 255, 0.10);
    border-color: rgba(180, 143, 255, 0.30);
}
body.dark-mode .cw-countdown-box__value { color: #ffffff; }
body.dark-mode .cw-countdown-box__label { color: var(--gray-400); }
/* On light wallpaper the lavender card stays light, so the boxes
   keep their default tinted-primary background + dark text. */
body.home-wallpaper-active:not(.dark-mode) .cw-countdown-box {
    background: rgba(62, 0, 95, 0.08);
    border-color: rgba(62, 0, 95, 0.18);
}
body.home-wallpaper-active:not(.dark-mode) .cw-countdown-box__value { color: #6a0d7a; }
body.home-wallpaper-active:not(.dark-mode) .cw-countdown-box__label { color: #8a3d96; }

/* Once the launch date passes the countdown card hides entirely
   (set by the JS in the front blade). */
.cw-card--countdown.is-launched { display: none; }

/* ---- Counter card — number, "+", icon stacked horizontally.
       DOM order: value, plus, icon. In RTL (Arabic) the natural
       flex-row direction puts value on the right, plus in the
       middle, icon on the left — matching the design. ---- */
.cw-counter-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
}
.cw-counter-row__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--primary-btn-color);
    box-shadow: 0 8px 18px rgba(62, 0, 95, 0.20);
}
.cw-counter-row__plus {
    font-weight: 800;
    font-size: clamp(1.4rem, 2.4vw, 2rem);
    line-height: 1;
    color: var(--primary);
}
.cw-counter-row__value {
    font-weight: 800;
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    line-height: 1;
    color: var(--primary);
}
body.dark-mode .cw-counter-row__plus { color: var(--accent); }
body.home-wallpaper-active:not(.dark-mode) .cw-counter-row__plus { color: #6a0d7a; }
.cw-counter-subtitle {
    text-align: center;
    font-size: clamp(0.85rem, 0.95vw, 0.98rem);
    color: var(--gray-500);
}
body.dark-mode .cw-counter-row__icon { box-shadow: 0 8px 18px rgba(180, 143, 255, 0.25); }
body.dark-mode .cw-counter-row__value { color: var(--accent); }
body.dark-mode .cw-counter-subtitle { color: var(--gray-400); }
/* On light wallpaper the lavender card stays light — counter
   value and subtitle stay dark for contrast. */
body.home-wallpaper-active:not(.dark-mode) .cw-counter-row__value {
    color: #6a0d7a;
}
body.home-wallpaper-active:not(.dark-mode) .cw-counter-subtitle {
    color: #8a3d96;
}

/* ============================================================
   Responsive — four-breakpoint cascade.
   ============================================================ */
@media (max-width: 1199px) {
    .curriculum-waitlist-section__layout { gap: 20px; }
}

@media (max-width: 991px) {
    /* Collapse the two-column layout — metrics go above the form
       so the visitor sees the "18 days / +120 students" social
       proof before the form. */
    .curriculum-waitlist-section__layout {
        flex-direction: column;
    }
    .curriculum-waitlist-section__metrics-col {
        flex: 0 0 auto;
        max-width: 100%;
        order: -1;             /* push metrics above the form on stack */
        flex-direction: row;
        gap: 16px;
    }
    .curriculum-waitlist-section__metrics-col .cw-card {
        flex: 1 1 0;
        min-width: 0;
    }
}

@media (max-width: 767px) {
    .cw-card { padding: 24px 18px; }
    .curriculum-waitlist-section__metrics-col { flex-direction: column; }
    .curriculum-waitlist-section__metrics-col .cw-card { flex: 0 0 auto; }
}

@media (max-width: 575px) {
    .cw-card__heading { font-size: clamp(1.15rem, 5vw, 1.5rem); }
    .cw-field__input { padding: 11px 14px; }
}
