/**
 * DA Mock Interview — style RIÊNG của module DMI.
 * Tokens, wrap, grid, card base, button base: kế thừa từ dqh-shared.css.
 */

/* ---------- Landing grid (base trong dqh-shared.css) ---------- */

.dmi-grid {
	gap: 18px;
	margin-top: 16px;
}

.dmi-card {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.dmi-card.is-disabled {
	opacity: .75;
}

.dmi-card.is-clickable {
	cursor: pointer;
}

.dmi-card-icon {
	width: 44px;
	height: 44px;
	border-radius: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--dqh-accent-soft);
	color: var(--dqh-accent);
	font-size: 20px;
}

.dmi-card-title {
	margin: 0;
	font-size: 17px;
	font-weight: 700;
}

.dmi-card-desc {
	margin: 0;
	font-size: 13.5px;
	color: #6b7280;
	flex: 1;
}

.dmi-badge {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 11.5px;
	font-weight: 600;
	padding: 3px 9px;
	border-radius: 999px;
	width: fit-content;
}

.dmi-badge-premium {
	background: #fef3c7;
	color: #92400e;
}

.dmi-countdown-note {
	font-size: 12px;
	color: #6b7280;
}

.dmi-empty {
	color: #6b7280;
}

/* ---------- Buttons (base trong dqh-shared.css) ---------- */

.dmi-btn {
	border-color: #d1d5db;
	background: #fff;
	color: #374151;
}

.dmi-btn:hover {
	border-color: var(--dqh-accent);
	color: var(--dqh-accent);
}

.dmi-btn-primary {
	background: var(--dqh-accent);
	border-color: var(--dqh-accent);
	color: #fff;
}

.dmi-btn-primary:hover {
	filter: brightness(1.08);
	color: #fff;
}

.dmi-btn-outline {
	border-color: var(--dqh-accent);
	color: var(--dqh-accent);
}

.dmi-btn-danger {
	background: #dc2626;
	border-color: #dc2626;
	color: #fff;
}

.dmi-btn-danger:hover {
	filter: brightness(1.08);
	color: #fff;
}

.dmi-btn-disabled,
.dmi-btn-disabled:hover {
	background: #f3f4f6;
	border-color: #e5e7eb;
	color: #9ca3af;
	cursor: not-allowed;
}

.dmi-btn-locked {
	border-color: #f59e0b;
	color: #b45309;
}

/* ---------- Resume banner ---------- */

.dmi-resume-banner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	background: var(--dqh-accent-soft);
	border: 1px solid var(--dqh-accent);
	border-radius: 10px;
	padding: 12px 16px;
	margin-bottom: 16px;
	font-weight: 600;
}

/* ---------- Phòng phỏng vấn ---------- */

