/* ==========================================================================
   Course Creator — shared components for /lms, / (home) and /course_creator
   Built only on newstyle.css variables, so light and dark themes both work.
   ========================================================================== */

.ccx-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 18px;
}
.ccx-grid.ccx-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ccx-grid.ccx-four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.ccx-card {
	display: flex;
	flex-direction: column;
	gap: 10px;
	min-width: 0;
	padding: 24px;
	background: var(--bg-surface);
	border: 1px solid var(--border-card);
	border-radius: var(--radius-md);
	box-shadow: var(--card-shadow);
	transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.ccx-card:hover { transform: translateY(-4px); border-color: var(--brand-gold); box-shadow: var(--card-shadow-hover); }
.ccx-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ccx-ic {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	flex-shrink: 0;
	border-radius: var(--radius-sm);
	background: var(--bg-pill);
	color: var(--brand-blue);
	font-size: 19px;
}
.ccx-ic.gold { background: var(--brand-gold-bg); color: var(--brand-gold-text); }
.ccx-ic.green { background: var(--success-green-bg); color: var(--success-green); }
.ccx-card h3 { margin: 4px 0 0; font-family: var(--font-display); font-size: 17px; line-height: 1.3; color: var(--text-main); }
.ccx-card p { margin: 0; color: var(--text-muted); font-size: 13.5px; line-height: 1.6; }
.ccx-card ul { margin: 2px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.ccx-card li { position: relative; padding-left: 18px; color: var(--text-muted); font-size: 13px; line-height: 1.5; }
.ccx-card li::before { content: ""; position: absolute; left: 2px; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--brand-gold); }

.ccx-tag {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 4px 9px;
	border-radius: var(--radius-full);
	font-size: 10px;
	font-weight: 800;
	letter-spacing: .6px;
	text-transform: uppercase;
	white-space: nowrap;
	background: var(--bg-pill);
	color: var(--brand-blue);
	border: 1px solid var(--border-strong);
}
.ccx-tag.free { background: var(--success-green-bg); color: #087a56; border-color: rgba(16, 185, 129, .3); }
.ccx-tag.credits { background: var(--brand-gold-bg); color: var(--brand-gold-text); border-color: var(--brand-gold); }
[data-theme="dark"] .ccx-tag.free, :root:has(#theme-toggle:checked) .ccx-tag.free { color: #34d399; }

/* Pricing strip (one line summary of what costs what) */
.ccx-strip {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	margin-top: 26px;
	background: var(--bg-surface);
	border: 1px solid var(--border-card);
	border-top: 3px solid var(--brand-gold);
	border-radius: var(--radius-md);
	box-shadow: var(--card-shadow);
	overflow: hidden;
}
.ccx-strip > div { padding: 20px 22px; border-right: 1px solid var(--border-subtle); }
.ccx-strip > div:last-child { border-right: none; }
.ccx-strip strong { display: block; font-family: var(--font-display); font-size: 26px; font-weight: 800; line-height: 1.1; color: var(--brand-blue); }
.ccx-strip strong small { font-size: 13px; font-weight: 700; color: var(--text-muted); }
.ccx-strip span { display: block; margin-top: 6px; color: var(--text-muted); font-size: 12.5px; line-height: 1.5; }

.ccx-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 26px; }
.ccx-actions.center { justify-content: center; }
.ccx-fine { margin-top: 14px; color: var(--text-subtle); font-size: 12px; line-height: 1.6; }

/* Tables (rates and plan comparison) */
.ccx-table-wrap {
	width: 100%;
	overflow-x: auto;
	background: var(--bg-surface);
	border: 1px solid var(--border-card);
	border-radius: var(--radius-md);
	box-shadow: var(--card-shadow);
}
.ccx-table { width: 100%; border-collapse: collapse; font-size: 13.5px; color: var(--text-main); }
.ccx-table th, .ccx-table td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
.ccx-table thead th {
	background: var(--bg-surface-subtle);
	font-size: 11px;
	font-weight: 800;
	letter-spacing: .8px;
	text-transform: uppercase;
	color: var(--text-muted);
	white-space: nowrap;
}
.ccx-table tbody tr:last-child td, .ccx-table tbody tr:last-child th { border-bottom: none; }
.ccx-table tbody th { font-weight: 700; }
.ccx-plan-table tbody th { white-space: nowrap; }
.ccx-table td.num, .ccx-table th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ccx-table small { display: block; color: var(--text-muted); font-size: 11.5px; font-weight: 400; margin-top: 2px; }
.ccx-table .yes { color: var(--success-green); font-weight: 700; }
.ccx-table .no { color: var(--text-subtle); }
.ccx-table tr.ccx-hl td, .ccx-table tr.ccx-hl th { background: var(--brand-gold-bg); }
.ccx-plan-table { min-width: 860px; }
.ccx-plan-table thead th:not(:first-child) { text-align: center; }
.ccx-plan-table tbody td { text-align: center; }
.ccx-plan-table .plan-name { display: block; font-family: var(--font-display); font-size: 16px; color: var(--text-main); text-transform: none; letter-spacing: -.2px; }
.ccx-plan-table th.ccx-col-hl { background: var(--brand-gold-bg); color: var(--brand-gold-text); }
.ccx-plan-table td.ccx-col-hl { background: var(--brand-gold-bg); }

/* Two-column free vs credits */
.ccx-split { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 22px; align-items: start; }
.ccx-split > * { min-width: 0; }
.ccx-free-panel {
	padding: 26px;
	background: var(--success-green-bg);
	border: 1px solid rgba(16, 185, 129, .3);
	border-radius: var(--radius-md);
}
.ccx-free-panel h3, .ccx-paid-panel h3 { margin: 0 0 14px; font-family: var(--font-display); font-size: 19px; color: var(--text-main); display: flex; align-items: center; gap: 10px; }
.ccx-free-panel h3 i { color: var(--success-green); }
.ccx-paid-panel h3 i { color: var(--brand-gold-text); }
.ccx-free-panel ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.ccx-free-panel li { display: flex; gap: 10px; align-items: flex-start; color: var(--text-main); font-size: 14px; line-height: 1.5; }
.ccx-free-panel li i { color: var(--success-green); margin-top: 3px; }
.ccx-table-label { margin: 18px 0 8px; font-size: 11px; font-weight: 800; letter-spacing: .9px; text-transform: uppercase; color: var(--text-muted); }
.ccx-table-label:first-of-type { margin-top: 0; }

/* Numbered flow */
.ccx-flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; counter-reset: ccx; }
.ccx-flow > div {
	position: relative;
	padding: 24px 22px 22px;
	background: var(--bg-surface);
	border: 1px solid var(--border-card);
	border-radius: var(--radius-md);
	box-shadow: var(--card-shadow);
}
.ccx-flow > div::before {
	counter-increment: ccx;
	content: "0" counter(ccx);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 38px;
	height: 28px;
	padding: 0 8px;
	margin-bottom: 14px;
	border-radius: var(--radius-full);
	background: var(--brand-gold-bg);
	border: 1px solid var(--brand-gold);
	color: var(--brand-gold-text);
	font-size: 12px;
	font-weight: 800;
	letter-spacing: .5px;
}
.ccx-flow h3 { margin: 0 0 8px; font-family: var(--font-display); font-size: 17px; color: var(--text-main); }
.ccx-flow p { margin: 0; color: var(--text-muted); font-size: 13.5px; line-height: 1.6; }
.ccx-flow p strong { color: var(--text-main); }

/* Worked example ledger (dark panel) */
.ccx-ledger {
	display: grid;
	grid-template-columns: .9fr 1.1fr;
	gap: 40px;
	align-items: center;
	padding: 40px;
	background: var(--bg-dark-section);
	border-radius: var(--radius-lg);
	color: #dbe7fb;
	box-shadow: var(--card-shadow-hover);
}
.ccx-ledger h2 { margin: 10px 0 14px; font-family: var(--font-display); font-size: clamp(26px, 3vw, 38px); line-height: 1.12; letter-spacing: -1px; color: #fff; }
.ccx-ledger h2 em { font-family: var(--font-serif); font-style: italic; font-weight: 400; color: var(--brand-gold); }
.ccx-ledger > div > p { color: #a3b8db; font-size: 15px; line-height: 1.65; margin: 0; }
.ccx-ledger-rows { display: grid; gap: 0; background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .1); border-radius: var(--radius-md); overflow: hidden; }
.ccx-ledger-rows > div { display: flex; justify-content: space-between; gap: 16px; padding: 13px 18px; border-bottom: 1px solid rgba(255, 255, 255, .08); font-size: 14px; }
.ccx-ledger-rows > div:last-child { border-bottom: none; }
.ccx-ledger-rows span small { display: block; color: #8ea3c4; font-size: 11.5px; margin-top: 2px; }
.ccx-ledger-rows b { font-variant-numeric: tabular-nums; white-space: nowrap; color: #fff; }
.ccx-ledger-rows .in b { color: #34d399; }
.ccx-ledger-rows .out b { color: #fca5a5; }
.ccx-ledger-rows .zero b { color: #a3b8db; }
.ccx-ledger-rows .total { background: rgba(254, 189, 48, .12); }
.ccx-ledger-rows .total b, .ccx-ledger-rows .total span { color: var(--brand-gold); font-weight: 800; }

/* Callout */
.ccx-note {
	display: flex;
	gap: 14px;
	align-items: flex-start;
	margin-top: 22px;
	padding: 18px 20px;
	background: var(--brand-gold-bg);
	border: 1px solid var(--brand-gold);
	border-radius: var(--radius-md);
	color: var(--text-main);
	font-size: 14px;
	line-height: 1.6;
}
.ccx-note > i { color: var(--brand-gold-text); font-size: 20px; margin-top: 2px; }

/* Simple FAQ (native details/summary, no script needed) */
.ccx-faq { display: grid; gap: 10px; max-width: 860px; margin: 0 auto; }
.ccx-faq details { background: var(--bg-surface); border: 1px solid var(--border-card); border-radius: var(--radius-md); box-shadow: var(--card-shadow); }
.ccx-faq summary {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
	padding: 18px 22px;
	cursor: pointer;
	list-style: none;
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 15.5px;
	color: var(--text-main);
}
.ccx-faq summary::-webkit-details-marker { display: none; }
.ccx-faq summary::after { content: "+"; font-size: 22px; font-weight: 400; color: var(--brand-blue); transition: transform var(--transition-fast); }
.ccx-faq details[open] summary::after { transform: rotate(45deg); }
.ccx-faq details p { margin: 0; padding: 0 22px 20px; color: var(--text-muted); font-size: 14px; line-height: 1.65; }

@media (max-width: 1080px) {
	.ccx-grid, .ccx-grid.ccx-four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.ccx-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.ccx-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.ccx-strip > div:nth-child(2) { border-right: none; }
	.ccx-strip > div:nth-child(-n+2) { border-bottom: 1px solid var(--border-subtle); }
	.ccx-split, .ccx-ledger { grid-template-columns: minmax(0, 1fr); }
	.ccx-ledger > * { min-width: 0; }
}
@media (max-width: 640px) {
	.ccx-grid, .ccx-grid.ccx-two, .ccx-grid.ccx-four, .ccx-flow, .ccx-strip { grid-template-columns: minmax(0, 1fr); }
	.ccx-strip > div { border-right: none; border-bottom: 1px solid var(--border-subtle); }
	.ccx-strip > div:last-child { border-bottom: none; }
	.ccx-ledger { padding: 26px 20px; gap: 24px; }
	.ccx-card, .ccx-free-panel { padding: 20px; }
	.ccx-table th, .ccx-table td { padding: 11px 12px; }
}
