/**
 * Course-card layout inspired by Radiant Studio's LMS Course Cards.
 * Existing course artwork, real learning data and native Tutor actions.
 */
body .tutor-course-list.tutor-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
    gap: 24px;
}
body .tutor-card.tutor-course-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    padding: 6px;
    border: 1px solid color-mix(in srgb, var(--theme-palette-color-4) 10%, transparent);
    border-radius: var(--ek-tutor-radius, 8px);
    background: var(--theme-palette-color-8);
    box-shadow: none;
    overflow: hidden;
    transition: transform .18s ease, border-color .18s ease;
}
body .tutor-card.tutor-course-card:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--theme-palette-color-4) 28%, transparent);
}
.ek-course-card-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    padding: 22px;
    border-radius: var(--ek-tutor-radius, 8px);
    background: var(--ek-card-category-panel, var(--ek-card-panel, var(--theme-palette-color-6)));
    color: var(--theme-palette-color-4);
}
.ek-course-tone-0 { --ek-card-panel: #e4f6e8; }
.ek-course-tone-1 { --ek-card-panel: #e6f3fb; }
.ek-course-tone-2 { --ek-card-panel: #f7e5ef; }
.ek-course-tone-3 { --ek-card-panel: #f8f2d8; }
[data-color-mode="dark"] .ek-course-tone-0 { --ek-card-panel: #223b33; }
[data-color-mode="dark"] .ek-course-tone-1 { --ek-card-panel: #253b4b; }
[data-color-mode="dark"] .ek-course-tone-2 { --ek-card-panel: #402f3c; }
[data-color-mode="dark"] .ek-course-tone-3 { --ek-card-panel: #403c29; }
.ek-course-card-top {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px;
    align-items: start;
    gap: 18px;
}
.ek-course-card-summary { min-width: 0; }
.ek-course-card-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 3px 10px;
    margin-bottom: 16px;
    border-radius: 99px;
    background: color-mix(in srgb, var(--theme-palette-color-4) 6%, transparent);
    color: var(--theme-palette-color-4);
    font-size: 12px;
    line-height: 1.5;
}
body .tutor-course-card .tutor-card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0;
}
body .tutor-course-card .tutor-course-name {
    margin: 0;
    font-size: clamp(21px, 2vw, 25px);
    line-height: 1.2;
    font-weight: 600;
    letter-spacing: -.025em;
    overflow-wrap: anywhere;
}
body .tutor-course-card .ek-course-card-description {
    margin: 0;
    color: var(--theme-palette-color-3);
    font-size: 13px;
    line-height: 1.6;
}
.ek-course-card-art { min-width: 0; padding-top: 16px; }
body .tutor-course-card .ek-course-card-art .tutor-course-thumbnail {
    width: 100%;
    margin: 0;
    border-radius: var(--ek-tutor-radius, 8px);
    overflow: hidden;
}
body .tutor-course-card .ek-course-card-art .tutor-ratio {
    aspect-ratio: 2 / 3;
    height: auto;
}
body .tutor-course-card .ek-course-card-art .tutor-ratio::before { display: none; }
body .tutor-course-card .ek-course-card-art img {
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    border-radius: 0;
}
.ek-course-card-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 22px;
    font-size: 13px;
    line-height: 1.5;
}
.ek-course-card-stats .ek-course-meta-icon { width: 17px; height: 17px; flex-basis: 17px; }
.ek-course-card-progress { margin: 0; min-width: 0; width: 100%; text-align: left; }
.ek-course-progress-caption {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 12px;
    line-height: 1.5;
}
.ek-course-progress-track {
    height: 6px;
    border-radius: 99px;
    background: color-mix(in srgb, var(--theme-palette-color-4) 10%, transparent);
    overflow: hidden;
}
.ek-course-progress-track > span { display: block; height: 100%; border-radius: inherit; background: var(--theme-palette-color-4); }
body .tutor-course-card .tutor-course-progress { padding: 0; }
body .tutor-course-card .tutor-course-progress .tutor-progress-bar { height: 6px; border-radius: 99px; overflow: hidden; }
.ek-course-card-bottom {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    justify-items: stretch;
    align-items: center;
    gap: 16px;
    padding: 18px 16px 14px;
}
.ek-course-card-details { min-width: 0; }
body .tutor-course-card .ek-course-card-meta {
    gap: 10px;
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
}
body .tutor-course-card .ek-course-meta-row dt { font-size: 11px; line-height: 1.4; margin-bottom: 2px; gap: 6px; color: var(--theme-palette-color-3); }
body .tutor-course-card .ek-course-meta-row dd { margin-left: 23px; font-size: 13px; }
body .tutor-course-card .ek-course-meta-row .ek-course-meta-icon { width: 17px; height: 17px; flex-basis: 17px; }
body .tutor-course-card .tutor-card-footer { margin: 0; padding: 0; border: 0; background: transparent; }
body:not(.wp-admin) .tutor-course-card .tutor-card-footer .tutor-btn {
    width: auto;
    max-width: 170px;
    min-height: 44px;
    padding: 10px 16px;
    border-radius: var(--tutor-button-radius, 6px);
    font-size: 13px;
    line-height: 1.4;
    font-weight: 500;
    background: var(--theme-palette-color-4);
    color: var(--theme-palette-color-7);
    border-color: transparent;
}
body:not(.wp-admin) .tutor-course-card .tutor-card-footer .tutor-btn:hover {
    background: var(--theme-palette-color-1);
    color: var(--theme-palette-color-7);
}
body .tutor-course-card .tutor-course-bookmark { top: 12px; right: 12px; }
/* Instructor management cards keep all native editing and course actions. */
body .tutor-dashboard-my-courses .tutor-my-courses-card-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
    gap: 24px;
}
body .tutor-dashboard-my-courses .tutor-my-courses-card {
    padding: 6px;
    border: 1px solid var(--theme-palette-color-5);
    border-radius: var(--ek-tutor-radius, 8px);
    overflow: hidden;
    background: var(--theme-palette-color-8);
}
body .tutor-dashboard-my-courses .tutor-my-courses-card-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 112px;
    gap: 18px;
    padding: 20px;
    border-radius: var(--ek-tutor-radius, 8px);
    background: var(--ek-card-category-panel, var(--ek-card-panel, var(--theme-palette-color-6)));
}
body .tutor-dashboard-my-courses .tutor-my-courses-card-thumb { grid-column: 2; grid-row: 1; width: 112px; height: 168px; border-radius: var(--ek-tutor-radius, 8px); }
body .tutor-dashboard-my-courses .tutor-my-courses-card-content { grid-column: 1; grid-row: 1; min-width: 0; }
body .tutor-dashboard-my-courses .tutor-my-courses-card-footer { border: 0; padding: 16px; }
@media (max-width: 600px) {
    body .tutor-course-list.tutor-grid { gap: 20px; }
    .ek-course-card-panel { padding: 18px; }
    .ek-course-card-top { grid-template-columns: minmax(0, 1fr) 100px; gap: 14px; }
    .ek-course-card-bottom { padding: 16px 12px 12px; gap: 12px; }
    body .tutor-course-card .tutor-card-footer .tutor-btn { max-width: 145px; }
}
@media (max-width: 360px) {
    .ek-course-card-top { grid-template-columns: minmax(0, 1fr); }
    .ek-course-card-art { width: 130px; padding-top: 0; }
}
@media (prefers-reduced-motion: reduce) { body .tutor-course-card { transition: none; } body .tutor-course-card:hover { transform: none; } }

/* Match Tutor's dashboard selector strength and keep course identity first. */
body .tutor-dashboard-my-courses .tutor-my-courses-card-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
body .tutor-dashboard-my-courses .tutor-my-courses-card-content > a {
    order: -2;
    font-size: 23px;
    line-height: 1.25;
    font-weight: 600;
    letter-spacing: -.025em;
}
body .tutor-dashboard-my-courses .tutor-my-courses-card-content > .tutor-tiny { order: -1; margin: 0; font-size: 12px; }
body .tutor-dashboard-my-courses .tutor-my-courses-card-content > .ek-course-card-meta { order: 2; margin: 0; }
body .tutor-dashboard-my-courses .tutor-my-courses-card:nth-child(4n+1) { --ek-card-panel: #f7e5ef; }
body .tutor-dashboard-my-courses .tutor-my-courses-card:nth-child(4n+2) { --ek-card-panel: #e6f3fb; }
body .tutor-dashboard-my-courses .tutor-my-courses-card:nth-child(4n+3) { --ek-card-panel: #e4f6e8; }
body .tutor-dashboard-my-courses .tutor-my-courses-card:nth-child(4n) { --ek-card-panel: #f8f2d8; }
[data-color-mode="dark"] body .tutor-dashboard-my-courses .tutor-my-courses-card:nth-child(4n+1) { --ek-card-panel: #402f3c; }
[data-color-mode="dark"] body .tutor-dashboard-my-courses .tutor-my-courses-card:nth-child(4n+2) { --ek-card-panel: #253b4b; }
[data-color-mode="dark"] body .tutor-dashboard-my-courses .tutor-my-courses-card:nth-child(4n+3) { --ek-card-panel: #223b33; }
[data-color-mode="dark"] body .tutor-dashboard-my-courses .tutor-my-courses-card:nth-child(4n) { --ek-card-panel: #403c29; }
@media (max-width: 430px) {
    body .tutor-dashboard-my-courses .tutor-my-courses-card-body {
        grid-template-columns: minmax(0, 1fr) 90px;
        gap: 12px;
        padding: 16px;
    }
    body .tutor-dashboard-my-courses .tutor-my-courses-card-thumb { width: 90px; height: 135px; }
}

/* Subject and year values replace the lesson count inside the coloured panel. */
body .tutor-course-card .ek-course-card-stats .ek-course-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
}
body .tutor-course-card .ek-course-card-stats .ek-course-meta-row {
    display: grid;
    grid-template-columns: 17px minmax(0, 1fr);
    gap: 6px;
    align-items: start;
}
body .tutor-course-card .ek-course-card-stats dt {
    display: block;
    margin: 2px 0 0;
    font-size: 0;
}
body .tutor-course-card .ek-course-card-stats dd {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
}

/* Personal course progress starts at the left edge, beside the continue action. */
.ek-course-card-progress-slot { min-width: 0; max-width: 230px; text-align: left; }
.ek-course-card-action { justify-self: end; }
.ek-course-card-bottom .ek-course-progress-caption { justify-content: flex-start; flex-wrap: wrap; gap: 2px 8px; }
body .tutor-course-card .ek-course-card-bottom .tutor-course-progress { margin: 0; text-align: left; }
body .tutor-course-card .ek-course-card-bottom .tutor-course-progress > div:first-child {
    justify-content: flex-start !important;
    flex-wrap: wrap;
    gap: 2px 8px;
    font-size: 12px;
}
