/* TheMostHub Classroom — หน้านักเรียน
   ทุก selector อยู่ใต้ .tmc-app เพื่อไม่ให้ชนกับสไตล์ของธีม WordPress */

.tmc-app {
	--tmc-brand: #1a56db;
	--tmc-brand-dark: #1240ab;
	--tmc-brand-light: #ebf0ff;
	--tmc-success: #10b981;
	--tmc-danger: #ef4444;
	--tmc-warn: #f59e0b;
	--tmc-text: #1e293b;
	--tmc-muted: #64748b;
	--tmc-border: #e2e8f0;
	--tmc-radius: 14px;
	--tmc-radius-sm: 10px;

	font-family: 'Sarabun', 'IBM Plex Sans Thai', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	color: var(--tmc-text);
	font-size: 15px;
	line-height: 1.6;
	max-width: 1100px;
	margin: 0 auto;
	box-sizing: border-box;
}
.tmc-app *, .tmc-app *::before, .tmc-app *::after { box-sizing: border-box; }
.tmc-app [hidden] { display: none !important; }
.tmc-app h2, .tmc-app h3 { margin: 0 0 8px; line-height: 1.3; color: inherit; }
.tmc-app p { margin: 0 0 8px; }

/* ─── ปุ่ม ─── */
.tmc-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	border: none; cursor: pointer; border-radius: var(--tmc-radius-sm);
	font-family: inherit; font-size: 15px; font-weight: 600;
	padding: 12px 22px; transition: all .18s ease; text-decoration: none;
	line-height: 1.2;
}
.tmc-btn-primary { background: var(--tmc-brand); color: #fff; box-shadow: 0 4px 14px rgba(26,86,219,.3); }
.tmc-btn-primary:hover { background: var(--tmc-brand-dark); transform: translateY(-1px); }
.tmc-btn-outline { background: transparent; color: var(--tmc-brand); border: 2px solid var(--tmc-brand); }
.tmc-btn-outline:hover { background: var(--tmc-brand-light); }
.tmc-btn-ghost {
	background: rgba(255,255,255,.1); color: inherit; border: 1px solid var(--tmc-border);
	padding: 8px 16px; font-size: 14px;
}
.tmc-btn-full { width: 100%; margin-top: 12px; }
.tmc-btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }

/* ─── ลิงก์เข้าระบบจัดการสำหรับครู ─── */
.tmc-adminbar { display: flex; justify-content: flex-end; padding-top: 6px; }
.tmc-admin-link {
	display: inline-flex; align-items: center; gap: 6px;
	font-size: 13px; font-weight: 500; text-decoration: none;
	color: var(--tmc-muted);
	background: transparent;
	border: 1px solid var(--tmc-border);
	border-radius: 99px;
	padding: 6px 15px;
	transition: all .18s ease;
}
.tmc-admin-link:hover,
.tmc-admin-link:focus-visible {
	color: var(--tmc-brand);
	border-color: var(--tmc-brand);
	background: var(--tmc-brand-light);
	text-decoration: none;
}
.tmc-admin-link:focus-visible { outline: 2px solid var(--tmc-brand); outline-offset: 2px; }

