/* CourseBond — My Learning dashboard.
   Tokens from style.css :root. Udemy-style: dark hero, tabs, course grid. */

.cb-ml { background: #fff; min-height: 60vh; }

/* ---------- Hero ---------- */
.cb-ml-hero {
    background: var(--cb-dark);
    color: #fff;
    padding: 56px 0 48px;
}
.cb-ml-hero__title {
    font-size: 36px;
    font-weight: 700;
    margin: 0 0 12px;
    color: #fff;
    line-height: 1.2;
}
.cb-ml-hero__sub {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
    line-height: 1.5;
}
.cb-ml-hero__sub strong { color: #fff; font-weight: 700; }

/* ---------- Tabs ---------- */
.cb-ml-tabs {
    border-bottom: 1px solid var(--cb-border);
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 5;
}
.cb-ml-tabs__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 28px;
    overflow-x: auto;
    scrollbar-width: none;
}
.cb-ml-tabs__list::-webkit-scrollbar { display: none; }
.cb-ml-tabs__list li { flex-shrink: 0; }
.cb-ml-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 16px 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--cb-text-light);
    text-decoration: none;
    border-bottom: 3px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.cb-ml-tab:hover { color: var(--cb-text); }
.cb-ml-tab.is-active {
    color: var(--cb-text);
    border-bottom-color: var(--cb-purple);
}
.cb-ml-tab__count {
    background: var(--cb-bg);
    color: var(--cb-text-light);
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    min-width: 20px;
    text-align: center;
}
.cb-ml-tab.is-active .cb-ml-tab__count {
    background: var(--cb-purple-soft);
    color: var(--cb-purple);
}

/* ---------- Body ---------- */
.cb-ml-body {
    padding: 32px 24px 64px;
}

/* ---------- Empty states ---------- */
.cb-ml-empty {
    padding: 64px 24px;
    text-align: center;
}
.cb-ml-empty__inner {
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.cb-ml-empty h2 {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    color: var(--cb-text);
    line-height: 1.3;
}
.cb-ml-empty p {
    font-size: 15px;
    color: var(--cb-text-light);
    margin: 0;
    line-height: 1.5;
}
.cb-ml-empty__actions {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

/* ---------- Course grid ---------- */
.cb-ml-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 28px;
}

.cb-ml-card {
    background: #fff;
    border: 1px solid var(--cb-border);
    border-radius: var(--cb-radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.15s, transform 0.15s;
}
.cb-ml-card:hover {
    box-shadow: var(--cb-shadow-card-hover);
    transform: translateY(-2px);
}

.cb-ml-card__media {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--cb-bg);
    overflow: hidden;
    display: block;
}
.cb-ml-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.cb-ml-card__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
}
.cb-ml-card__media:hover .cb-ml-card__overlay { opacity: 1; }
.cb-ml-card__play {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: var(--cb-purple);
    display: flex;
    align-items: center;
    justify-content: center;
}
.cb-ml-card.is-complete .cb-ml-card__media::after {
    content: "Completed";
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--cb-success);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: var(--cb-radius-sm);
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.cb-ml-card__body {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}
.cb-ml-card__title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
}
.cb-ml-card__title a {
    color: var(--cb-text);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.cb-ml-card__title a:hover { color: var(--cb-purple); }
.cb-ml-card__tagline {
    margin: 0;
    font-size: 13px;
    color: var(--cb-text-light);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cb-ml-card__progress {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}
.cb-ml-card__progress-bar {
    height: 6px;
    background: var(--cb-bg);
    border-radius: 3px;
    overflow: hidden;
    display: block;
}
.cb-ml-card__progress-fill {
    display: block;
    height: 100%;
    background: var(--cb-purple);
    transition: width 0.3s;
}
.cb-ml-card.is-complete .cb-ml-card__progress-fill { background: var(--cb-success); }
.cb-ml-card__progress-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--cb-text-light);
}
.cb-ml-card.is-complete .cb-ml-card__progress-label { color: var(--cb-success); }

.cb-ml-card__actions {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 8px;
}
.cb-ml-card__actions .cb-btn { padding: 10px 14px; font-size: 14px; }
.cb-ml-card__details {
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--cb-text-light);
    text-decoration: none;
}
.cb-ml-card__details:hover { color: var(--cb-purple); text-decoration: underline; }

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
    .cb-ml-hero { padding: 40px 0 32px; }
    .cb-ml-hero__title { font-size: 28px; }
    .cb-ml-hero__sub { font-size: 14px; }
    .cb-ml-tabs__list { gap: 20px; }
    .cb-ml-tab { font-size: 14px; padding: 14px 0; }
    .cb-ml-body { padding: 24px 24px 48px; }
    .cb-ml-grid { gap: 20px; }
}

