/*
 * AIS Course Manager — front-end styles.
 * Design principle: inherit the active theme's fonts and colors wherever possible.
 * Only structural layout (grid, spacing) and subtle affordances are defined here.
 * Accent colors fall back to the theme link color via currentColor where practical.
 */

.aiscm { font-family: inherit; color: inherit; }
.aiscm * { box-sizing: border-box; }

/* ---------- Buttons ---------- */
.aiscm-btn {
	display: inline-block;
	padding: 0.55em 1.2em;
	border: 1px solid currentColor;
	border-radius: 6px;
	background: transparent;
	color: inherit;
	text-decoration: none;
	font: inherit;
	cursor: pointer;
	line-height: 1.4;
}
.aiscm-btn:hover { opacity: 0.8; text-decoration: none; }
.aiscm-btn-primary {
	background: var(--wp--preset--color--primary, #002657);
	border-color: var(--wp--preset--color--primary, #002657);
	color: #fff;
}
.aiscm-btn-primary:hover { color: #fff; }

/* ---------- Notices ---------- */
.aiscm-notice { padding: 0.8em 1em; border-radius: 6px; margin: 1em 0; border: 1px solid; }
.aiscm-notice-success { border-color: #2e7d32; background: rgba(46,125,50,0.08); }
.aiscm-notice-warn { border-color: #b26a00; background: rgba(178,106,0,0.08); }
.aiscm-notice-error { border-color: #c62828; background: rgba(198,40,40,0.08); }

/* ---------- Course landing ---------- */
.aiscm-meta-strip { display: flex; flex-wrap: wrap; gap: 1.2em; margin: 0.5em 0 1em; font-size: 0.95em; opacity: 0.9; }
.aiscm-enroll-box { border: 1px solid rgba(0,0,0,0.15); border-radius: 10px; padding: 1.2em; margin: 1em 0 1.5em; }
.aiscm-price { font-size: 1.6em; font-weight: 700; margin-bottom: 0.4em; }
.aiscm-price del { opacity: 0.5; font-weight: 400; font-size: 0.8em; margin-right: 0.3em; }
.aiscm-fineprint { font-size: 0.85em; opacity: 0.7; margin: 0.6em 0 0; }
.aiscm-panel { border: 1px solid rgba(0,0,0,0.12); border-radius: 8px; margin: 0.6em 0; padding: 0; }
.aiscm-panel summary { cursor: pointer; font-weight: 600; padding: 0.7em 1em; }
.aiscm-panel > div { padding: 0 1em 0.8em; }
.aiscm-h2 { margin-top: 1.4em; }

/* ---------- Progress ---------- */
.aiscm-progress-wrap { margin: 0.6em 0; }
.aiscm-progress-label { font-size: 0.85em; margin-bottom: 0.3em; opacity: 0.85; }
.aiscm-progress-bar { height: 8px; border-radius: 4px; background: rgba(0,0,0,0.1); overflow: hidden; }
.aiscm-progress-bar span { display: block; height: 100%; background: var(--wp--preset--color--primary, #002657); border-radius: 4px; transition: width 0.4s; }

/* ---------- Player layout ---------- */
.aiscm-player { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 2em; align-items: start; }
.aiscm-sidebar { border: 1px solid rgba(0,0,0,0.12); border-radius: 10px; padding: 1em; position: sticky; top: 2em; max-height: calc(100vh - 4em); overflow-y: auto; }
.aiscm-sidebar-head { border-bottom: 1px solid rgba(0,0,0,0.1); margin-bottom: 0.8em; padding-bottom: 0.8em; }
.aiscm-sidebar-course { font-weight: 700; text-decoration: none; color: inherit; }
.aiscm-sidebar-toggle { display: none; }
.aiscm-main { min-width: 0; }
.aiscm-breadcrumb { font-size: 0.9em; opacity: 0.8; }
.aiscm-breadcrumb a { color: inherit; }

/* ---------- Curriculum list ---------- */
.aiscm-curriculum { font-size: 0.95em; }
.aiscm-section { margin-bottom: 0.9em; }
.aiscm-section-title { font-weight: 700; margin-bottom: 0.3em; font-size: 0.9em; text-transform: uppercase; letter-spacing: 0.03em; opacity: 0.75; }
.aiscm-curriculum ul { list-style: none; margin: 0; padding: 0; }
.aiscm-curriculum li { margin: 0; }
.aiscm-item a, .aiscm-item-locked { display: flex; align-items: center; gap: 0.5em; padding: 0.45em 0.5em; border-radius: 6px; text-decoration: none; color: inherit; }
.aiscm-item a:hover { background: rgba(0,0,0,0.05); }
.aiscm-item-current > a { background: rgba(0,0,0,0.07); font-weight: 600; }
.aiscm-item-icon { font-size: 0.7em; opacity: 0.6; width: 1.2em; }
.aiscm-item-title { flex: 1; }
.aiscm-check { color: #2e7d32; font-weight: 700; width: 1.2em; text-align: center; }
.aiscm-check-empty::before { content: "○"; opacity: 0.35; }
.aiscm-item-done .aiscm-item-title { opacity: 0.75; }
.aiscm-lock { font-size: 0.8em; opacity: 0.6; }

/* ---------- Video ---------- */
.aiscm-video { margin: 1em 0; }
.aiscm-embed-responsive { position: relative; padding-bottom: 56.25%; height: 0; }
.aiscm-embed-responsive iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 8px; }
.aiscm-video video { width: 100%; border-radius: 8px; }

/* ---------- Lesson completion ---------- */
.aiscm-complete-box { border-top: 1px solid rgba(0,0,0,0.1); margin-top: 2em; padding-top: 1.2em; }
.aiscm-complete-box input[type="text"] { padding: 0.5em; border: 1px solid rgba(0,0,0,0.25); border-radius: 6px; font: inherit; }
.aiscm-complete-done { color: #2e7d32; font-weight: 700; }
.aiscm-complete-msg { margin-left: 0.8em; font-size: 0.9em; }
.aiscm-complete-msg.error { color: #c62828; }
.aiscm-complete-msg.success { color: #2e7d32; }

/* ---------- Prev / next ---------- */
.aiscm-prevnext { display: flex; justify-content: space-between; gap: 1em; margin-top: 2em; flex-wrap: wrap; }

/* ---------- Quiz ---------- */
.aiscm-final-badge { font-weight: 600; }
.aiscm-quiz-meta { display: flex; flex-wrap: wrap; gap: 1.2em; font-size: 0.9em; opacity: 0.85; margin: 0.8em 0 1.2em; }
.aiscm-quiz-timer { position: sticky; top: 0.5em; display: inline-block; padding: 0.4em 0.9em; border-radius: 6px; background: var(--wp--preset--color--primary, #002657); color: #fff; font-weight: 700; z-index: 5; }
.aiscm-question { border: 1px solid rgba(0,0,0,0.12); border-radius: 10px; padding: 1em 1.2em; margin: 0 0 1.2em; }
.aiscm-question legend { font-weight: 600; padding: 0 0.3em; }
.aiscm-qno { opacity: 0.6; margin-right: 0.2em; }
.aiscm-answer { display: flex; align-items: flex-start; gap: 0.6em; padding: 0.45em 0.4em; border-radius: 6px; cursor: pointer; }
.aiscm-answer:hover { background: rgba(0,0,0,0.04); }
.aiscm-answer input { margin-top: 0.3em; }
#aiscm-quiz-result h3 { margin-top: 0; }

/* ---------- Quiz answer review (post-submission) ---------- */
.aiscm-quiz-review { margin-top: 1.5em; }
.aiscm-quiz-review h3 { margin-bottom: 0.75em; }
.aiscm-review-question { border: 1px solid rgba(0,0,0,0.12); border-radius: 8px; padding: 0.9em 1.1em; margin-bottom: 1em; background: rgba(0,0,0,0.02); }
.aiscm-review-question.is-correct { border-left: 4px solid #2e7d32; }
.aiscm-review-question.is-incorrect { border-left: 4px solid #c62828; }
.aiscm-review-qtext { margin: 0 0 0.6em; }
.aiscm-review-badge { display: inline-block; font-size: 0.78em; font-weight: 700; padding: 0.1em 0.6em; border-radius: 999px; margin-left: 0.5em; vertical-align: middle; white-space: nowrap; }
.aiscm-review-badge.badge-correct { background: #e8f5e9; color: #2e7d32; }
.aiscm-review-badge.badge-incorrect { background: #ffebee; color: #c62828; }
.aiscm-review-answers { list-style: none; margin: 0; padding: 0; }
.aiscm-review-answers li { padding: 0.5em 0.8em; border-radius: 6px; margin-bottom: 0.35em; border: 1px solid transparent; }
.aiscm-review-answers li.answer-correct { background: #e8f5e9; border-color: #a5d6a7; color: #1b5e20; font-weight: 600; } /* green: correct answer */
.aiscm-review-answers li.answer-wrong { background: #ffebee; border-color: #ef9a9a; color: #b71c1c; text-decoration: line-through; } /* red: incorrect submitted answer */
.aiscm-review-answers .aiscm-your-answer { font-size: 0.85em; opacity: 0.75; text-decoration: none; font-style: italic; }

/* ---------- Search bar / archive ---------- */
.aiscm-search-bar { display: flex; flex-wrap: wrap; gap: 0.6em; margin: 1em 0 1.5em; }
.aiscm-search-bar input[type="search"], .aiscm-search-bar input[type="text"] { flex: 1 1 220px; padding: 0.55em 0.8em; border: 1px solid rgba(0,0,0,0.25); border-radius: 6px; font: inherit; }
.aiscm-search-bar select { padding: 0.55em 0.6em; border: 1px solid rgba(0,0,0,0.25); border-radius: 6px; font: inherit; }
.aiscm-card-meta { font-size: 0.9em; opacity: 0.9; }

/* ---------- My courses ---------- */
.aiscm-mycourse-card { display: flex; gap: 1.2em; border: 1px solid rgba(0,0,0,0.12); border-radius: 10px; padding: 1em; margin-bottom: 1em; align-items: flex-start; }
.aiscm-mycourse-thumb img { width: 160px; height: auto; border-radius: 8px; display: block; }
.aiscm-mycourse-body { flex: 1; min-width: 0; }
.aiscm-mycourse-body h3 { margin: 0 0 0.3em; }
.aiscm-mycourse-body h3 a { text-decoration: none; color: inherit; }
.aiscm-mycourse-actions { margin: 0.6em 0 0; }

/* ---------- Locked ---------- */
.aiscm-locked { text-align: center; padding: 2.5em 1em; border: 1px dashed rgba(0,0,0,0.25); border-radius: 10px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
	.aiscm-player { grid-template-columns: 1fr; }
	.aiscm-sidebar { display: none; position: static; max-height: none; }
	.aiscm-sidebar.open { display: block; }
	.aiscm-sidebar-toggle {
		display: inline-block;
		margin-bottom: 1em;
		padding: 0.5em 1em;
		border: 1px solid currentColor;
		border-radius: 6px;
		background: transparent;
		color: inherit;
		font: inherit;
		cursor: pointer;
	}
	.aiscm-mycourse-card { flex-direction: column; }
	.aiscm-mycourse-thumb img { width: 100%; }
}