/* ─── เข้าสู่ระบบ ─── */
.tmc-login { max-width: 440px; margin: 0 auto; padding: 10px 0 24px; }
.tmc-login-head { text-align: center; margin-bottom: 22px; }
.tmc-logo {
	width: 68px; height: 68px; background: var(--tmc-brand-light); border-radius: 20px;
	display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; font-size: 32px;
}
.tmc-login-head p { color: var(--tmc-muted); font-size: 14px; }
.tmc-card {
	background: #fff; border: 1px solid var(--tmc-border); border-radius: var(--tmc-radius);
	padding: 28px 24px; box-shadow: 0 4px 24px rgba(26,86,219,.08);
}
.tmc-label { font-weight: 600; font-size: 14px; display: block; margin-bottom: 6px; }
.tmc-input {
	padding: 12px 16px; border: 2px solid var(--tmc-border); border-radius: var(--tmc-radius-sm);
	font-family: inherit; font-size: 16px; background: #f8faff; width: 100%;
	outline: none; transition: border .2s, box-shadow .2s; color: var(--tmc-text);
}
.tmc-input:focus { border-color: var(--tmc-brand); box-shadow: 0 0 0 4px rgba(26,86,219,.1); background: #fff; }

.tmc-alert { padding: 12px 16px; border-radius: var(--tmc-radius-sm); font-size: 14px; margin-top: 12px; font-weight: 500; }
.tmc-alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

/* ─── แถบหัว ─── */
.tmc-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.tmc-h2 { font-size: 1.25rem; }
.tmc-chip {
	background: var(--tmc-brand-light); color: var(--tmc-brand); padding: 5px 14px;
	border-radius: 99px; font-size: 13px; font-weight: 600; display: inline-block;
}

/* ─── รายการวิดีโอ ─── */
.tmc-list { display: flex; flex-direction: column; gap: 12px; }
.tmc-item {
	display: flex; align-items: center; gap: 16px; padding: 16px 18px; width: 100%;
	border-radius: var(--tmc-radius-sm); border: 2px solid var(--tmc-border);
	background: #f8faff; cursor: pointer; transition: all .2s; text-align: left;
	font-family: inherit; color: inherit;
}
.tmc-item:hover { border-color: var(--tmc-brand); background: var(--tmc-brand-light); transform: translateX(3px); }
.tmc-item.is-done { border-color: var(--tmc-success); background: #f0fdf4; }
.tmc-thumb {
	width: 50px; height: 50px; border-radius: 10px; display: flex; align-items: center;
	justify-content: center; font-size: 22px; flex-shrink: 0; background: #f3e8ff;
}
.tmc-thumb.math { background: #dbeafe; }
.tmc-thumb.sci  { background: #d1fae5; }
.tmc-thumb.eng  { background: #fef3c7; }
.tmc-item-body { flex: 1; min-width: 0; }
.tmc-item-title { font-weight: 700; font-size: 15px; margin-bottom: 3px; }
.tmc-item-meta { font-size: 12px; color: var(--tmc-muted); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.tmc-tag-assigned { background: #fef3c7; color: #92400e; font-weight: 700; padding: 2px 9px; border-radius: 99px; font-size: 11px; }
.tmc-badge { padding: 3px 11px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tmc-badge-success { background: #d1fae5; color: #065f46; }
.tmc-badge-muted { background: #f1f5f9; color: var(--tmc-muted); }
.tmc-badge-info { background: #dbeafe; color: #1e40af; }
.tmc-badge-warn { background: #fef3c7; color: #92400e; }
.tmc-hint { font-size: 13px; color: var(--tmc-muted); text-align: center; margin-top: 18px; }
.tmc-empty { text-align: center; padding: 40px 20px; color: var(--tmc-muted); }

/* ─── หน้าดูวิดีโอ ─── */
.tmc-watch { background: #0b0f1a; color: #e2e8f0; border-radius: var(--tmc-radius); padding: 18px; }
.tmc-watch .tmc-bar { border-bottom: 1px solid rgba(255,255,255,.1); padding-bottom: 14px; }
.tmc-watch-title { flex: 1; font-weight: 700; font-size: 15px; min-width: 0; }
.tmc-watch .tmc-btn-ghost { border-color: rgba(255,255,255,.18); color: #e2e8f0; }
.tmc-watch .tmc-btn-ghost:hover { background: rgba(255,255,255,.16); }

.tmc-player-wrap {
	background: #000; border-radius: 12px; overflow: hidden; position: relative;
	aspect-ratio: 16/9; box-shadow: 0 8px 40px rgba(0,0,0,.5);
}
.tmc-player-wrap:fullscreen { border-radius: 0; width: 100vw; height: 100vh; aspect-ratio: auto; }
.tmc-player-wrap.is-fakefs {
	position: fixed !important; inset: 0 !important; width: 100vw !important; height: 100vh !important;
	z-index: 99999 !important; border-radius: 0 !important; aspect-ratio: auto;
}
#tmc-player { width: 100%; height: 100%; }
#tmc-player iframe { width: 100%; height: 100%; display: block; }

/* ทับแถบควบคุมของ YouTube ไว้ทั้งหมด เพื่อกันการลากกรอข้าม */
.tmc-seek-blocker { position: absolute; inset: 0; z-index: 5; cursor: pointer; }
.tmc-overlay {
	position: absolute; inset: 0; z-index: 10; background: rgba(0,0,0,.72);
	backdrop-filter: blur(3px); display: flex; flex-direction: column; align-items: center;
	justify-content: center; gap: 14px; text-align: center; padding: 20px;
	opacity: 0; pointer-events: none; transition: opacity .25s;
}
.tmc-overlay.is-open { opacity: 1; pointer-events: all; }
.tmc-overlay h3 { color: #fff; font-size: 1.15rem; }
.tmc-overlay p { color: rgba(255,255,255,.75); font-size: 14px; }
.tmc-play-big {
	width: 68px; height: 68px; border-radius: 50%; background: var(--tmc-brand); border: none;
	cursor: pointer; display: flex; align-items: center; justify-content: center;
	font-size: 26px; color: #fff; box-shadow: 0 6px 24px rgba(26,86,219,.5); transition: transform .2s;
}
.tmc-play-big:hover { transform: scale(1.08); }
.tmc-fs-btn {
	position: absolute; top: 12px; right: 12px; z-index: 20; background: rgba(0,0,0,.6);
	color: #fff; border: 1px solid rgba(255,255,255,.2); border-radius: 8px;
	width: 38px; height: 38px; font-size: 18px; cursor: pointer;
	display: flex; align-items: center; justify-content: center;
}
.tmc-fs-btn:hover { background: rgba(0,0,0,.85); }

.tmc-progress-row { display: flex; justify-content: space-between; align-items: center; margin: 18px 0 8px; }
.tmc-progress-label { font-size: 13px; font-weight: 600; color: rgba(255,255,255,.7); }
.tmc-progress-pct { font-size: 14px; font-weight: 700; color: #60a5fa; }
.tmc-progress-track { background: rgba(255,255,255,.12); border-radius: 99px; height: 8px; overflow: hidden; }
.tmc-progress-bar { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--tmc-brand), #60a5fa); transition: width .4s ease; }
.tmc-progress-bar.is-done { background: var(--tmc-success); }

#tmc-doc-row { margin-top: 16px; }
.tmc-watch .tmc-btn-outline { color: #93c5fd; border-color: #3b82f6; background: rgba(59,130,246,.08); }
.tmc-watch .tmc-btn-outline:hover { background: rgba(59,130,246,.2); }

.tmc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.tmc-stat { background: #1e2540; border-radius: 12px; padding: 13px 15px; border: 1px solid rgba(255,255,255,.1); }
.tmc-stat-l { font-size: 11px; color: rgba(255,255,255,.5); font-weight: 600; letter-spacing: .4px; margin-bottom: 4px; }
.tmc-stat-v { font-size: 1.35rem; font-weight: 700; color: #fff; }
.tmc-stat-v.is-done { color: var(--tmc-success); }

.tmc-rules { margin-top: 24px; }
.tmc-rules h3 { color: #fff; font-size: 1rem; margin-bottom: 14px; }
.tmc-rule {
	display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 10px;
	background: #1e2540; border: 1px solid rgba(255,255,255,.1); margin-bottom: 10px;
	font-size: 13px; color: rgba(255,255,255,.75); line-height: 1.55;
}
.tmc-rule strong { color: #fff; }
.tmc-log {
	background: #141827; border-radius: 10px; border: 1px solid rgba(255,255,255,.1);
	padding: 12px 14px; max-height: 200px; overflow-y: auto;
	font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: rgba(255,255,255,.6);
}
.tmc-log p { margin: 0 0 4px; }
.tmc-log p.warn { color: #fbbf24; }
.tmc-log p.success { color: #34d399; }
.tmc-log p.info { color: #60a5fa; }

/* ─── ตัวหมุนโหลด + กล่องข้อความ ─── */
.tmc-spin {
	width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.3);
	border-top-color: currentColor; border-radius: 50%; animation: tmc-spin .7s linear infinite;
	display: inline-block;
}
@keyframes tmc-spin { to { transform: rotate(360deg); } }
.tmc-skeleton {
	height: 82px; border-radius: var(--tmc-radius-sm); margin-bottom: 12px;
	background: linear-gradient(90deg,#e2e8f0 25%,#f1f5f9 50%,#e2e8f0 75%);
	background-size: 200% 100%; animation: tmc-shimmer 1.4s infinite;
}
@keyframes tmc-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.tmc-modal {
	position: fixed; inset: 0; background: rgba(15,23,42,.6); backdrop-filter: blur(3px);
	display: flex; align-items: center; justify-content: center; z-index: 100000; padding: 20px;
}
.tmc-modal-box {
	background: #fff; color: var(--tmc-text); border-radius: var(--tmc-radius);
	padding: 30px 26px; max-width: 400px; width: 100%; text-align: center;
	box-shadow: 0 20px 60px rgba(0,0,0,.3);
	font-family: 'Sarabun', -apple-system, BlinkMacSystemFont, sans-serif;
}
.tmc-modal-icon { font-size: 46px; margin-bottom: 10px; }
.tmc-modal-box h3 { font-size: 1.2rem; }
.tmc-modal-box p { color: var(--tmc-muted); font-size: 14px; }

@media (max-width: 640px) {
	.tmc-stats { grid-template-columns: 1fr; }
	.tmc-watch { padding: 12px; border-radius: 10px; }
	.tmc-item { gap: 12px; padding: 13px 14px; }
	.tmc-bar { gap: 10px; }
}
