/* css/micro-learning.css */

/* ════════════════════════════════════════════════
   PAGE SHELL
   ════════════════════════════════════════════════ */
.ml-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--dark);
  overflow: hidden;
}

/* ── Header ── */
.ml-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px 12px;
  background: rgba(8,13,26,0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
}

.ml-close-btn {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.18s;
}

.ml-close-btn:hover { background: rgba(239,68,68,0.14); color: #fca5a5; border-color: rgba(239,68,68,0.3); }

.ml-progress-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ml-progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}

.ml-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), #60a5fa);
  border-radius: 3px;
  transition: width 0.4s cubic-bezier(0.34,1.56,0.64,1);
}

.ml-step-counter {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  font-family: 'DM Sans', sans-serif;
}

/* ── Body ── */
.ml-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

/* ── Error / empty ── */
.ml-error {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 60px 32px;
  gap: 14px;
  height: 100%;
}

.ml-error-icon { font-size: 52px; }
.ml-error h3   { font-family:'Sora',sans-serif; font-size:18px; font-weight:700; }
.ml-error p    { color: var(--muted); font-size:14px; }

.ml-back-btn {
  margin-top: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 22px;
  cursor: pointer;
  font-family: 'Sora', sans-serif;
  font-size: 14px; font-weight: 600;
  transition: background 0.18s;
}

.ml-back-btn:hover { background: rgba(255,255,255,0.1); }

/* ════════════════════════════════════════════════
   SHARED STEP LAYOUT
   ════════════════════════════════════════════════ */
.ml-step-footer {
  padding: 16px 20px 24px;
  flex-shrink: 0;
}

.ml-next-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 15px 24px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-family: 'Sora', sans-serif;
  font-size: 15px; font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(59,130,246,0.35);
}

.ml-next-btn:hover  { opacity: 0.88; transform: translateY(-1px); }
.ml-next-btn:active { transform: translateY(0); }

/* ════════════════════════════════════════════════
   VIDEO STEP
   ════════════════════════════════════════════════ */
.ml-video-step {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 16px 16px 0;
}

.ml-video-wrap {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 16/9;
  width: 100%;
  flex-shrink: 0;
}

.ml-video {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}

.ml-video-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.3);
  transition: opacity 0.2s;
  cursor: pointer;
}

.ml-play-btn {
  width: 72px; height: 72px;
  background: var(--blue);
  border: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(59,130,246,0.5);
  transition: transform 0.2s;
}

.ml-play-btn:hover { transform: scale(1.08); }

.ml-video-progress-bar {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 4px;
  background: rgba(255,255,255,0.15);
}

.ml-video-progress-fill {
  height: 100%;
  background: var(--blue);
  width: 0%;
  transition: width 0.3s linear;
}

/* ════════════════════════════════════════════════
   KEY POINT STEP
   ════════════════════════════════════════════════ */
.ml-kp-step {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 20px 20px 0;
}

.ml-kp-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #60a5fa;
  letter-spacing: 0.4px;
  margin-bottom: 16px;
  text-transform: uppercase;
}

.ml-kp-content {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 8px;
}

/* ── Shared card ── */
.ml-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 12px;
}

.ml-card-center { text-align: center; }

.ml-card-title {
  font-family: 'Sora', sans-serif;
  font-size: 20px; font-weight: 700;
  color: #60a5fa;
  margin-bottom: 12px;
}

.ml-card-title-center { text-align: center; }

.ml-card-body {
  font-size: 15px; line-height: 1.65;
  color: rgba(240,244,255,0.85);
}

.ml-text-body {
  font-size: 20px; font-weight: 600;
  line-height: 1.6;
  color: var(--text);
}

/* ── Bullets ── */
.ml-bullets { list-style: none; padding: 0; margin: 0; }

.ml-bullet-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 15px; line-height: 1.5;
}

.ml-bullet-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #60a5fa;
  flex-shrink: 0;
  margin-top: 6px;
}

/* ── Table ── */
.ml-card-table { padding: 16px; }

.ml-table-wrap { overflow-x: auto; border-radius: 12px; }

.ml-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.ml-table th {
  background: rgba(59,130,246,0.18);
  color: #60a5fa;
  font-weight: 700;
  padding: 12px 14px;
  text-align: center;
  font-size: 13px;
}

.ml-table td {
  padding: 11px 14px;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 14px;
}

.ml-row-alt td { background: rgba(255,255,255,0.025); }

/* ── Image ── */
.ml-card-image { padding: 0; overflow: hidden; }

.ml-image-wrap { width: 100%; aspect-ratio: 16/9; }

.ml-image {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

.ml-image-error {
  width: 100%; height: 180px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  background: rgba(255,255,255,0.04);
}

.ml-card-image .ml-card-title,
.ml-card-image .ml-card-body { padding: 16px 20px; display: block; }
.ml-card-image .ml-card-title { padding-bottom: 0; }

/* ── Highlight ── */
.ml-highlight-wrap { padding: 4px 0 12px; }

.ml-highlight-heading {
  text-align: center;
  font-size: 16px; font-weight: 600;
  color: var(--text);
  margin-bottom: 18px;
}

.ml-highlight-card {
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
  border-radius: 20px;
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(59,130,246,0.35);
  margin-bottom: 16px;
}

.ml-highlight-label {
  display: block;
  font-size: 11px; font-weight: 600;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.7);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.ml-highlight-value {
  font-family: 'Sora', sans-serif;
  font-size: 26px; font-weight: 700;
  color: #fff;
  line-height: 1.3;
  margin-bottom: 8px;
}

.ml-highlight-body {
  font-size: 14px;
  color: rgba(255,255,255,0.75);
  line-height: 1.5;
}

/* ── Example rows ── */
.ml-examples { display: flex; flex-direction: column; gap: 10px; }

.ml-example-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 14px;
  padding: 12px 14px;
  transition: border-color 0.2s;
}

