/*
 * Group programs as "cohort tickets" (plan E10).
 * .mpc-* = the card (components/mentorship/program-card.blade.php), used on
 *          /mentorship/groups, the "Starting soon" strips and mentor profiles.
 * .mpd-* = the /mentorship/groups directory (mentorship/groups/index.blade.php).
 * .mps-* = a one-row strip of up to three cards.
 * Direction: the program page's expedition palette, shrunk to a ticket , the
 * outcome on top, a perforated tear, then the stub a student decides on.
 * Type: 12 · 13 · 15 · 17 · 22.
 */
.mpc, .mpd, .mps {
    --mpc-navy: #1c1c6e;
    --mpc-brand: #4242d6;
    --mpc-brand-strong: #3634b8;
    --mpc-tint: #ecebff;
    --mpc-wash: #f5f4ff;
    --mpc-body: #403d59;
    --mpc-muted: #6e6a85;
    --mpc-line: #e7e5f2;
    --mpc-canvas: #f6f5fb;
    --mpc-gold: #efc15a;
    --mpc-ok: #2c7a51;
    --mpc-ok-tint: #e7f5ed;
    --mpc-warn: #b45309;
    --mpc-warn-tint: #fff7e6;
    --mpc-shadow: 0 10px 30px -18px rgba(28, 28, 110, .28);
}

