/* ==========================================================
   Lessons page (/classes) — "الدروس" redesign.
   Wears the unified purple wallpaper; hero + cards + CTA use the
   deep-purple glass identity. Palette locked to the site's four font
   colours (#ffffff / #f5d8ff / #6a0d7a / #c13fd8) + gold accent #f1c87a.
   Arabic/RTL is the design baseline — logical properties mirror LTR.
   ========================================================== */

.lessons-page {
    position: relative;
    z-index: 1;
    --lp-deep: #4a0f66;
    --lp-purple: #6a0d7a;
    --lp-magenta: #c13fd8;
    --lp-pink: #f5d8ff;
    --lp-gold: #f1c87a;
    --lp-card-a: #2a1140;
    --lp-card-b: #170a28;
}

/* ============================ HERO ============================ */
.lessons-hero {
    position: relative;
    margin-block-end: 40px;
    padding-block: clamp(32px, 6vw, 96px);
    background: radial-gradient(120% 140% at 85% 10%, #7a2b96 0%, var(--lp-purple) 38%, var(--lp-deep) 78%, #350a4e 100%);
    border-end-start-radius: 40px;
    border-end-end-radius: 40px;
    overflow: hidden;
}
.lessons-hero::before {
    /* soft music-staff glow bottom-start */
    content: "";
    position: absolute;
    inset-block-end: -40%;
    inset-inline-start: -10%;
    width: 60%;
    height: 100%;
    background: radial-gradient(circle, rgba(241, 200, 122, 0.10) 0%, transparent 60%);
    pointer-events: none;
}
.lessons-hero__inner {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
}

.lessons-hero__text {
    flex: 1 1 42%;
    max-width: 520px;
}
.lessons-hero__eyebrow {
    display: inline-block;
    font-size: 22px;
    font-weight: 700;
    color: #ffffff;
    opacity: 0.9;
    margin-block-end: 6px;
}
.lessons-hero__title {
    font-size: clamp(34px, 4.5vw, 60px);
    font-weight: 800;
    line-height: 1.15;
    color: var(--lp-pink);
    margin: 0 0 18px;
    text-shadow: 0 6px 26px rgba(0, 0, 0, 0.28);
}
.lessons-hero__sub {
    font-size: clamp(15px, 1.4vw, 18px);
    line-height: 1.9;
    color: rgba(255, 255, 255, 0.86);
    margin: 0 0 28px;
}
.lessons-hero__cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 34px;
    border-radius: 16px;
    background: #ffffff;
    color: var(--lp-purple);
    font-size: 17px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.lessons-hero__cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.3);
    color: var(--lp-magenta);
}
.lessons-hero__cta .icons { color: currentColor; }

/* --- fanned hero cards --- */
.lessons-hero__cards {
    position: relative;
    flex: 1 1 46%;
    min-height: 430px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lessons-hero__card {
    position: absolute;
    width: 280px;
    padding: 20px 20px 16px;
    border-radius: 26px;
    background: linear-gradient(180deg, var(--lp-card-a) 0%, var(--lp-card-b) 100%);
    border: 1px solid rgba(193, 63, 216, 0.30);
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.38);
    text-decoration: none;
    color: #ffffff;
    transition: transform 0.22s ease;
}
.lessons-hero__card.is-front {
    z-index: 3;
    transform: translateY(-8px) scale(1.04);
    border-color: rgba(245, 216, 255, 0.5);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.46);
}
.lessons-hero__card.is-back-a {
    z-index: 2;
    transform: translate(64%, 18px) rotate(8deg) scale(0.86);
    opacity: 0.95;
}
.lessons-hero__card.is-back-b {
    z-index: 1;
    transform: translate(-64%, 18px) rotate(-8deg) scale(0.86);
    opacity: 0.95;
}
.lessons-hero__card-badge {
    position: absolute;
    inset-block-start: -12px;
    inset-inline-start: 20px;
    background: linear-gradient(135deg, var(--lp-magenta), var(--lp-purple));
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 999px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
}
.lessons-hero__card-title {
    font-size: 20px;
    font-weight: 800;
    color: #ffffff;
    text-align: center;
    margin: 6px 0 4px;
}
.lessons-hero__card-sub {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.62);
    text-align: center;
    margin-block-end: 12px;
}
.lessons-hero__card-img {
    height: 170px;
    border-radius: 18px;
    overflow: hidden;
    background: radial-gradient(circle at 50% 20%, rgba(193, 63, 216, 0.28), transparent 70%);
    display: flex;
    align-items: center;
    justify-content: center;
}
.lessons-hero__card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.lessons-hero__card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-block-start: 14px;
}
.lessons-hero__card-price,
.lessons-hero__card-price * {
    font-size: 20px;
    font-weight: 800;
    color: #ffffff !important;
}
.lessons-hero__card-cart {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--lp-magenta), var(--lp-purple));
    color: #ffffff;
}
.lessons-hero__card-cart .icons { color: #ffffff; }

/* ===================== TOOLBAR ===================== */
.lessons-toolbar {
    position: relative;
    z-index: 30; /* lift the whole toolbar (its sort dropdown) above the grid */
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    padding: 14px 18px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(193, 63, 216, 0.18);
    box-shadow: 0 12px 30px rgba(106, 13, 122, 0.10);
    margin-block-end: 28px;
}
.lessons-toolbar__controls {
    display: flex;
    align-items: center;
    gap: 14px;
}
.lessons-toolbar__views {
    display: inline-flex;
    gap: 6px;
    background: rgba(106, 13, 122, 0.06);
    padding: 5px;
    border-radius: 12px;
}
.lessons-toolbar__views input { position: absolute; opacity: 0; pointer-events: none; }
.lessons-toolbar__views label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 9px;
    cursor: pointer;
    color: var(--lp-purple);
    margin: 0;
    transition: background 0.15s ease, color 0.15s ease;
}
.lessons-toolbar__views input:checked + label {
    background: var(--lp-purple);
    color: #ffffff;
}
.lessons-toolbar__views .icons { color: currentColor; }

