/**
 * My Account › course cards (Registered Courses tab + dashboard "Your courses").
 *
 * Same palette as cgi-immersion.css: red #d02c2f, dark #2c3e50, yellow
 * #f5b335, soft grays. Loaded on every My Account page (inc/account-courses.php,
 * versioned by filemtime).
 */

/* ───────────────────────────── Sections ───────────────────────────── */

.cgi-courses .cgi-courses-section { margin: 0 0 40px; }
.cgi-courses .cgi-courses-section > h3 {
	font-size: 1.25em;
	margin: 0 0 4px;
	padding-bottom: 8px;
	border-bottom: 2px solid #f0f0f2;
}
.cgi-courses .cgi-section-intro { color: #6b7280; margin: 6px 0 16px; font-size: .95em; }
.cgi-courses .cgi-section-sub {
	font-size: .8em;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: #2c3e50;
	margin: 22px 0 10px;
	display: flex;
	align-items: center;
	gap: 10px;
}
.cgi-courses .cgi-section-sub::before { content: ""; width: 18px; height: 3px; background: #d02c2f; border-radius: 2px; }
.cgi-courses .cgi-section-sub + .cgi-course-grid { margin-top: 0; }
.cgi-courses .cgi-empty, .cgi-courses .cgi-muted { color: #777; font-style: italic; }

/* ───────────────────────────── Grid & card ────────────────────────── */

.cgi-course-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); /* 4 columns in the My Account content column */
	gap: 16px;
	margin: 14px 0 0;
}

.cgi-course-card {
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid #e8e8ea;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(44, 62, 80, .06), 0 4px 14px rgba(44, 62, 80, .05);
	transition: transform .15s ease, box-shadow .15s ease;
}
.cgi-course-card:hover { transform: translateY(-2px); box-shadow: 0 2px 6px rgba(44, 62, 80, .08), 0 10px 24px rgba(44, 62, 80, .10); }

.cgi-course-media {
	position: relative;
	display: block;
	aspect-ratio: 1 / 1; /* overridden inline with the image's own ratio */
	background: linear-gradient(135deg, #2c3e50, #4b6584);
	overflow: hidden;
}
.cgi-course-media { background: #eef0f3; }
.cgi-course-media img { width: 100%; height: 100%; object-fit: cover; display: block; } /* the box already has the image's ratio: nothing to crop */
.cgi-course-media-fallback {
	position: absolute; inset: 0;
	display: flex; align-items: center; justify-content: center;
	font-size: 2.6em; opacity: .85;
}
.cgi-course-status {
	position: absolute; left: 8px; top: 8px;
	font-size: .66em; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
	padding: 3px 9px; border-radius: 999px; color: #fff; background: rgba(44, 62, 80, .85);
	backdrop-filter: blur(2px);
}
.cgi-course-status.cgi-status-in-progress { background: #f5b335; color: #2c3e50; }
.cgi-course-status.cgi-status-completed   { background: #2ecc71; color: #fff; }
.cgi-course-badge {
	position: absolute; right: 8px; top: 8px;
	font-size: .66em; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
	padding: 3px 9px; border-radius: 999px; background: #fff; color: #d02c2f; border: 1px solid #d02c2f;
}

.cgi-course-body { display: flex; flex-direction: column; flex: 1; padding: 12px 14px 14px; }
/* Astra sizes h4 in px with its own selectors: outweigh them (no !important). */
.woocommerce .cgi-course-card h4.cgi-course-title,
.cgi-dash .cgi-course-card h4.cgi-course-title {
	font-size: 15px; line-height: 1.2; margin: 0 0 8px; font-weight: 600; letter-spacing: 0;
}
.cgi-course-title a { color: #2c3e50; text-decoration: none; }
.cgi-course-title a:hover { color: #d02c2f; }

.cgi-course-progress { background: #eef0f3; border-radius: 8px; height: 8px; overflow: hidden; }
.cgi-course-progress span { display: block; height: 100%; background: #2ecc71; border-radius: 8px; transition: width .3s ease; }
.cgi-course-card.is-not-started .cgi-course-progress span { background: #cfd4da; }
.cgi-course-card.is-in-progress .cgi-course-progress span { background: #f5b335; }
.cgi-course-meta { color: #6b7280; font-size: .85em; margin: 6px 0 12px; }

.cgi-course-actions { margin-top: auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.woocommerce .cgi-course-actions .button.cgi-course-cta,
.woocommerce .cgi-detail-summary .button.cgi-course-cta {
	padding: 7px 14px; font-size: .88em; line-height: 1.2; border-radius: 6px;
}
.woocommerce button.cgi-course-details,
.woocommerce button.cgi-course-details:hover,
.woocommerce button.cgi-course-details:focus {
	background: #fff; border: 1px solid #d8dbe0; color: #2c3e50; border-radius: 6px;
	padding: 6px 12px; font-size: .85em; cursor: pointer; line-height: 1.2; box-shadow: none;
}
.woocommerce button.cgi-course-details:hover,
.woocommerce button.cgi-course-details:focus { border-color: #2c3e50; background: #f7f8fa; color: #2c3e50; }

.cgi-course-certs { margin-top: 12px; padding-top: 10px; border-top: 1px dashed #e3e5e8; font-size: .85em; display: flex; flex-direction: column; gap: 4px; }
.cgi-course-certs a { color: #2c3e50; text-decoration: none; }
.cgi-course-certs a:hover { color: #d02c2f; text-decoration: underline; }

.cgi-course-ended { font-size: .82em; color: #6b7280; font-style: italic; }
.cgi-course-card.is-past .cgi-course-media img { filter: grayscale(.35); opacity: .85; }
.cgi-cert-card.is-archived { background: #fafbfc; border-color: #e3e5e8; color: #6b7280; cursor: default; }
.cgi-cert-card.is-archived:hover { box-shadow: none; }

/* Compact (dashboard) */
.cgi-course-card.is-compact .cgi-course-body { padding: 12px 14px 14px; }

/* ───────────────────────────── MMS offer cards ────────────────────── */

.cgi-course-status.cgi-status-offer  { background: #d02c2f; color: #fff; }
.cgi-course-status.cgi-status-locked { background: rgba(107, 114, 128, .9); color: #fff; }
.cgi-offer-card .cgi-offer-price { color: #2c3e50; font-weight: 600; }
.cgi-offer-card .cgi-offer-price .woocommerce-Price-amount { font-size: 1.15em; }
.cgi-offer-plan { font-size: .85em; color: #2c3e50; text-decoration: underline; }
.cgi-offer-plan:hover { color: #d02c2f; }
.cgi-offer-note { margin: 14px 0 0; font-size: .9em; color: #6b7280; }
.cgi-offer-note a { color: #d02c2f; text-decoration: none; font-weight: 600; }
.cgi-course-card.is-locked { background: #fafbfc; border-style: dashed; }
.cgi-course-card.is-locked .cgi-course-media img { filter: grayscale(1); opacity: .55; }
.cgi-course-card.is-locked .cgi-course-title a { color: #6b7280; }
.cgi-course-card.is-locked .cgi-offer-price { color: #2c3e50; }
.cgi-dash .cgi-mms-offer { margin-top: 28px; }
.cgi-dash .cgi-mms-offer h3 { margin-bottom: 4px; }

/* ───────────────────────────── Certificates ───────────────────────── */

.cgi-certs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 14px; }
.cgi-cert-card {
	display: flex; align-items: center; gap: 12px;
	padding: 12px 14px; border-radius: 10px; text-decoration: none;
	background: linear-gradient(135deg, #fff8e5, #fff);
	border: 1px solid #f0d9a0; color: #2c3e50;
	transition: box-shadow .15s ease;
}
.cgi-cert-card:hover { box-shadow: 0 4px 14px rgba(245, 179, 53, .25); }
.cgi-cert-ico { font-size: 1.6em; }
.cgi-cert-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.cgi-cert-title { font-weight: 600; font-size: .95em; line-height: 1.3; }
.cgi-cert-meta { color: #6b7280; font-size: .8em; margin-top: 2px; }
.cgi-cert-dl { font-size: .8em; font-weight: 600; color: #d02c2f; white-space: nowrap; }

/* ───────────────────────────── Modal ──────────────────────────────── */

.cgi-course-modal {
	width: min(680px, 94vw);
	max-height: 86vh;
	padding: 0;
	border: none;
	border-radius: 14px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
	overflow: hidden;
	display: none;
	flex-direction: column;
}
.cgi-course-modal[open] { display: flex; }
.cgi-course-modal::backdrop { background: rgba(44, 62, 80, .55); }
html.cgi-modal-open { overflow: hidden; }

.cgi-course-modal-head {
	display: flex; align-items: center; gap: 12px;
	padding: 16px 20px; background: #2c3e50; color: #fff;
}
.cgi-course-modal-head h3 { margin: 0; font-size: 1.05em; color: #fff; flex: 1; }
.cgi-course-modal-close {
	background: none; border: none; color: #fff; font-size: 1.6em; line-height: 1; cursor: pointer; padding: 0 4px;
}
.cgi-course-modal-body { padding: 18px 20px 22px; overflow-y: auto; }
.cgi-course-modal-body h4 { font-size: .8em; letter-spacing: .08em; text-transform: uppercase; color: #6b7280; margin: 20px 0 8px; }
.cgi-detail-summary { display: flex; flex-direction: column; gap: 6px; padding-bottom: 14px; border-bottom: 1px solid #eef0f3; }
.cgi-detail-summary .cgi-course-meta { margin: 0; }
.cgi-detail-summary .button { align-self: flex-start; margin-top: 6px; }

.cgi-steps, .cgi-substeps { list-style: none; margin: 0; padding: 0; }
.cgi-substeps { margin: 4px 0 6px 26px; }
.cgi-step { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 8px; padding: 5px 0; font-size: .95em; }
.cgi-step-lesson { display: block; border-bottom: 1px solid #f3f4f6; padding: 8px 0; }
.cgi-step-lesson > .cgi-step-ico { margin-right: 6px; }
.cgi-step-lesson > a { font-weight: 600; }
.cgi-step a { color: #2c3e50; text-decoration: none; }
.cgi-step a:hover { color: #d02c2f; }
.cgi-step-ico { width: 20px; display: inline-block; text-align: center; color: #b0b6bf; }
.cgi-step.is-done > a { color: #6b7280; }
.cgi-step-score { font-size: .8em; padding: 1px 8px; border-radius: 999px; background: #eef0f3; color: #2c3e50; }
.cgi-step-score.is-pass { background: #e6f8ee; color: #1e7e4a; }
.cgi-step-score.is-fail { background: #fdecec; color: #b0271e; }
.cgi-step-score.is-none { background: #f3f4f6; color: #9aa0a6; }
.cgi-step-attempts { font-size: .78em; color: #9aa0a6; }

/* ───────────────────────────── Gradebook (report card) ────────────── */

:root {
	--cgi-band-a: #27ae60; --cgi-band-a-soft: #e6f8ee;
	--cgi-band-b: #2a9d8f; --cgi-band-b-soft: #e3f4f2;
	--cgi-band-c: #f5b335; --cgi-band-c-soft: #fff6e0;
	--cgi-band-d: #e67e22; --cgi-band-d-soft: #fdeee0;
	--cgi-band-f: #d02c2f; --cgi-band-f-soft: #fde8e8;
	--cgi-band-none: #b0b6bf; --cgi-band-none-soft: #f3f4f6;
}
.is-band-a { --band: var(--cgi-band-a); --band-soft: var(--cgi-band-a-soft); }
.is-band-b { --band: var(--cgi-band-b); --band-soft: var(--cgi-band-b-soft); }
.is-band-c { --band: var(--cgi-band-c); --band-soft: var(--cgi-band-c-soft); }
.is-band-d { --band: var(--cgi-band-d); --band-soft: var(--cgi-band-d-soft); }
.is-band-f { --band: var(--cgi-band-f); --band-soft: var(--cgi-band-f-soft); }
.is-band-none { --band: var(--cgi-band-none); --band-soft: var(--cgi-band-none-soft); }

.cgi-gradebook {
	background: #fff; border: 1px solid #e8e8ea; border-radius: 14px; overflow: hidden;
	box-shadow: 0 1px 3px rgba(44, 62, 80, .06), 0 4px 14px rgba(44, 62, 80, .05);
	margin: 16px 0 24px;
}

/* Head: ring + title */
.cgi-gradebook-head {
	display: flex; align-items: center; gap: 22px; padding: 22px 24px;
	background: linear-gradient(135deg, #2c3e50 0%, #3d5570 100%); color: #fff;
}
.cgi-gradebook-ring { position: relative; flex: 0 0 104px; width: 104px; height: 104px; }
.cgi-gradebook-ring svg { transform: rotate(-90deg); display: block; }
.cgi-ring-track { fill: none; stroke: rgba(255, 255, 255, .18); stroke-width: 9; }
.cgi-ring-value { fill: none; stroke: var(--band); stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.cgi-ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.cgi-ring-letter { font-size: 1.7em; font-weight: 800; letter-spacing: -.02em; }
.cgi-ring-pct { font-size: .78em; opacity: .85; margin-top: 3px; }
.cgi-gradebook-title { min-width: 0; }
.cgi-gradebook-kicker { font-size: .72em; letter-spacing: .12em; text-transform: uppercase; opacity: .75; }
.woocommerce .cgi-gradebook-title h4 { color: #fff; font-size: 20px; line-height: 1.2; margin: 4px 0 6px; }
.cgi-gradebook-course { font-size: .9em; opacity: .9; }
.cgi-gradebook-meta { font-size: .8em; opacity: .7; margin-top: 6px; }

/* Component tiles (only with several components) */
.cgi-gradebook-components { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; padding: 16px 24px 0; }
.cgi-gradebook-component {
	display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: #2c3e50;
	border: 1px solid #e8e8ea; border-left: 4px solid var(--band); border-radius: 8px; padding: 10px 12px; background: var(--band-soft);
}
.cgi-gradebook-component-name { font-size: .85em; font-weight: 600; }
.cgi-gradebook-component-score { font-size: 1.2em; font-weight: 800; }
.cgi-gradebook-component-weight { font-size: .75em; color: #6b7280; }

/* Sections */
.cgi-gradebook-section { padding: 18px 24px 6px; }
.cgi-gradebook-section + .cgi-gradebook-section { border-top: 1px solid #f0f0f2; }
.cgi-gradebook-section-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.woocommerce .cgi-gradebook-section-head h5 { margin: 0; font-size: 15px; letter-spacing: .04em; text-transform: uppercase; color: #2c3e50; }
.cgi-gradebook-weight { font-size: .8em; color: #6b7280; }

.cgi-grade-chip {
	display: inline-block; font-size: .78em; font-weight: 700; line-height: 1; padding: 5px 9px; border-radius: 999px;
	background: var(--band-soft); color: var(--band); border: 1px solid var(--band);
	white-space: nowrap;
}
.cgi-grade-chip.is-band-c { color: #8a6100; }
.cgi-grade-chip.is-status { background: #f3f4f6; color: #6b7280; border-color: #e3e5e8; }

/* Rows */
.cgi-grade-list { list-style: none; margin: 0; padding: 0; }
.cgi-grade-row {
	display: grid; grid-template-columns: minmax(0, 1fr) 140px auto; align-items: center; gap: 14px;
	padding: 10px 0; border-top: 1px solid #f3f4f6;
}
.cgi-grade-row:first-child { border-top: none; }
.cgi-grade-name { min-width: 0; font-size: .95em; }
.cgi-grade-name a { color: #2c3e50; text-decoration: none; font-weight: 600; }
.cgi-grade-name a:hover { color: #d02c2f; }
.cgi-grade-sub { display: block; font-size: .78em; color: #6b7280; margin-top: 2px; }
.cgi-grade-bar { height: 8px; background: #eef0f3; border-radius: 8px; overflow: hidden; }
.cgi-grade-bar span { display: block; height: 100%; background: var(--band); border-radius: 8px; }
.cgi-grade-score { min-width: 78px; text-align: right; }

.cgi-gradebook-empty { margin: 0; padding: 14px 24px 18px; color: #6b7280; font-size: .92em; }

/* Foot */
.cgi-gradebook-foot { padding: 14px 24px 18px; background: #fafbfc; border-top: 1px solid #f0f0f2; }
.cgi-gradebook-legend { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.cgi-gradebook-legend li { font-size: .7em; color: #2c3e50; background: var(--band-soft); border-left: 3px solid var(--band); border-radius: 4px; padding: 3px 6px; white-space: nowrap; }
.cgi-gradebook-legend li b { margin-right: 2px; }
@media (min-width: 768px) { /* the whole scale on one line */
	.cgi-gradebook-legend { flex-wrap: nowrap; }
	.cgi-gradebook-legend li { flex: 1 1 0; min-width: 0; text-align: center; padding: 3px 2px; }
}
.cgi-gradebook-note { margin: 0; font-size: .8em; color: #6b7280; }

@media (max-width: 600px) {
	.cgi-gradebook-head { flex-direction: column; text-align: center; gap: 12px; padding: 18px; }
	.cgi-gradebook-section, .cgi-gradebook-components, .cgi-gradebook-foot { padding-left: 16px; padding-right: 16px; }
	.cgi-grade-row { grid-template-columns: minmax(0, 1fr) auto; }
	.cgi-grade-bar { grid-column: 1 / -1; }
}

/* ───────────────────────────── Phone ──────────────────────────────── */

@media (max-width: 480px) {
	.cgi-course-grid, .cgi-certs-grid { grid-template-columns: 1fr; }
	.cgi-course-modal { width: 100vw; max-height: 100vh; border-radius: 0; }
}