/* ---- The ticket ---- */
.mpc { position: relative; min-width: 0; height: 100%; }
.mpc__link {
    display: flex; flex-direction: column; height: 100%;
    background: #fff; border: 1px solid var(--mpc-line); border-radius: 16px;
    color: var(--mpc-body); text-decoration: none; box-shadow: var(--mpc-shadow);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.mpc__link:hover { transform: translateY(-2px); border-color: #d6d3f0; box-shadow: 0 18px 36px -20px rgba(28, 28, 110, .38); color: var(--mpc-body); }
.mpc__link:focus-visible { outline: 2px solid var(--mpc-brand); outline-offset: 3px; }

.mpc__top { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 20px 20px 16px; flex: 1 1 auto; }
.mpc__crest { position: absolute; inset-block-start: 16px; inset-inline-end: 16px; line-height: 1; }
.mpc__kicker {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0; padding-inline-end: 56px;
    font-size: 12px; font-weight: 700; color: var(--mpc-brand); letter-spacing: .02em;
}
.mpc__kicker span { white-space: nowrap; }
.mpc__kicker span + span { color: var(--mpc-muted); font-weight: 600; }
.mpc__kicker span + span::before { content: '·'; margin-inline-end: 8px; color: var(--mpc-line); }
.mpc__title {
    margin: 0; padding-inline-end: 56px; font-size: 17px; font-weight: 800; line-height: 1.3; color: var(--mpc-navy);
    text-wrap: balance; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.mpc__mentor { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 8px; font-size: 13px; font-weight: 600; color: var(--mpc-muted); }
.mpc__mentor img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: none; }
.mpc__mentor span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Perforation: a dashed rule with a notch cut into each edge. */
.mpc__tear { position: relative; height: 0; margin: 0 16px; border-top: 2px dashed var(--mpc-line); }
.mpc__tear::before, .mpc__tear::after {
    content: ''; position: absolute; top: -10px; width: 18px; height: 18px; border-radius: 50%;
    background: var(--mpc-canvas); border: 1px solid var(--mpc-line);
}
.mpc__tear::before { inset-inline-start: -26px; clip-path: inset(0 0 0 50%); }
.mpc__tear::after { inset-inline-end: -26px; clip-path: inset(0 50% 0 0); }
[dir="rtl"] .mpc__tear::before { clip-path: inset(0 50% 0 0); }
[dir="rtl"] .mpc__tear::after { clip-path: inset(0 0 0 50%); }

.mpc__stub { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 16px 20px 8px; }
.mpc__when { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mpc__label { font-size: 12px; font-weight: 700; color: var(--mpc-muted); }
.mpc__date { font-size: 22px; font-weight: 800; line-height: 1.15; color: var(--mpc-navy); }
.mpc__slot { font-size: 13px; font-weight: 600; color: var(--mpc-body); }
.mpc__more { color: var(--mpc-brand); font-weight: 700; }
.mpc__zone { display: block; color: var(--mpc-muted); font-weight: 500; }
.mpc__price { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: end; flex: none; }
.mpc__amount { font-size: 22px; font-weight: 800; line-height: 1.15; color: var(--mpc-navy); }
.mpc__amount.is-free { color: var(--mpc-ok); }
.mpc__per { font-size: 12px; font-weight: 600; color: var(--mpc-muted); }

.mpc__seats {
    display: flex; align-items: center; gap: 8px; margin: 0; padding: 12px 20px 16px;
    font-size: 13px; font-weight: 700; color: var(--mpc-ok);
}
.mpc__seats > i { font-size: 16px; line-height: 1; }
.mpc.is-full .mpc__seats { color: var(--mpc-warn); }
.mpc__pulse { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--mpc-ok); flex: none; }
.mpc__pulse::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: inherit; animation: mpc-ping 1.8s ease-out infinite; }
@keyframes mpc-ping { from { transform: scale(1); opacity: .5; } to { transform: scale(2.6); opacity: 0; } }
.mpc__go { display: inline-flex; align-items: center; gap: 6px; margin-inline-start: auto; color: var(--mpc-brand); white-space: nowrap; }
.mpc__go i { font-size: 14px; line-height: 1; transition: transform .15s ease; }
.mpc__link:hover .mpc__go i { transform: translateX(3px); }
[dir="rtl"] .mpc__link:hover .mpc__go i { transform: translateX(-3px); }

/* ---- Directory ---- */
.mpd { padding: 32px 0 80px; background: var(--mpc-canvas); }
.mpd-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mpd-filter { display: flex; flex-direction: column; gap: 4px; margin: 0; min-width: 0; }
.mpd-filter > span { font-size: 12px; font-weight: 700; color: var(--mpc-muted); }
.mpd-filter select {
    width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--mpc-line); border-radius: 12px;
    background-color: #fff; color: var(--mpc-navy); font-size: 15px; font-weight: 600; cursor: pointer;
}
.mpd-filter select:focus-visible { outline: 2px solid var(--mpc-brand); outline-offset: 2px; }
.mpd-filter select {
    -webkit-appearance: none; appearance: none; padding-inline-end: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 256 256'%3E%3Cpath fill='%236e6a85' d='M213.66 101.66l-80 80a8 8 0 0 1-11.32 0l-80-80a8 8 0 0 1 11.32-11.32L128 164.69l74.34-74.35a8 8 0 0 1 11.32 11.32Z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center; background-size: 16px;
    transition: border-color .15s ease, background-color .15s ease;
}
[dir="rtl"] .mpd-filter select { background-position: left 14px center; }
.mpd-filter select:hover { border-color: var(--mpc-brand); }
.mpd-filter select.is-set { border-color: var(--mpc-brand); background-color: var(--mpc-tint, #ecebff); box-shadow: inset 0 0 0 1px var(--mpc-brand); }
.mpd-apply, .mpd-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px;
    border: 0; border-radius: 999px; background: var(--mpc-brand); color: #fff; font-size: 15px; font-weight: 700; text-decoration: none;
}
.mpd-btn:hover, .mpd-apply:hover { background: var(--mpc-brand-strong); color: #fff; }
.mpd-btn i { font-size: 16px; line-height: 1; }

.mpd-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 24px 0 16px; }
.mpd-count { margin: 0; font-size: 15px; font-weight: 700; color: var(--mpc-navy); }
.mpd-clear { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--mpc-brand); text-decoration: none; }
.mpd-clear i { font-size: 14px; line-height: 1; }
.mpd-clear:hover { text-decoration: underline; }

.mpd-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.mpd-pages { margin-top: 32px; }