.lessons-toolbar__sort { min-width: 190px; position: relative; }
.lessons-toolbar__sort .form-control,
.lessons-toolbar__sort .select2-selection {
    border-radius: 12px !important;
    border: 1px solid rgba(106, 13, 122, 0.2) !important;
    color: var(--lp-purple) !important;
    font-weight: 700;
}
.lessons-toolbar__sort .select2-selection__arrow b { border-color: var(--lp-purple) transparent transparent transparent !important; }

/* select2 dropdown — appended into .lessons-toolbar__sort (see the
   select's data-dropdown-parent) so all of this stays scoped to the
   lessons toolbar and can't leak to other select2 widgets. */
.lessons-toolbar__sort .select2-container { z-index: 60; }
.lessons-toolbar__sort .select2-dropdown {
    background: #ffffff !important;
    border: 1px solid rgba(193, 63, 216, 0.32) !important;
    border-radius: 14px !important;
    overflow: hidden;
    box-shadow: 0 16px 38px rgba(106, 13, 122, 0.24) !important;
}
.lessons-toolbar__sort .select2-results__option {
    color: var(--lp-purple);
    font-weight: 600;
}
.lessons-toolbar__sort .select2-results__option[aria-selected="true"] {
    background: rgba(193, 63, 216, 0.12) !important;
    color: var(--lp-purple) !important;
    font-weight: 700;
}
.lessons-toolbar__sort .select2-results__option--highlighted[aria-selected],
.lessons-toolbar__sort .select2-results__option--highlighted {
    background: linear-gradient(135deg, var(--lp-magenta), var(--lp-purple)) !important;
    color: #ffffff !important;
}
/* Themed scrollbar for the options list */
.lessons-toolbar__sort .select2-results__options {
    scrollbar-width: thin;
    scrollbar-color: var(--lp-magenta) var(--lp-pink);
}
.lessons-toolbar__sort .select2-results__options::-webkit-scrollbar { width: 8px; }
.lessons-toolbar__sort .select2-results__options::-webkit-scrollbar-track {
    background: var(--lp-pink);
    border-radius: 8px;
}
.lessons-toolbar__sort .select2-results__options::-webkit-scrollbar-thumb {
    background: var(--lp-magenta);
    border-radius: 8px;
}

.lessons-toolbar__pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.lessons-pill__input { position: absolute; opacity: 0; pointer-events: none; }
.lessons-pill {
    display: inline-flex;
    align-items: center;
    padding: 9px 20px;
    border-radius: 999px;
    border: 1px solid rgba(106, 13, 122, 0.25);
    color: var(--lp-purple);
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin: 0;
    transition: all 0.15s ease;
}
.lessons-pill:hover { border-color: var(--lp-magenta); color: var(--lp-magenta); }
.lessons-pill__input:checked + .lessons-pill {
    background: linear-gradient(135deg, var(--lp-magenta), var(--lp-purple));
    border-color: transparent;
    color: #ffffff;
}

/* ===================== GRID + CARDS ===================== */
.lessons-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 22px;
    margin: 0;
}
.lessons-grid.is-list { grid-template-columns: 1fr; }

