/**
 * Level catalog page — filters, grid, selection cards
 * Replaces inline styles in level/index.php
 */

.catalog-page-header {
    padding: 28px 0 20px;
    text-align: center;
}

.eman-level-page .lesson-card,
.eman-level-page .lesson-card__media {
    position: relative;
}

.eman-level-page .lesson-card__media {
    overflow: hidden;
}

.catalog-page-header--lessons {
    padding: 14px 0 10px;
}

.catalog-page-header__title {
    margin: 0 0 12px;
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    font-weight: 700;
    color: var(--eman-purple, #6a1b9a);
}

.catalog-page-header--lessons .catalog-page-header__title {
    margin-bottom: 6px;
    font-size: clamp(1.45rem, 2.5vw, 1.95rem);
}

.catalog-page-header__text {
    margin: 0 auto;
    max-width: 640px;
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--eman-text-muted, #6b7280);
}

.catalog-page-header--lessons .catalog-page-header__text {
    font-size: 0.98rem;
    line-height: 1.5;
}

.eman-level-page .breadcrumbs {
    padding: 10px 0;
}

.level-lessons-path {
    padding-top: 8px;
}

.level-lessons-path .eman-edu-panel {
    margin-bottom: 0;
}

.level-lessons-path .eman-edu-panel h3 {
    margin-bottom: 0.5rem;
}

.level-lessons-path .eman-edu-panel .text-14 {
    margin-bottom: 10px !important;
}

.level-lessons-catalog {
    padding: 18px 0 56px;
}

.level-select-section {
    padding: 8px 0 56px;
}

.catalog-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px 20px;
    margin-bottom: 20px;
    border-radius: var(--radius-lg, 12px);
    background: var(--eman-bg, #fff);
    border: 1px solid var(--eman-border-light, #e5e7eb);
    box-shadow: var(--shadow-card, 0 4px 20px rgba(15, 23, 42, 0.05));
}

.catalog-filter-bar__results {
    font-size: 0.95rem;
    color: var(--eman-text-muted, #6b7280);
}

.catalog-filter-bar__form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    flex: 1;
    justify-content: flex-end;
}

.catalog-filter-bar__search input {
    min-width: 220px;
    height: 44px;
    padding: 0 16px;
    border: 1px solid var(--eman-border-light, #e5e7eb);
    border-radius: var(--radius-md, 8px);
    font-size: 0.95rem;
}

.catalog-filter-bar__sort {
    display: flex;
    align-items: center;
    gap: 8px;
}

.catalog-filter-bar__sort label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--eman-text, #111827);
    white-space: nowrap;
}

.catalog-filter-bar__sort select {
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--eman-border-light, #e5e7eb);
    border-radius: var(--radius-md, 8px);
    font-size: 0.9rem;
    background: #fff;
}

.catalog-empty-box,
.catalog-error-box {
    text-align: center;
    padding: 56px 28px;
    border-radius: var(--radius-lg, 12px);
    background: var(--eman-bg-subtle, #f8f9fc);
    border: 1px dashed var(--eman-border-light, #e5e7eb);
}

.catalog-empty-box .lucide-icon,
.catalog-error-box .lucide-icon {
    width: 48px;
    height: 48px;
    color: var(--eman-purple, #6a1b9a);
    margin-bottom: 16px;
}

.catalog-empty-box h4,
.catalog-error-box h4 {
    margin: 0 0 8px;
    font-size: 1.2rem;
    font-weight: 700;
}

.catalog-empty-box p,
.catalog-error-box p {
    margin: 0;
    color: var(--eman-text-muted, #6b7280);
    max-width: 480px;
    margin-inline: auto;
    line-height: 1.55;
}

/* Skeleton loader */
.catalog-skeleton-grid .skeleton-card {
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--eman-border-light, #e5e7eb);
}

.skeleton-card__image {
    aspect-ratio: 16 / 9;
    background: linear-gradient(90deg, #f0f0f5 25%, #e8e8ef 50%, #f0f0f5 75%);
    background-size: 200% 100%;
    animation: catalog-shimmer 1.4s infinite;
}

.skeleton-card__content {
    padding: 18px;
}

.skeleton-card__title,
.skeleton-card__meta {
    height: 14px;
    border-radius: 6px;
    background: linear-gradient(90deg, #f0f0f5 25%, #e8e8ef 50%, #f0f0f5 75%);
    background-size: 200% 100%;
    animation: catalog-shimmer 1.4s infinite;
}

.skeleton-card__title { width: 85%; margin-bottom: 12px; height: 18px; }
.skeleton-card__meta { width: 60%; }

@keyframes catalog-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.catalog-page-header__system {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto 8px;
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 700;
    line-height: 1;
}

.catalog-page-header__system svg,
.catalog-page-header__system i {
    width: 16px;
    height: 16px;
}

.catalog-page-header__system-primary {
    font-size: 0.95rem;
}

.catalog-page-header__system-secondary {
    font-size: 0.78rem;
    font-weight: 600;
    opacity: 0.78;
}

.catalog-page-header__system--arabic {
    background: rgba(106, 27, 154, 0.1);
    color: var(--eman-purple, #6a1b9a);
}

.catalog-page-header__system--languages {
    background: rgba(14, 116, 144, 0.12);
    color: #0e7490;
}

.level-system-switch {
    display: flex;
    align-items: stretch;
    width: min(560px, 100%);
    margin: 0 auto 40px;
    padding: 6px;
    color: #3f3356;
    background: #f3f1f7;
    border-radius: 999px;
    box-shadow: 0 12px 32px rgba(76, 29, 149, 0.12), 0 2px 8px rgba(15, 23, 42, 0.06);
}

.level-system-switch.is-locked {
    width: auto;
    max-width: 100%;
}

.level-system-switch__tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex: 1;
    min-height: 48px;
    padding: 11px 22px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 1rem;
    color: #3f3356 !important;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.level-system-switch__tab svg,
.level-system-switch__tab i {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    stroke-width: 2;
    color: inherit !important;
    stroke: currentColor;
}

.level-system-switch__labels {
    display: inline-flex;
    align-items: baseline;
    gap: 7px;
    color: inherit;
}

.level-system-switch__primary,
.level-system-switch__secondary {
    color: inherit !important;
}

.level-system-switch__primary {
    font-weight: 700;
}

.level-system-switch__secondary {
    font-size: 0.78em;
    font-weight: 600;
    opacity: 0.72;
}

.level-system-switch__tab:hover {
    color: var(--eman-purple, #6a1b9a) !important;
}

.level-system-switch__tab.is-active,
.level-system-switch__tab.is-active:hover,
.level-system-switch__tab.is-active:focus,
.level-system-switch__tab.is-active:visited {
    background: var(--eman-purple, #6a1b9a);
    color: #fff !important;
    box-shadow: 0 8px 18px rgba(106, 27, 154, 0.32);
}

.level-system-switch__tab.is-active svg,
.level-system-switch__tab.is-active i {
    color: #fff !important;
    stroke: #fff;
}

.level-system-switch__tab.is-active .level-system-switch__secondary {
    opacity: 0.9;
}

.level-system-chip {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.2;
}

.level-system-chip span:last-child {
    font-size: 0.72rem;
    font-weight: 600;
    opacity: 0.78;
}

.level-system-chip--arabic {
    background: rgba(106, 27, 154, 0.1);
    color: var(--eman-purple, #6a1b9a);
}

.level-system-chip--languages {
    background: rgba(14, 116, 144, 0.12);
    color: #0e7490;
}

/* Level selection cards */
.level-select-card {
    display: block;
    height: 100%;
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--eman-border-light, #e5e7eb);
    box-shadow: var(--shadow-card, 0 4px 20px rgba(15, 23, 42, 0.06));
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    text-decoration: none;
    color: inherit;
}

.level-select-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 36px rgba(106, 27, 154, 0.12);
    border-color: rgba(106, 27, 154, 0.2);
}

.level-select-card__image {
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.level-select-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.level-select-card:hover .level-select-card__image img {
    transform: scale(1.04);
}

.level-select-card__body {
    padding: 20px;
}

.level-select-card__category {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--eman-purple, #6a1b9a);
}

.level-select-card__title {
    margin: 8px 0 0;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--eman-text, #111827);
}

.level-select-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.level-select-card__tag {
    font-size: 0.85rem;
    color: var(--eman-text-muted, #6b7280);
}

.level-select-card__count {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: var(--radius-pill, 999px);
    background: rgba(106, 27, 154, 0.08);
    color: var(--eman-purple, #6a1b9a);
    font-size: 0.8rem;
    font-weight: 700;
}

.catalog-section-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--eman-purple, #6a1b9a);
}

@media (max-width: 767px) {
    .catalog-page-header {
        padding: 20px 0 16px;
    }

    .catalog-page-header--lessons {
        padding: 12px 0 8px;
    }

    .level-lessons-path {
        padding-top: 4px;
    }

    .level-lessons-catalog {
        padding: 14px 0 40px;
    }

    .catalog-filter-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
    }

    .catalog-filter-bar__results {
        text-align: center;
    }

    .catalog-filter-bar__form {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .catalog-filter-bar__search input {
        min-width: 100%;
        width: 100%;
    }

    .catalog-filter-bar__sort {
        width: 100%;
        justify-content: space-between;
    }

    .catalog-filter-bar__sort select {
        flex: 1;
    }

    .catalog-filter-bar__form .button {
        width: 100%;
        justify-content: center;
    }

    .eman-level-page .breadcrumbs__content {
        flex-wrap: wrap;
        gap: 4px;
    }

    .eman-level-page .catalog-section-title {
        font-size: 1.25rem;
        text-align: center;
    }

    .level-system-switch {
        margin-bottom: 28px;
    }

    .level-system-switch__tab {
        min-height: 44px;
        padding: 10px 12px;
        font-size: 0.9rem;
        gap: 6px;
    }

    .level-system-switch__labels {
        gap: 5px;
    }
}

.catalog-live-search {
    width: 100%;
    max-width: 520px;
    margin: 0 auto 16px;
}

.catalog-live-search--header {
    margin-top: 18px;
    text-align: start;
}

.catalog-live-search .eman-lesson-search-wrap,
.catalog-live-search .eman-lesson-search {
    width: 100%;
    max-width: none;
    min-width: 0;
}

.catalog-live-search .eman-lesson-search__input {
    min-height: 44px;
    font-size: 16px;
}