@media (max-width: 540px) {
    .cb-ml-hero { padding: 32px 0 24px; }
    .cb-ml-hero__title { font-size: 24px; }
    .cb-ml-grid { grid-template-columns: 1fr; }
    .cb-ml-empty { padding: 48px 16px; }
    .cb-ml-empty h2 { font-size: 20px; }
}

/* =========================================================================
   Featured-courses upsell — shown when student has zero enrollments.
   Added 2026-05-04. Goal: convert brand-new accounts into first enrollees
   without forcing them to bounce out to /courses/.
   ========================================================================= */
.cb-ml-upsell {
    position: relative;
    margin: 0 0 32px;
    padding: 44px 28px 36px;
    text-align: center;
    background: linear-gradient(135deg, #fef3c7 0%, #ddd6fe 50%, #a5f3fc 100%);
    border-radius: 18px;
    overflow: hidden;
}
.cb-ml-upsell__sparkle {
    position: absolute;
    top: 16px;
    right: 22px;
    font-size: 32px;
    opacity: .7;
    animation: cbSparkle 2.4s ease-in-out infinite;
}
@keyframes cbSparkle {
    0%, 100% { transform: scale(1) rotate(0); }
    50%      { transform: scale(1.15) rotate(8deg); }
}
.cb-ml-upsell__title {
    margin: 0 0 8px;
    font-size: 26px;
    font-weight: 800;
    color: #1e1b4b;
    line-height: 1.2;
}
.cb-ml-upsell__sub {
    margin: 0 auto 18px;
    max-width: 560px;
    color: #312e81;
    font-size: 15px;
    line-height: 1.55;
}
.cb-ml-upsell__browse {
    background: #1e1b4b;
    color: #fff;
    padding: 12px 22px;
    border-radius: 999px;
    font-weight: 700;
    text-decoration: none;
    display: inline-block;
    transition: transform .15s ease, box-shadow .15s ease;
}
.cb-ml-upsell__browse:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(30,27,75,.25);
    color: #fff;
}

.cb-ml-featured__head { margin: 0 0 18px; }
.cb-ml-featured__heading {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 800;
    color: #1c1d1f;
}
.cb-ml-featured__sub {
    margin: 0;
    color: #5b5b66;
    font-size: 14px;
}

/* Featured card — extends .cb-ml-card with badges + ratings + CTA. */
.cb-ml-card--feat .cb-ml-card__media { position: relative; }
.cb-ml-card__badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    box-shadow: 0 4px 10px rgba(0,0,0,.18);
    color: #fff;
    z-index: 2;
}
.cb-ml-card__badge.is-best { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.cb-ml-card__badge.is-top  { background: linear-gradient(135deg, #10b981, #059669); }
.cb-ml-card__badge.is-feat { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.cb-ml-card__cat {
    position: absolute;
    bottom: 10px;
    left: 10px;
    padding: 4px 9px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
    background: rgba(28,29,31,.78);
    color: #fff;
    z-index: 2;
}
.cb-ml-card__tagline {
    margin: 0 0 12px;
    color: #5b5b66;
    font-size: 13px;
    line-height: 1.4;
    /* clamp to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.cb-ml-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    font-size: 13px;
    color: #5b5b66;
}
.cb-ml-card__rating { color: #b45309; font-weight: 700; }
.cb-ml-card__rcount { color: #9ca3af; font-weight: 500; margin-left: 2px; }
.cb-ml-card__free {
    margin-left: auto;
    background: #dcfce7;
    color: #15803d;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .4px;
}

@media (max-width: 540px) {
    .cb-ml-upsell { padding: 32px 18px 26px; border-radius: 14px; }
    .cb-ml-upsell__sparkle { top: 10px; right: 14px; font-size: 24px; }
    .cb-ml-upsell__title { font-size: 21px; }
    .cb-ml-upsell__sub { font-size: 14px; }
    .cb-ml-featured__heading { font-size: 19px; }
    .cb-ml-card__badge { font-size: 10px; padding: 4px 8px; }
}

/* Enroll-and-start button — one-click flow.  In .is-loading state we
   hide the label and reveal a spinner so the user has visual feedback
   during the ~200-400ms while the REST POST is in flight. */
.cb-ml-enroll-btn {
    position: relative;
    cursor: pointer;
    border: 0;
    width: 100%;
    transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.cb-ml-enroll-btn:hover { transform: translateY(-1px); }
.cb-ml-enroll-btn:disabled,
.cb-ml-enroll-btn.is-loading {
    cursor: progress;
    opacity: .85;
    transform: none;
}
.cb-ml-enroll-btn__spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: cbEnrollSpin .8s linear infinite;
    margin: 0 auto;
}
.cb-ml-enroll-btn.is-loading .cb-ml-enroll-btn__label { display: none; }
.cb-ml-enroll-btn.is-loading .cb-ml-enroll-btn__spinner { display: inline-block; }
@keyframes cbEnrollSpin { to { transform: rotate(360deg); } }