.lesson-card {
    display: flex;
    flex-direction: column;
    border-radius: 22px;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid rgba(193, 63, 216, 0.14);
    box-shadow: 0 14px 32px rgba(106, 13, 122, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.lesson-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 22px 44px rgba(106, 13, 122, 0.22);
}
.lesson-card__media {
    position: relative;
    display: block;
    height: 150px;
    background: linear-gradient(180deg, var(--lp-card-a) 0%, var(--lp-card-b) 100%);
    overflow: hidden;
}
.lesson-card__media::after {
    /* subtle mihrab arch glow */
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 120%, rgba(193, 63, 216, 0.35), transparent 60%);
    pointer-events: none;
}
.lesson-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: relative;
    z-index: 1;
}
.lesson-card__badge {
    position: absolute;
    z-index: 2;
    inset-block-start: 12px;
    inset-inline-start: 12px;
    font-size: 12px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 999px;
    color: #ffffff;
}
.lesson-card__badge.is-new { background: #3fae6a; }
.lesson-card__badge.is-best { background: linear-gradient(135deg, var(--lp-magenta), var(--lp-purple)); }

.lesson-card__body {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 16px 14px 8px;
    flex: 1 1 auto;
}
.lesson-card__title {
    font-size: 16px;
    font-weight: 800;
    color: var(--lp-purple);
    margin: 0 0 4px;
    line-height: 1.4;
}
.lesson-card__sub {
    font-size: 13px;
    color: var(--lp-magenta);
    margin-block-end: 10px;
}
.lesson-card__stars { display: inline-flex; gap: 3px; }
.lesson-card__stars .is-on { color: var(--lp-gold); }
.lesson-card__stars .is-off { color: rgba(106, 13, 122, 0.18); }

.lesson-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 14px;
    margin-block-start: auto;
    background: var(--lp-pink);
    border-block-start: 1px solid rgba(193, 63, 216, 0.16);
}
.lesson-card__price,
.lesson-card__price * {
    font-size: 18px;
    font-weight: 800;
    color: var(--lp-purple) !important;
}
.lesson-card__cart {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--lp-purple), var(--lp-magenta));
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: filter 0.15s ease;
}
.lesson-card__cart:hover { filter: brightness(1.08); color: #ffffff; }
.lesson-card__cart .icons { color: #ffffff; }

.lessons-grid__empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #ffffff;
}
.lessons-grid__empty .icons { color: var(--lp-pink); }
.lessons-grid__empty h3 { color: #ffffff; margin-block-start: 12px; }
.lessons-grid__empty p { color: rgba(255, 255, 255, 0.7); }

/* ===================== PAGINATION ===================== */
.lessons-pagination { margin-block-start: 40px; display: flex; justify-content: center; }

/* ===================== CATEGORY SEO ===================== */
.lessons-seo {
    margin-block-start: 40px;
    padding: 24px 28px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(193, 63, 216, 0.16);
}
.lessons-seo h3 { color: var(--lp-purple); font-weight: 800; margin: 0 0 10px; }
.lessons-seo div { color: #5a3b6b; line-height: 1.9; }

/* ===================== CURRICULUM CTA ===================== */
.lessons-cta {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-block-start: 56px;
    padding: clamp(28px, 4vw, 52px);
    border-radius: 32px;
    overflow: hidden;
    background: radial-gradient(120% 160% at 15% 15%, #7a2b96 0%, var(--lp-purple) 45%, var(--lp-deep) 85%);
    box-shadow: 0 24px 50px rgba(106, 13, 122, 0.28);
}
.lessons-cta__text { flex: 1 1 60%; max-width: 640px; position: relative; z-index: 2; }
.lessons-cta__title {
    font-size: clamp(24px, 3vw, 38px);
    font-weight: 800;
    color: #ffffff;
    margin: 0 0 14px;
}
.lessons-cta__sub {
    font-size: clamp(14px, 1.3vw, 17px);
    line-height: 1.9;
    color: rgba(255, 255, 255, 0.86);
    margin: 0 0 24px;
}
.lessons-cta__btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 30px;
    border-radius: 14px;
    background: var(--lp-pink);
    color: var(--lp-purple);
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.18s ease;
}
.lessons-cta__btn:hover { transform: translateY(-2px); color: var(--lp-magenta); }
.lessons-cta__btn .icons { color: currentColor; }
.lessons-cta__figure {
    flex: 0 0 auto;
    align-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}
.lessons-cta__figure img { max-height: 260px; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 1200px) {
    .lessons-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 991px) {
    .lessons-grid { grid-template-columns: repeat(3, 1fr); }
    .lessons-hero__inner { flex-direction: column; text-align: center; }
    .lessons-hero__text { max-width: none; }
    .lessons-hero__cards { width: 100%; }
}
@media (max-width: 640px) {
    .lessons-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
    .lessons-cta { flex-direction: column; text-align: center; }
    .lessons-cta__figure { display: none; }
    .lessons-toolbar__pills { margin-inline-start: 0; }
}
@media (max-width: 420px) {
    .lessons-grid { grid-template-columns: 1fr; }
}