/* Hướng dẫn tính năng phía trên grid card. */
.dmi-intro {
	background: #fff;
	border: 1px solid var(--dqh-border, #e5e7eb);
	border-radius: 12px;
	padding: 16px 22px;
	margin: 16px 0 4px;
	font-size: 14px;
	line-height: 1.6;
	color: #374151;
}

.dmi-intro-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.dmi-intro-title {
	margin: 0;
	font-size: 14.5px;
	font-weight: 700;
	color: var(--dqh-accent, #2563eb);
}

.dmi-intro-toggle {
	background: none;
	border: none;
	padding: 2px 6px;
	font-size: 12.5px;
	font-weight: 600;
	color: var(--dqh-accent, #2563eb);
	cursor: pointer;
	white-space: nowrap;
}

.dmi-intro-toggle:hover {
	text-decoration: underline;
}

.dmi-intro-body {
	margin-top: 10px;
}

.dmi-intro.is-collapsed .dmi-intro-body {
	display: none;
}

.dmi-intro-step {
	margin: 0 0 6px;
	font-weight: 600;
	color: #1f2937;
}

.dmi-intro-detail {
	margin: 0 0 6px;
	padding-left: 16px;
	color: #4b5563;
}

.dmi-room {
	display: grid;
	grid-template-columns: 1fr 260px;
	gap: 18px;
	margin-top: 16px;
}

/* Phòng phỏng vấn mở = full màn hình: 1 cột duy nhất, chat chiếm trọn chiều rộng.
   Panel (tiêu đề / số lượt / đồng hồ / nút kết thúc) thành thanh ngang phía trên. */
.dmi-wrap.is-room-open .dmi-room {
	grid-template-columns: 1fr;
	max-width: none;
}

.dmi-wrap.is-room-open .dmi-room-panel {
	order: -1;
	flex-direction: row;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 10px 16px;
	padding: 12px 18px;
}

.dmi-wrap.is-room-open .dmi-timer {
	font-size: 18px;
	padding: 4px 14px;
}

.dmi-wrap.is-room-open .dmi-messages {
	min-height: 56vh;
	max-height: 72vh;
}

.dmi-wrap.is-room-open .dmi-bubble {
	max-width: 74%;
}

@media (max-width: 900px) {
	.dmi-room {
		grid-template-columns: 1fr;
	}
}

.dmi-room-chat {
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	overflow: hidden;
}

.dmi-messages {
	flex: 1;
	min-height: 420px;
	max-height: 62vh;
	overflow-y: auto;
	padding: 18px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	background: #f9fafb;
}

.dmi-bubble {
	max-width: 82%;
	padding: 10px 14px;
	border-radius: 12px;
	font-size: 14.5px;
	line-height: 1.55;
}

.dmi-bubble-role {
	font-size: 11.5px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .04em;
	margin-bottom: 4px;
	opacity: .75;
}

.dmi-bubble-m1 {
	align-self: flex-start;
	background: #eff6ff;
	border: 1px solid #bfdbfe;
}

.dmi-bubble-m1 .dmi-bubble-role { color: #1d4ed8; }

.dmi-bubble-m2 {
	align-self: flex-start;
	background: #fef2f2;
	border: 1px solid #fecaca;
}

.dmi-bubble-m2 .dmi-bubble-role { color: #b91c1c; }

.dmi-bubble-user {
	align-self: flex-end;
	background: var(--dqh-accent, #2563eb);
	color: #fff;
}

/* Loading bubble: báo AI đang suy nghĩ khi chờ token đầu tiên. */
.dmi-bubble-thinking {
	align-self: flex-start;
	background: #f3f4f6;
	border: 1px solid #e5e7eb;
	color: #6b7280;
}

.dmi-bubble-thinking .dmi-bubble-role { color: #6b7280; }

.dmi-dots {
	display: inline-flex;
	gap: 3px;
	margin-right: 6px;
	vertical-align: middle;
}

.dmi-dots span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #9ca3af;
	animation: dmi-dot-bounce 1.2s infinite ease-in-out;
}

.dmi-dots span:nth-child(2) { animation-delay: .15s; }
.dmi-dots span:nth-child(3) { animation-delay: .3s; }

@keyframes dmi-dot-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: .5; }
	30% { transform: translateY(-4px); opacity: 1; }
}

/* Chế độ xem lại sau khi kết thúc: read-only (ẩn ô nhập + nút kết thúc). */
.dmi-room.is-review .dmi-input-row {
	display: none;
}

.dmi-room.is-review #dmi-end {
	display: none;
}

.dmi-bubble-user .dmi-bubble-role { color: rgba(255,255,255,.8); }

/* Hộp phân tích câu hỏi (breakdown + trace) ngay dưới câu hỏi AI. */
.dmi-hint {
	align-self: flex-start;
	max-width: 82%;
	margin: -4px 0 6px;
	font-size: 13px;
}

.dmi-hint-toggle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: #fffbeb;
	border: 1px solid #fcd34d;
	color: #92400e;
	border-radius: 999px;
	padding: 3px 12px;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
}

.dmi-hint-toggle:hover {
	background: #fef3c7;
}

.dmi-hint-toggle i {
	font-size: 11px;
}

.dmi-hint-body {
	margin-top: 6px;
	background: #fffbeb;
	border: 1px solid #fde68a;
	border-left: 3px solid #f59e0b;
	border-radius: 8px;
	padding: 10px 14px;
	color: #78350f;
	line-height: 1.6;
}

.dmi-hint-body strong {
	color: #92400e;
	font-weight: 700;
}

.dmi-hint-body code {
	background: rgba(245,158,11,.12);
	border-radius: 4px;
	padding: 0 4px;
	font-size: 12px;
}

.dmi-note {
	align-self: center;
	font-size: 12.5px;
	color: #6b7280;
	background: #fff;
	border: 1px dashed #d1d5db;
	border-radius: 999px;
	padding: 4px 14px;
}

.dmi-input-row {
	display: flex;
	gap: 10px;
	padding: 12px;
	border-top: 1px solid #e5e7eb;
	background: #fff;
}

.dmi-input-row textarea {
	flex: 1;
	resize: vertical;
	min-height: 52px;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	padding: 10px 12px;
	font-size: 14.5px;
	font-family: inherit;
}

.dmi-input-row textarea:focus {
	outline: none;
	border-color: var(--dqh-accent);
	box-shadow: 0 0 0 3px var(--dqh-accent-soft);
}

.dmi-room-panel {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	padding: 18px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	align-items: stretch;
	height: fit-content;
}

.dmi-room-panel h3 {
	margin: 0;
	font-size: 16px;
}

.dmi-turn-count {
	font-size: 13.5px;
	color: #6b7280;
}

.dmi-timer {
	font-size: 30px;
	font-weight: 800;
	font-variant-numeric: tabular-nums;
	color: var(--dqh-accent);
	text-align: center;
	padding: 8px 0;
	border-radius: 8px;
	background: var(--dqh-accent-soft);
}

/* ---------- Màn kết quả ---------- */

.dmi-result {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	padding: 26px;
	margin-top: 16px;
}

.dmi-result h2 {
	margin-top: 0;
}

.dmi-score-total {
	font-size: 52px;
	font-weight: 800;
	color: var(--dqh-accent);
	line-height: 1;
	margin: 10px 0 22px;
}

.dmi-score-total span {
	font-size: 20px;
	color: #9ca3af;
	font-weight: 600;
}

.dmi-rubric-row {
	display: grid;
	grid-template-columns: 220px 1fr 48px;
	gap: 12px;
	align-items: center;
	margin-bottom: 10px;
}

@media (max-width: 700px) {
	.dmi-rubric-row {
		grid-template-columns: 1fr;
		gap: 4px;
	}
}

.dmi-rubric-name {
	font-size: 14px;
	font-weight: 600;
}

.dmi-rubric-bar {
	height: 10px;
	background: #f3f4f6;
	border-radius: 999px;
	overflow: hidden;
}

.dmi-rubric-bar > div {
	height: 100%;
	background: var(--dqh-accent);
	border-radius: 999px;
	transition: width .6s ease;
}

.dmi-rubric-val {
	font-size: 13.5px;
	font-weight: 700;
	color: #6b7280;
	text-align: right;
}

.dmi-feedback-item {
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	padding: 12px 16px;
	margin-bottom: 10px;
}

.dmi-feedback-item p {
	margin: 6px 0 0;
	font-size: 14px;
}

.dmi-improve {
	color: #047857;
}

/* ---------- Lịch sử (table base trong dqh-shared.css) ---------- */

.dmi-history-table {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	overflow: hidden;
}

.dmi-history-table th,
.dmi-history-table td {
	padding: 10px 14px;
	text-align: left;
	font-size: 14px;
	border-bottom: 1px solid #f3f4f6;
}

.dmi-history-table th {
	background: #f9fafb;
	font-weight: 700;
}

/* ---------- Modal khóa (tái dụng DQH) ---------- */

.dmi-modal {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, .5);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 99999;
}

.dmi-modal[hidden] {
	display: none;
}

.dmi-modal-box {
	background: #fff;
	border-radius: 12px;
	padding: 26px;
	max-width: 420px;
	width: 92%;
	text-align: center;
}

.dmi-company-input {
	width: 100%;
	box-sizing: border-box;
	padding: 10px 12px;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	font-size: 14.5px;
	margin-bottom: 8px;
}

.dmi-company-input:focus {
	outline: none;
	border-color: var(--dqh-accent);
	box-shadow: 0 0 0 3px var(--dqh-accent-soft);
}

.dmi-company-note {
	font-size: 12.5px;
	color: #047857;
	margin: 0 0 8px;
}

/* ---------- Chip công ty (gợi ý click được) ---------- */

.dmi-company-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	justify-content: center;
	margin: 0 0 10px;
}

