/*
  modal.css — chrome for the runtime-built dialog in js/modal.js.
  Uses the same card recipe as .quiz-setup/.explanation-box (var(--bg-card)
  / var(--border) / var(--radius-lg) / var(--shadow)) so it re-skins
  correctly under all four theme combinations for free — no per-theme
  override file needed.
*/

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 2000;
  animation: modalFadeIn 0.2s var(--ease-out);
}

/* Toasts (css/style.css, z-index:1000) must stay visible even while a
   modal is open — e.g. the feedback modal's own validation toast — so
   this bumps #toast-container above the modal backdrop without
   touching style.css itself. */
#toast-container {
  z-index: 2100;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 460px;
  max-height: min(600px, 88vh);
  overflow-y: auto;
  animation: modalPopIn 0.25s var(--ease-out);
}

/* Wider/taller variant for content that's actually dense enough to use
   the room (Settings' theme grid, Pomodoro's preset editor) — a flat
   460px cap left these cramped in a small centered box on desktop
   screens with plenty of space either side. Grows with the viewport
   (not a single fixed jump) but stops well short of "huge on an
   ultrawide monitor". Below the 520px breakpoint this is a no-op —
   the full-bleed bottom-sheet rule there still applies to any .modal,
   including this one. */
.modal.modal-lg {
  max-width: min(94vw, 900px);
  max-height: min(88vh, 760px);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 1.5rem 0;
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  padding: 0.25rem;
  border-radius: 50%;
  flex-shrink: 0;
  transition: color var(--transition), background var(--transition);
}
.modal-close:hover { color: var(--text); background: var(--surface-hover); }
.modal-close svg { width: 1.3rem; height: 1.3rem; }

.modal-body {
  padding: 1rem 1.5rem 1.75rem;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalPopIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 520px) {
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal {
    max-width: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 85vh;
  }
}

/* "What's new" changelog (js/whats_new.js) — content rendered inside
   the shared modal body above. */
.whats-new-entry + .whats-new-entry {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.whats-new-date {
  font-family: var(--font-display, inherit);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 0.6rem;
}

.whats-new-entry ul {
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.whats-new-entry li {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}