.mpd-empty {
    display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 480px; margin: 24px auto 0; padding: 40px 24px;
    background: #fff; border: 1px solid var(--mpc-line); border-radius: 16px; text-align: center;
}
.mpd-empty__icon { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 8px; border-radius: 50%; background: var(--mpc-tint); color: var(--mpc-brand); font-size: 32px; line-height: 1; }
.mpd-empty h2 { margin: 0; font-size: 17px; font-weight: 800; color: var(--mpc-navy); }
.mpd-empty p { margin: 0 0 8px; font-size: 15px; color: var(--mpc-body); text-wrap: pretty; }

/* ---- Strip (one row, the query caps it at three) ---- */
.mps { padding: 40px 0; }
.mps__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.mps__title { margin: 0; font-size: 22px; font-weight: 800; color: var(--mpc-navy); }
.mps__lead { margin: 4px 0 0; font-size: 15px; color: var(--mpc-muted); }
.mps__all { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 700; color: var(--mpc-brand); text-decoration: none; white-space: nowrap; }
.mps__all i { font-size: 14px; line-height: 1; }
.mps__all:hover { text-decoration: underline; }
.mps__row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }

@media (min-width: 640px) {
    .mpd-grid, .mps__row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 768px) {
    .mpd-filters { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
    .mpd-grid, .mps__row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* Two columns for a strip of two: no ghost third column. */
@media (min-width: 1024px) {
    .mps__row:has(> :nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .mps__row:has(> :only-child) { grid-template-columns: minmax(0, 1fr); max-width: 520px; }
}
/* Phones: a strip keeps the cards side by side in a swipe row rather than a tall stack. */
@media (max-width: 639px) {
    .mps__row { grid-auto-flow: column; grid-auto-columns: 86%; grid-template-columns: none; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; }
    .mps__row > * { scroll-snap-align: start; }
}
@media (prefers-reduced-motion: reduce) {
    .mpc__pulse::after { animation: none; }
    .mpc__link, .mpc__go i { transition: none; }
}

/* A mentor's profile: inside the sessions tab, at most two, two columns. */
.mps--profile { padding: 32px 0 0; }
.mps--profile .mps__title { font-size: 17px; }
@media (min-width: 1024px) {
    .mps--profile .mps__row, .mps--profile .mps__row:has(> :nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: none; }
}

/* Homepage: inside the mentorship section, no extra band padding. */
.mps--home { padding: 0 0 64px; text-align: start; }

/* "Prefer a group?" link under a 1:1 session's booking card (.mpx). */
.mpx {
    --mpx-brand: #4242d6; --mpx-ink: #1c1c6e; --mpx-muted: #6e6a85; --mpx-line: #e4e2ee; --mpx-tint: #ecebff;
    display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 12px 16px;
    background: #fff; border: 1px dashed var(--mpx-line); border-radius: 16px; text-decoration: none;
    transition: border-color .15s ease, background-color .15s ease;
}
.mpx:hover { border-color: var(--mpx-brand); background: #f6f5ff; }
.mpx:focus-visible { outline: 2px solid var(--mpx-brand); outline-offset: 3px; }
.mpx__icon { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--mpx-tint); color: var(--mpx-brand); font-size: 20px; line-height: 1; }
.mpx__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.mpx__title { font-size: 12px; font-weight: 700; color: var(--mpx-brand); }
.mpx__name { font-size: 15px; font-weight: 700; line-height: 1.3; color: var(--mpx-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mpx__meta { font-size: 13px; font-weight: 600; color: var(--mpx-muted); }
.mpx__go { flex: none; font-size: 16px; line-height: 1; color: var(--mpx-brand); }
.mpx__date { white-space: nowrap; }

/* Phones: the strip's heading, lead and "All" link stack instead of squeezing side by side. */
@media (max-width: 639px) {
    .mps__head { flex-direction: column; align-items: flex-start; gap: 8px; }
    .mps__title { font-size: 20px; }
}

/* Arabic pages: an empty field starts on the right, placeholder included.
   dir="auto" alone resolves an empty field to LTR; once text is typed it
   follows the text again. Fields marked dir="ltr" (URLs, English) stay left. */
[dir='rtl'] :is(input, textarea):not([dir='ltr']):placeholder-shown { direction: rtl; text-align: right; }
[dir='rtl'] :is(input, textarea):not([dir='ltr'])::placeholder { direction: rtl; text-align: right; }
