/* Shared exam styling: the catalogue, chips and skeletons. */

.x-catalog__head {
    margin-bottom: var(--space-5);
}

.x-catalog__head-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
}

.x-catalog__filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-5);
}

.x-chip {
    min-height: 34px;
    padding: 0 var(--space-3);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-weight: var(--weight-medium);
    font-size: var(--text-sm);
    cursor: pointer;
}

.x-chip:hover {
    color: var(--text-primary);
    background: var(--surface-muted);
}

.x-chip.is-active {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.x-chip--static {
    cursor: default;
    background: var(--surface-muted);
    border-color: transparent;
    color: var(--text-secondary);
    min-height: 24px;
    font-size: var(--text-2xs);
    padding: 0 var(--space-2);
}

/* The exams of a course: one sheet, one row each. */
.x-cards {
    display: grid;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.x-cards > .x-card {
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.x-cards > .x-card:last-child {
    border-bottom: 0;
}

/* --------------------------------------------------------- مرور اشتباه‌ها */

.x-mistakes__list {
    display: grid;
    gap: var(--space-4);
}

.x-mistakes__card .x-chip--static {
    margin-bottom: var(--space-3);
}

.x-card {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    transition: background var(--motion-fast) var(--ease);
}

.x-cards > .x-card:hover {
    background: var(--surface-muted);
}

.x-card.is-exhausted {
    opacity: 0.7;
}

.x-card__body {
    flex: 1;
    min-width: 0;
}

.x-card__title {
    font-size: var(--text-base);
    margin-bottom: var(--space-1);
}

.x-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
}

.x-card__side {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex: none;
}

.x-card__side .f-btn {
    min-height: 36px;
    padding-inline: var(--space-4);
    font-size: var(--text-sm);
}

.x-card__status {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.x-card__status.is-active {
    color: var(--warning);
    font-weight: 700;
}

@media (max-width: 560px) {
    .x-card {
        flex-direction: column;
        align-items: stretch;
    }

    .x-card__side {
        align-items: stretch;
    }
}

/* A skeleton says "content is coming" without pretending to be content. */
.x-skeleton {
    height: 72px;
    margin-bottom: var(--space-3);
    border-radius: var(--radius-md);
    background: linear-gradient(90deg, var(--surface-muted), var(--surface-strong), var(--surface-muted));
    background-size: 200% 100%;
    animation: x-shimmer 1.4s linear infinite;
}

@keyframes x-shimmer {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

/* ------------------------------------------------------------ course index */

/*
 * The catalogue's first level once a workspace holds more than one course.
 * Tiles rather than rows: a course is a place to go into, and fifty of them
 * read as a grid of destinations far better than as a list of links.
 */
.x-catalog__tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.x-catalog__search {
    flex: 1;
    min-width: 200px;
    min-height: 42px;
    padding: 0 var(--space-4);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-primary);
    font: inherit;
    font-size: var(--text-sm);
}

.x-catalog__search:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.x-catalog__crumbs {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
}

.x-catalog__back::after {
    content: '‹';
    margin-inline-start: var(--space-2);
    color: var(--text-tertiary);
}

.x-catalog__course {
    font-weight: var(--weight-strong);
    color: var(--text-primary);
}

/* Courses: one sheet of rows, in columns where there is room. */
.x-courses {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: var(--space-6);
    padding: 0 var(--space-5);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.x-courses > .x-course {
    margin-bottom: -1px;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 54px;
    padding: 0;
    color: var(--text-primary);
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    box-shadow: none;
}

.x-courses > .x-course:hover {
    text-decoration: none;
    color: var(--accent);
}

.x-courses > .x-course::after {
    content: "←";
    color: var(--text-tertiary);
}

.x-course__title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: var(--weight-medium);
}

.x-course__count {
    flex: none;
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

@media (max-width: 900px) {
    .x-courses {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .x-courses {
        grid-template-columns: minmax(0, 1fr);
        padding-inline: var(--space-4);
    }
}

.x-catalog__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

/* The bank's past papers above the catalogue (cards from bank.css). */
.x-papers {
    margin-bottom: var(--space-6);
}

.x-papers__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2) var(--space-4);
    margin-bottom: var(--space-4);
}

.x-papers__head h2,
.x-papers__more {
    margin: 0;
    font-size: var(--text-xl);
}

.x-papers__head .g-goal {
    margin-top: 0;
}

.x-papers__more {
    margin-bottom: var(--space-3);
}

.x-catalog__head {
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--border-strong);
}
.x-card {
    border-color: var(--border-strong);
    box-shadow: none;
}
