@import "./quiz-exp.css";
@import "./slide-exp.css";
@import "./flash-exp.css";

#experienceLayer {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  background: #ffffff;
  overflow: hidden;
  pointer-events: none;
}

#experienceLayer.visible {
  display: flex;
  pointer-events: auto;
}

#experienceLayer.experience-variant-thptqg-fullpage {
  position: fixed;
  inset: 0;
  z-index: 1100;
  width: 100vw;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(219, 234, 254, 0.72), transparent 24%),
    linear-gradient(180deg, #f8fbff 0%, #f4f8fc 100%);
}

.message-bubble.startup,
.bubble.bot.startup {
  display: flex;
  flex-direction: column;
  min-height: fit-content;
}

.experience-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
}

#experienceLayer.experience-variant-thptqg-fullpage .experience-toolbar {
  padding: 14px 22px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.back-chat-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
}

.back-chat-btn:hover {
  background: #f5f9ff;
}

.experience-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px 24px;
}

.experience-body.experience-body-thptqg-fullpage {
  display: block;
  width: 100vw;
  min-width: 100vw;
  box-sizing: border-box;
  padding: 12px 12px 20px;
  overflow-y: auto;
}

/* --- Experience shell (quiz / slide / flashcard) --- */
.exp-shell {
  max-width: 720px;
  margin: 0 auto;
  padding-bottom: 24px;
}

.exp-shell-fullset-hub {
  max-width: min(560px, 96vw);
}

.exp-shell-mixed {
  max-width: min(720px, 96vw);
}

.exp-shell-mixed .exp-stage {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

/* Full set — bước slide dùng iframe shell (cùng class với luồng Slide độc lập) */
.exp-mixed-slide-host {
  width: 100%;
}

/* Slide deck: use more horizontal space so 16:9 preview matches the shell layout */
.exp-shell-slide {
  width: 100%;
  max-width: min(1400px, calc(100vw - 48px));
}

.exp-mixed-pick-hint {
  font-size: 13px;
  color: var(--muted, #607d8b);
  margin: 0 0 12px;
  line-height: 1.45;
}

.exp-quiz-actions-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  margin-bottom: 2px;
}

.exp-quiz-actions-stack .exp-hint-toggle {
  margin-top: 0;
}

.exp-mixed-kind-badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #1565c0;
  background: #e3f2fd;
  border: 1px solid #90caf9;
  border-radius: 999px;
  padding: 6px 12px;
  margin-bottom: 14px;
}

.exp-fullset-hub-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.exp-fullset-hub-tile {
  text-align: left;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid #e0e0e0;
  background: #fafafa;
  font-size: 15px;
  font-weight: 600;
  color: #263238;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.exp-fullset-hub-tile:hover {
  border-color: #1976d2;
  background: #f5f9ff;
  box-shadow: 0 4px 14px rgba(25, 118, 210, 0.12);
}

.exp-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.exp-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.exp-icon-svg {
  flex-shrink: 0;
  color: #1565c0;
}

.exp-topbar-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.exp-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}


.exp-ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid #1976d2;
  background: #fff;
  color: #1565c0;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.exp-ai-btn:hover:not(:disabled) {
  background: #1976d2;
  color: #fff;
}

.exp-ai-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.exp-ai-btn .exp-icon-svg {
  color: inherit;
}

.exp-ai-btn[hidden] {
  display: none !important;
}

.exp-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  opacity: 1;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.exp-icon-btn:hover:not(:disabled):not(.is-loading) {
  border-color: rgba(25, 118, 210, 0.28);
  background: #f7fbff;
  color: #1565c0;
  box-shadow: 0 8px 18px rgba(21, 101, 192, 0.12);
  transform: translateY(-1px);
}

.exp-icon-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.16);
}

.exp-icon-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.exp-icon-btn.is-loading {
  cursor: progress;
  opacity: 1;
  color: #1565c0;
  border-color: rgba(25, 118, 210, 0.24);
  background: #eef6ff;
}

.exp-icon-btn.is-loading:disabled {
  cursor: progress;
  opacity: 1;
}

.exp-icon-svg-spinner {
  animation: expIconSpin 0.8s linear infinite;
  transform-origin: 50% 50%;
}

@keyframes expIconSpin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.exp-meta-line {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 16px;
  line-height: 1.45;
}