.ml-example-text { flex: 1; }

.ml-example-phrase {
  font-size: 17px; font-weight: 700;
  color: #60a5fa;
  margin-bottom: 3px;
}

.ml-example-trans { font-size: 13px; color: var(--muted); }

.ml-speak-btn {
  width: 42px; height: 42px;
  background: rgba(59,130,246,0.12);
  border: 1px solid rgba(59,130,246,0.25);
  border-radius: 50%;
  color: #60a5fa;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}

.ml-speak-btn:hover   { background: rgba(59,130,246,0.22); }
.ml-speak-btn.speaking {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
  animation: ml-pulse 1s ease infinite;
}

@keyframes ml-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59,130,246,0.4); }
  50%       { box-shadow: 0 0 0 8px rgba(59,130,246,0); }
}

/* ── Two columns ── */
.ml-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 4px;
}

.ml-col {
  border-radius: 14px;
  padding: 14px;
}

.ml-col-left  { background: rgba(59,130,246,0.08);  border: 1px solid rgba(59,130,246,0.2); }
.ml-col-right { background: rgba(251,146,60,0.08);  border: 1px solid rgba(251,146,60,0.2); }

.ml-col-heading {
  font-size: 13px; font-weight: 700;
  color: #60a5fa;
  margin-bottom: 10px;
}

.ml-col-heading-right { color: #fb923c; }

.ml-col-item {
  font-size: 14px; line-height: 1.4;
  padding-bottom: 8px;
  color: rgba(240,244,255,0.85);
}

/* ════════════════════════════════════════════════
   QUIZ STEP
   ════════════════════════════════════════════════ */
.ml-quiz-step {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 20px 20px 0;
}

.ml-quiz-meta {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}

.ml-quiz-question {
  font-family: 'Sora', sans-serif;
  font-size: 20px; font-weight: 700;
  line-height: 1.4;
  margin-bottom: 28px;
  color: var(--text);
}

.ml-quiz-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.ml-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  cursor: pointer;
  color: var(--text);
  text-align: left;
  transition: all 0.2s;
  width: 100%;
}

.ml-option:hover:not(:disabled) {
  background: rgba(59,130,246,0.1);
  border-color: rgba(59,130,246,0.35);
}

.ml-option-letter {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}

.ml-option-text { font-size: 15px; line-height: 1.4; flex: 1; }

.ml-option.correct {
  background: rgba(22,163,74,0.12);
  border-color: rgba(22,163,74,0.5);
}

.ml-option.correct .ml-option-letter { background: #16a34a; color: #fff; }

.ml-option.wrong {
  background: rgba(239,68,68,0.1);
  border-color: rgba(239,68,68,0.4);
}

.ml-option.wrong .ml-option-letter { background: #ef4444; color: #fff; }

/* ════════════════════════════════════════════════
   RESULT STEP (inline)
   ════════════════════════════════════════════════ */
.ml-result-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 28px 32px;
  gap: 16px;
  text-align: center;
}

.ml-result-emoji { font-size: 64px; line-height: 1; }

.ml-result-heading {
  font-family: 'Sora', sans-serif;
  font-size: 26px; font-weight: 800;
}

.ml-result-score-card {
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.25);
  border-radius: 14px;
  padding: 14px 24px;
  font-size: 16px; font-weight: 600;
  color: #60a5fa;
}

.ml-result-unlock {
  background: rgba(22,163,74,0.1);
  border: 1px solid rgba(22,163,74,0.3);
  border-radius: 14px;
  padding: 12px 22px;
  font-size: 15px; font-weight: 600;
  color: #4ade80;
}

.ml-result-continue {
  margin-top: 8px;
  max-width: 300px;
}

/* ════════════════════════════════════════════════
   COMPLETION BOTTOM SHEET
   ════════════════════════════════════════════════ */
.ml-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.ml-sheet-overlay.show { opacity: 1; }

.ml-sheet {
  background: #0d1424;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  padding: 14px 24px 40px;
  width: 100%;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.34,1.2,0.64,1);
  text-align: center;
}

.ml-sheet-overlay.show .ml-sheet { transform: translateY(0); }

.ml-sheet-handle {
  width: 36px; height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  margin: 0 auto 20px;
}

.ml-result-icon {
  font-size: 52px; margin-bottom: 12px;
}

.ml-result-title {
  font-family: 'Sora', sans-serif;
  font-size: 24px; font-weight: 800;
  margin-bottom: 16px;
}

.ml-result-score {
  display: inline-block;
  background: rgba(59,130,246,0.12);
  border: 1px solid rgba(59,130,246,0.25);
  border-radius: 12px;
  padding: 10px 20px;
  font-size: 15px; font-weight: 600;
  color: #60a5fa;
  margin-bottom: 14px;
}

.ml-result-unlock {
  display: inline-block;
  background: rgba(22,163,74,0.1);
  border: 1px solid rgba(22,163,74,0.3);
  border-radius: 12px;
  padding: 10px 20px;
  font-size: 14px; font-weight: 600;
  color: #4ade80;
  margin-bottom: 24px;
}

.ml-result-btn {
  width: 100%;
  padding: 15px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-family: 'Sora', sans-serif;
  font-size: 15px; font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  box-shadow: 0 4px 16px rgba(59,130,246,0.35);
}

.ml-result-btn:hover { opacity: 0.88; }

/* ── Responsive ── */
@media (max-width: 400px) {
  .ml-two-col { grid-template-columns: 1fr; }
  .ml-quiz-question { font-size: 18px; }
  .ml-highlight-value { font-size: 22px; }
}