/* Khối ngoài #dmi-company-chips: cột dọc chứa label + hàng chip. */
#dmi-company-chips {
	display: block;
	margin: 0 0 10px;
}

.dmi-company-chips-label {
	font-size: 12px;
	color: #6b7280;
	margin-bottom: 6px;
}

.dmi-company-chips-loading {
	font-size: 12px;
	color: #9ca3af;
	font-style: italic;
}

.dmi-company-chip {
	background: #f3f4f6;
	border: 1px solid #d1d5db;
	border-radius: 999px;
	padding: 4px 12px;
	font-size: 12.5px;
	font-family: inherit;
	color: #374151;
	cursor: pointer;
	transition: border-color .15s, background .15s;
}

.dmi-company-chip:hover {
	border-color: var(--dqh-accent, #2563eb);
	background: var(--dqh-accent-soft);
	color: var(--dqh-accent, #2563eb);
}

/* Lỗi gate chặn trong modal công ty. */
.dmi-company-error {
	background: #fef2f2;
	border: 1px solid #fecaca;
	border-radius: 8px;
	padding: 10px 12px;
	font-size: 13px;
	color: #b91c1c;
	text-align: left;
	margin: 0 0 10px;
}

.dmi-company-error p {
	margin: 0 0 8px;
}

.dmi-company-error .dmi-company-chips {
	justify-content: flex-start;
	margin: 0;
}

/* ---------- Overlay chuẩn bị phiên ---------- */

.dmi-overlay {
	position: fixed;
	inset: 0;
	background: rgba(17, 24, 39, .55);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 100000;
}

.dmi-overlay[hidden] {
	display: none;
}

.dmi-overlay-box {
	background: #fff;
	border-radius: 12px;
	padding: 28px 32px;
	max-width: 380px;
	width: 92%;
	text-align: center;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
}

.dmi-overlay-text {
	margin: 0;
	font-size: 14px;
	color: #374151;
}

.dmi-spinner {
	width: 34px;
	height: 34px;
	border: 3px solid #e5e7eb;
	border-top-color: var(--dqh-accent, #2563eb);
	border-radius: 50%;
	animation: dmi-spin .8s linear infinite;
}

@keyframes dmi-spin {
	to { transform: rotate(360deg); }
}

/* ---------- Timer cảnh báo ---------- */

.dmi-timer.is-warn {
	background: #fef3c7;
	color: #b45309;
}

.dmi-timer.is-danger {
	background: #fee2e2;
	color: #b91c1c;
	animation: dmi-pulse 1s ease-in-out infinite;
}

@keyframes dmi-pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: .55; }
}

/* ---------- Lịch sử: khối chi tiết điểm ---------- */

.dmi-history-detail {
	background: #f9fafb;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	padding: 18px;
	text-align: left;
}

.dmi-history-detail .dmi-score-total {
	font-size: 34px;
	margin: 4px 0 14px;
}

.dmi-history-detail-btn {
	font-size: 12.5px;
	padding: 4px 10px;
	white-space: nowrap;
}