@media (max-width: 640px) {
  .exp-topbar {
    gap: 8px;
    padding: 8px 10px;
    border-radius: 16px;
    align-items: flex-start;
  }

  .exp-topbar-left {
    gap: 8px;
  }

  .exp-icon-svg {
    width: 18px;
    height: 18px;
  }

  .exp-topbar-title {
    white-space: normal;
    font-size: 0.88rem;
    line-height: 1.22;
  }

  .exp-topbar-right {
    display: none;
  }

  .exp-icon-btn {
    display: none;
  }
}

.exp-progress-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.exp-progress-track {
  flex: 1;
  min-width: 160px;
  display: flex;
  gap: 4px;
}

.exp-progress-seg {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: #e0e0e0;
  transition: background 0.2s;
}

.exp-progress-seg.filled {
  background: #1976d2;
}

.exp-progress-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.exp-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.exp-pill-bad {
  background: #ffebee;
  color: #c62828;
}

.exp-pill-ok {
  background: #e8f5e9;
  color: #2e7d32;
}

.exp-stage {
  margin-bottom: 20px;
}

.exp-footer-bar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.exp-next-btn {
  padding: 12px 28px;
  border-radius: 12px;
  border: none;
  background: #1976d2;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.exp-next-btn:hover:not(:disabled) {
  background: #1565c0;
}

.exp-next-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.exp-back-btn {
  background: #eceff1;
  color: #37474f;
}

.exp-back-btn:hover:not(:disabled) {
  background: #dfe5e9;
}

.exp-submit-btn {
  background: #fff4e5;
  color: #9a5b00;
  border: 1px solid #ffd08a;
}

.exp-submit-btn:hover:not(:disabled) {
  background: #ffe8c2;
}

.exp-empty {
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

.continue-create-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  padding: 16px;
}

.continue-create-dialog {
  width: min(460px, 96vw);
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.2);
  padding: 18px 18px 14px;
}

.continue-create-title {
  margin: 0 0 10px;
  font-size: 17px;
  line-height: 1.35;
  color: #1e293b;
}

.continue-create-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.continue-create-body .flow-field {
  margin-bottom: 0;
}

.continue-create-topic {
  margin: 0;
  line-height: 1.45;
}

.continue-create-body .flow-label {
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

.continue-create-body .flow-input {
  height: 44px;
}

.continue-create-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding-top: 2px;
}

.continue-create-btn {
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 14px;
  cursor: pointer;
}

.continue-create-btn-primary {
  background: #1976d2;
  border-color: #1976d2;
  color: #fff;
}

.continue-create-btn-primary:hover {
  background: #1565c0;
  border-color: #1565c0;
}

.continue-create-btn-secondary {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #334155;
}

.continue-create-btn-secondary:hover {
  background: #f1f5f9;
}

@media (max-width: 768px) {
  .experience-toolbar {
    padding: 10px 12px;
  }

  #experienceLayer.experience-variant-thptqg-fullpage .experience-toolbar {
    padding: 12px 14px 10px;
  }

  .experience-body {
    padding: 14px 12px 18px;
  }

  .exp-topbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .exp-topbar-left,
  .exp-topbar-right {
    width: 100%;
  }

  .exp-topbar-right {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .exp-topbar-title {
    white-space: normal;
  }

  .exp-progress-wrap {
    gap: 10px;
    margin-bottom: 16px;
  }

  .exp-progress-track {
    min-width: 0;
    width: 100%;
  }

  .exp-footer-bar {
    flex-wrap: wrap;
  }

  .exp-footer-bar .exp-next-btn,
  .exp-footer-bar .exp-back-btn,
  .exp-footer-bar .exp-submit-btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 640px) and (max-height: 760px) {
  .experience-body {
    padding-top: 10px;
    padding-bottom: 12px;
  }

  .exp-meta-line {
    margin-bottom: 10px;
    font-size: 12px;
    line-height: 1.35;
  }

  .exp-progress-wrap {
    gap: 8px;
    margin-bottom: 10px;
  }

  .exp-stage {
    margin-bottom: 12px;
  }

  .exp-footer-bar {
    position: sticky;
    bottom: 0;
    z-index: 3;
    padding-top: 6px;
    padding-bottom: max(0px, env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.96) 28%, #ffffff 100%);
  }
}

