/* ── Course Progress Page ───────────────────────────────────────────────── */

/* Enrollment card grid */
.cp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 8px;
}

.cp-enrollment-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
}
.cp-enrollment-card:hover {
    box-shadow: 0 6px 24px rgba(247,8,128,0.12);
    transform: translateY(-2px);
}

.cp-card-header {
    background: linear-gradient(135deg, var(--primary-color, #f70880), var(--accent-color, #7928ca));
    padding: 18px 20px 14px;
    color: #fff;
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.cp-ring-wrap { flex-shrink: 0; }

.cp-ring-svg { transform: rotate(-90deg); }
.cp-ring-bg { fill: none; stroke: rgba(255,255,255,0.25); stroke-width: 6; }
.cp-ring-fill {
    fill: none;
    stroke: #fff;
    stroke-width: 6;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.6s ease;
}

.cp-card-header-text { flex: 1; min-width: 0; }
.cp-card-title { font-size: 15px; font-weight: 700; margin: 0 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-card-subtitle { font-size: 12px; opacity: 0.85; margin: 0; }
.cp-pct-label { font-size: 22px; font-weight: 800; text-align: center; margin-top: 2px; }
.cp-pct-sub { font-size: 10px; opacity: 0.8; text-align: center; }

.cp-card-body { padding: 14px 18px 18px; }

/* Lesson list inside card */
.cp-lesson-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cp-lesson-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #fafafa;
    border: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 13px;
}
.cp-lesson-item:hover { background: #f5f0ff; border-color: var(--accent-color, #7928ca); }
.cp-lesson-num { font-size: 11px; font-weight: 700; color: #aaa; width: 22px; flex-shrink: 0; }
.cp-lesson-title { flex: 1; font-weight: 500; color: #333; }

/* Status chips */
.cp-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}
.cp-status-planned    { background: #f0f0f0; color: #888; }
.cp-status-inprogress { background: #fff3cd; color: #856404; }
.cp-status-completed  { background: #d1fae5; color: #065f46; }
.cp-status-skip       { background: #fee2e2; color: #991b1b; }

/* Progress bar */
.cp-progress-bar-wrap { margin-top: 12px; }
.cp-progress-bar-label { display: flex; justify-content: space-between; font-size: 11px; color: #888; margin-bottom: 4px; }
.cp-progress-bar-track { background: #f0f0f0; border-radius: 99px; height: 7px; overflow: hidden; }
.cp-progress-bar-fill {
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--primary-color, #f70880), var(--accent-color, #7928ca));
    transition: width 0.6s ease;
}

/* Stats header strip */
.cp-stats-strip {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.cp-stat-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border-radius: 12px;
    padding: 10px 16px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.08);
    min-width: 120px;
}
.cp-stat-pill .material-icons { font-size: 20px; color: var(--primary-color, #f70880); }
.cp-stat-pill-val { font-size: 20px; font-weight: 800; color: #222; line-height: 1; }
.cp-stat-pill-label { font-size: 11px; color: #888; margin-top: 1px; }

/* Streak + badges row */
.cp-streak-badge-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }

.cp-streak {
    display: flex; align-items: center; gap: 6px;
    background: linear-gradient(135deg, #ff6b35, #f7c948);
    color: #fff;
    padding: 8px 16px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(255,107,53,0.3);
}
.cp-streak .material-icons { font-size: 18px; }

.cp-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    cursor: default;
    position: relative;
}
.cp-badge[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: #fff;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
}
.cp-badge-first    { background: linear-gradient(135deg,#ffd700,#ffb300); }
.cp-badge-halfway  { background: linear-gradient(135deg,#a78bfa,#7c3aed); }
.cp-badge-complete { background: linear-gradient(135deg,#34d399,#059669); }
.cp-badge-streak7  { background: linear-gradient(135deg,#fb923c,#dc2626); }
.cp-badge-streak30 { background: linear-gradient(135deg,#f43f5e,#7c3aed); }
.cp-badge-10h      { background: linear-gradient(135deg,#38bdf8,#0284c7); }

/* ── Admin view ─────────────────────────────────────────────────────────── */
.cp-admin-tabs { display: flex; gap: 4px; border-bottom: 2px solid #f0f0f0; margin-bottom: 16px; }
.cp-admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cp-admin-table thead tr { background: #fafafa; }
.cp-admin-table th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 700; color: #888; letter-spacing: 0.5px; }
.cp-admin-table td { padding: 10px 14px; border-top: 1px solid #f5f5f5; vertical-align: middle; }
.cp-admin-table tbody tr:hover { background: #fafbff; }

.cp-admin-progress-bar { background: #f0f0f0; border-radius: 99px; height: 6px; overflow: hidden; min-width: 80px; }
.cp-admin-progress-fill {
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--primary-color,#f70880), var(--accent-color,#7928ca));
}

/* Admin table pagination (Lesson Templates / Student Enrollments) */
.cp-table-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
    padding: 12px 14px;
    border: 1px solid #f0f0f0;
    border-top: 1px solid #e8e8e8;
    border-radius: 0 0 10px 10px;
    background: #fafafa;
    box-sizing: border-box;
    width: 100%;
}
.cp-table-pagination--compact,
.cp-table-pagination--empty {
    justify-content: center;
}
.cp-pagination-info,
.cp-pagination-info span,
.cp-pagination-info strong {
    display: inline;
    white-space: nowrap;
}
.cp-pagination-info {
    flex: 0 0 auto;
    min-width: max-content;
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}
.cp-pagination-info strong {
    color: #333;
    font-weight: 600;
}
.cp-pagination-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex: 1 1 220px;
    min-width: 0;
}
.cp-pagination-pages {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}
.cp-pagination-btn,
.cp-pagination-page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid #e0e0e0;
    background: #fff;
    border-radius: 6px;
    color: #444;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}
.cp-pagination-btn .material-icons { font-size: 18px; }
.cp-pagination-page-btn.active {
    background: var(--primary-color, #f70880);
    border-color: var(--primary-color, #f70880);
    color: #fff;
}
.cp-pagination-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.cp-pagination-ellipsis {
    color: #999;
    padding: 0 4px;
}

/* Lesson detail modal table */
.cp-lesson-detail-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cp-lesson-detail-table th { padding: 8px 12px; background: #fafafa; font-size: 11px; font-weight: 700; color: #888; text-align: left; }
.cp-lesson-detail-table td { padding: 8px 12px; border-top: 1px solid #f5f5f5; }
.cp-lesson-detail-table select { padding: 4px 8px; border: 1px solid #ddd; border-radius: 6px; font-size: 12px; }

/* Practice log entries */
.cp-practice-log-entry {
    background: #f9fafb;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 8px;
    border-left: 3px solid var(--primary-color, #f70880);
    font-size: 13px;
}
.cp-practice-log-entry .cp-log-meta { font-size: 11px; color: #888; margin-top: 4px; }

/* Align with the page header — extra side margin was leftover from the old material-card wrapper. */
#cpAdminView, #cpStudentView {
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}
#course-progressContainer .material-card-body {
    flex-direction: column !important;
    align-items: stretch !important;
    min-height: auto !important;
}

/* No hover effect on the Course Progress card — keep the resting shadow */
#course-progressContainer .material-card:hover {
    box-shadow: var(--shadow-light, 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24));
    transform: none;
}

#course-progressContainer .cp-admin-table thead th {
    color: #555 !important;
    background: #f5f5f7 !important;
    padding: 10px 14px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

/* ── Analytics Dashboard (cpd-*) ─────────────────────────────────────────── */

.cpd-wrap {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cpd-card {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
}

.cpd-row {
    display: flex;
    gap: 16px;
}

/* Header */
.cpd-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
}

.cpd-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f70880, #ff8552);
    color: #fff;
    font-weight: 700;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cpd-header-info h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.cpd-header-info p {
    font-size: 13px;
    color: #888;
    margin-top: 2px;
    margin-bottom: 0;
}

.cpd-header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.cpd-curriculum-badge {
    background: linear-gradient(135deg, rgba(247,8,128,.1), rgba(255,133,82,.12));
    color: #f70880;
    border: 1px solid rgba(247,8,128,.25);
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.cpd-streak-pill {
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 700;
    color: #f57c00;
    white-space: nowrap;
}

/* Stats row */
.cpd-stats-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px 20px;
}

.cpd-stat {
    flex: 1;
    min-width: 110px;
    background: #f9fafb;
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cpd-stat-val {
    font-size: 24px;
    font-weight: 800;
    line-height: 1;
}

.cpd-stat-lbl {
    font-size: 11px;
    color: #999;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.cpd-stat-sub {
    font-size: 11px;
    color: #aaa;
    margin-top: 2px;
}

/* Color helpers */
.cpd-pink   { background: linear-gradient(135deg, #f70880, #ff8552); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.cpd-green  { color: #2e7d32; }
.cpd-blue   { color: #1565c0; }
.cpd-amber  { color: #f57c00; }
.cpd-purple { color: #7b1fa2; }

/* Ring card */
.cpd-ring-card {
    flex: 0 0 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.cpd-ring-wrap {
    position: relative;
    width: 140px;
    height: 140px;
    flex-shrink: 0;
}

.cpd-ring-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.cpd-ring-pct {
    font-size: 30px;
    font-weight: 800;
    background: linear-gradient(135deg, #f70880, #ff8552);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.cpd-ring-sub {
    font-size: 11px;
    color: #999;
    font-weight: 600;
    margin-top: 2px;
}

.cpd-ring-title {
    font-size: 13px;
    font-weight: 700;
    color: #333;
    text-align: center;
}

.cpd-ring-meta {
    font-size: 12px;
    color: #aaa;
    text-align: center;
}

/* Skills card */
.cpd-skills-card {
    flex: 1;
}

.cpd-card-h3 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 14px;
    margin-top: 0;
    color: #333;
}

.cpd-h3-sub {
    font-size: 11px;
    color: #aaa;
    font-weight: 400;
    margin-left: 4px;
}

.cpd-skill-row {
    margin-bottom: 12px;
}

.cpd-skill-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
}

.cpd-skill-pct {
    font-weight: 700;
    color: #333;
}

.cpd-bar-track {
    height: 8px;
    background: #f0f0f0;
    border-radius: 999px;
    overflow: hidden;
}

.cpd-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width .6s ease;
}

/* Skill bar gradients — all derived from the brand gradient palette */
.cpd-bar-pink   { background: linear-gradient(90deg, #f70880, #ff8552); }
.cpd-bar-blue   { background: linear-gradient(90deg, #d4006b, #f70880); }
.cpd-bar-green  { background: linear-gradient(90deg, #ff8552, #ffb347); }
.cpd-bar-amber  { background: linear-gradient(90deg, #ff6030, #ff8552); }
.cpd-bar-purple { background: linear-gradient(90deg, #c0006a, #f70880); }

/* Chart card */
.cpd-chart-card {
    flex: 1;
}

.cpd-chart-sub {
    font-size: 12px;
    color: #aaa;
    margin-bottom: 12px;
    margin-top: -8px;
}

.cpd-chart-area {
    position: relative;
    overflow: visible;
}

/* Milestone card */
.cpd-milestone-card h3 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 14px;
    margin-top: 0;
    color: #333;
}

.cpd-timeline {
    display: flex;
    align-items: flex-start;
    overflow-x: auto;
    padding-bottom: 4px;
    gap: 0;
}

.cpd-milestone {
    flex: 1;
    min-width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.cpd-milestone:not(:last-child)::after {
    position: absolute;
    top: 18px;
    left: 50%;
    width: 100%;
    height: 2px;
    content: '';
    z-index: 0;
}

.cpd-ms-done::after {
    background: linear-gradient(90deg, #f70880, #ff8552);
}

.cpd-ms-active::after {
    background: linear-gradient(90deg, #ff8552, #e0e0e0);
}

.cpd-milestone:not(.cpd-ms-done):not(.cpd-ms-active)::after {
    background: #e0e0e0;
}

.cpd-ms-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    position: relative;
    border: 3px solid #fff;
    box-sizing: border-box;
}

.cpd-ms-done .cpd-ms-dot {
    background: linear-gradient(135deg, #f70880, #ff8552);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}

.cpd-ms-active .cpd-ms-dot {
    background: #fff;
    border: 3px solid #f70880;
    color: #f70880;
    font-size: 13px;
    font-weight: 700;
}

.cpd-ms-locked .cpd-ms-dot {
    background: #f0f0f0;
    color: #ccc;
    font-size: 13px;
}

.cpd-ms-label {
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    margin-top: 8px;
    color: #555;
    max-width: 80px;
    word-break: break-word;
    line-height: 1.3;
}

.cpd-ms-date {
    font-size: 10px;
    color: #bbb;
    margin-top: 3px;
    text-align: center;
}

.cpd-ms-active .cpd-ms-label { color: #f70880; }
.cpd-ms-active .cpd-ms-date  { color: #ff8552; }

/* Heatmap */
.cpd-heatmap-card { flex: 1.2; }

.cpd-hm-grid {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cpd-hm-week {
    display: flex;
    gap: 3px;
    align-items: center;
}

.cpd-hm-day-lbl {
    font-size: 10px;
    color: #bbb;
    width: 22px;
    text-align: right;
    margin-right: 2px;
    flex-shrink: 0;
}

.cpd-hm-cell {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    flex-shrink: 0;
}

.cpd-hm-off   { background: #f0f0f0; }
.cpd-hm-low   { background: rgba(247,8,128,.2); }
.cpd-hm-mid   { background: rgba(247,8,128,.55); }
.cpd-hm-high  { background: linear-gradient(135deg, #f70880, #ff8552); }
.cpd-hm-today { background: linear-gradient(135deg, #f70880, #ff8552); box-shadow: 0 0 0 2px rgba(247,8,128,.4); }

/* Lessons card */
.cpd-lessons-card { flex: 1.4; }

.cpd-lesson-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 4px;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    transition: background .15s;
    border-radius: 6px;
}

.cpd-lesson-row:hover { background: #fafafa; }
.cpd-lesson-row:last-child { border-bottom: none; }

.cpd-lnum {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.cpd-lnum-done   { background: linear-gradient(135deg, rgba(247,8,128,.12), rgba(255,133,82,.12)); color: #f70880; }
.cpd-lnum-active { background: linear-gradient(135deg, #f70880, #ff8552); color: #fff; }
.cpd-lnum-plan   { background: #f5f5f5; color: #bbb; }

.cpd-ltitle {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    min-width: 0;
}

.cpd-lnotes {
    font-size: 11px;
    color: #aaa;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.cpd-lbar-wrap { width: 70px; flex-shrink: 0; }

.cpd-lbar {
    height: 4px;
    background: #f0f0f0;
    border-radius: 999px;
    overflow: hidden;
}

.cpd-lbar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #f70880, #ff8552);
}

.cpd-chip {
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    flex-shrink: 0;
    white-space: nowrap;
}

.cpd-chip-done   { background: #e8f5e9; color: #2e7d32; }
.cpd-chip-active { background: #fff8e1; color: #f57c00; }
.cpd-chip-plan   { background: #f5f5f5; color: #bbb; }
.cpd-chip-skip   { background: #fafafa; color: #ccc; }

/* Badges */
.cpd-badges-card h3 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 14px;
    margin-top: 0;
    color: #333;
}

.cpd-badges-grid {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.cpd-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 68px;
}

.cpd-badge-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.cpd-badge-icon.earned { box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.cpd-badge-icon.locked { filter: grayscale(1); opacity: .4; }

.cpd-badge-name {
    font-size: 11px;
    font-weight: 600;
    color: #555;
    text-align: center;
}

.cpd-badge-new {
    font-size: 9px;
    background: linear-gradient(135deg, #f70880, #ff8552);
    color: #fff;
    border-radius: 999px;
    padding: 1px 5px;
    font-weight: 700;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .cpd-row { flex-direction: column; }
    .cpd-ring-card { flex: none; width: 100%; }
    .cpd-header { flex-wrap: wrap; }
    .cpd-header-right { margin-left: 0; flex-wrap: wrap; }
    .cpd-stats-row { padding: 12px 16px; }
    .cpd-stat { min-width: 90px; }
    .cpd-hm-cell { width: 14px; height: 14px; }
}
