/* quick-add.css — styles for the “+ Add” button and its creation pop-ups.
   Design layer (global visual system): extracted from the quick-add-* partials
   (previously in inline <style> in the views). The variables are defined
   in liquid-glass.css / app.css. Loaded globally via partials/head.ejs. */

/* ── Button + dropdown menu (quick-add-runtime) ── */
.quick-add-wrapper { position: relative; display: inline-block; }
.quick-add-trigger { display: inline-flex; align-items: center; }
.quick-add-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  background: var(--lg-surface-strong, var(--bg-elevated, var(--paper)));
  -webkit-backdrop-filter: blur(var(--lg-blur-card, 30px)) saturate(180%);
  backdrop-filter: blur(var(--lg-blur-card, 30px)) saturate(180%);
  border: 1px solid var(--lg-border, var(--separator));
  border-radius: 16px;
  box-shadow: var(--lg-highlight), var(--lg-shadow-lg, 0 24px 60px rgba(15,37,68,0.18));
  min-width: 280px;
  padding: 0.5rem;
  z-index: 1050;
  display: none;
  opacity: 0;
  /* Liquid burst: the menu emerges from the button (origin top right) with a
     spring — pronounced amplitude so the bounce is visible. */
  transform: translateY(-10px) scale(0.82);
  transform-origin: top right;
  transition: opacity 0.2s ease, transform 0.26s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@media (prefers-reduced-motion: reduce) {
  .quick-add-menu { transition: none; }
  .quick-add-menu.show { transform: none; }
}
.quick-add-menu.show {
  display: block;
  opacity: 1;
  transform: translateY(0) scale(1);
}
.quick-add-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.7rem 0.85rem;
  border-radius: 9px;
  text-decoration: none;
  color: var(--label-primary, var(--navy));
  transition: background 0.14s ease, transform 0.12s ease, padding-left 0.14s ease;
  position: relative;
}
.quick-add-item:hover {
  background: linear-gradient(90deg, rgba(94,127,168,0.10), rgba(94,127,168,0.04));
  padding-left: 1rem;
}
.quick-add-item:hover svg { transform: scale(1.12); color: var(--tint, var(--accent)); }
.quick-add-item:active { transform: scale(0.985); }
.quick-add-item svg {
  color: var(--accent);
  flex-shrink: 0;
  transition: transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.14s ease;
}
.quick-add-item span { display: flex; flex-direction: column; line-height: 1.3; }
.quick-add-item strong { font-weight: 600; font-size: 0.92rem; letter-spacing: -0.005em; }
.quick-add-item small { color: var(--label-secondary, var(--slate)); font-size: 0.74rem; margin-top: 0.15rem; }
.quick-add-menu hr { border: 0; border-top: 1px solid var(--separator); margin: 0.4rem 0.3rem; }

/* ── Direct creation pop-ups (quick-add-modals) ── */
[data-qa-modal] { width: calc(100% - 2rem); max-width: 560px; padding: 1.3rem 1.4rem; }
.qa-title { margin: 0 0 0.25rem; font-size: 1.1rem; }
.qa-muted { color: var(--label-secondary, var(--slate)); }
.qa-soft { font-weight: 400; }
[data-qa-modal] .qa-muted:first-of-type { margin: 0 0 0.9rem; font-size: 0.84rem; }
.qa-x { position: absolute; top: 0.6rem; right: 0.6rem; margin: 0; }
.qa-form, .qa-form-native { display: flex; flex-direction: column; gap: 0.75rem; }
.qa-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.qa-grid3 { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 0.75rem; }
.qa-field { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.84rem; font-weight: 600; color: var(--label-primary, var(--navy)); }
.qa-field input, .qa-field select { font: inherit; font-weight: 400; padding: 0.55rem 0.7rem; border: 1px solid var(--separator, var(--border)); border-radius: 9px; background: var(--lg-surface-soft, #fff); color: inherit; }
.qa-field input:focus, .qa-field select:focus { outline: none; border-color: var(--accent, #5e7fa8); }
.qa-check { display: flex; align-items: center; gap: 0.5rem; font-size: 0.86rem; }
.qa-mentions { display: flex; flex-direction: column; gap: 0.45rem; padding: 0.65rem 0.75rem; border: 1px solid var(--separator, var(--border)); border-radius: 9px; }
.qa-mentions-title { font-size: 0.84rem; font-weight: 600; color: var(--label-primary, var(--navy)); }
.qa-actions { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; margin-top: 0.25rem; }
.qa-link { font-size: 0.8rem; }
.qa-error { font-size: 0.84rem; }
.qa-learner-search { position: relative; }
.qa-search-results { position: absolute; top: 100%; left: 0; right: 0; z-index: 30;
  background: var(--lg-surface-strong, var(--bg-elevated, #fff));
  -webkit-backdrop-filter: blur(var(--lg-blur-card, 30px)) saturate(180%);
  backdrop-filter: blur(var(--lg-blur-card, 30px)) saturate(180%);
  border: 1px solid var(--lg-border, var(--separator)); border-radius: 12px;
  box-shadow: var(--lg-highlight), var(--lg-shadow-lg, 0 16px 40px rgba(15,37,68,0.18));
  max-height: 220px; overflow: auto; margin-top: 0.25rem; }
.qa-search-results button { display: block; width: 100%; text-align: left; background: none; border: 0;
  padding: 0.55rem 0.75rem; font: inherit; font-size: 0.86rem; cursor: pointer; color: var(--label-primary, inherit); }
.qa-search-results button:hover { background: rgba(94, 127, 168, 0.14); }
.qa-search-results button small { display: block; color: var(--label-secondary, var(--slate)); font-size: 0.74rem; }
.qa-search-chip { display: inline-flex; align-items: center; gap: 0.45rem; margin-top: 0.35rem;
  background: rgba(94, 127, 168, 0.16); border: 1px solid var(--lg-border, var(--separator));
  border-radius: 999px; padding: 0.25rem 0.4rem 0.25rem 0.75rem; font-size: 0.84rem; font-weight: 600; width: fit-content; }
.qa-search-chip button { border: 0; background: none; cursor: pointer; font-size: 1rem; line-height: 1; color: inherit; padding: 0 0.25rem; }
@media (prefers-reduced-transparency: reduce) { .qa-search-results { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--bg-secondary, #fff); } }

/* ───────────────────────────────────────────────────────────────────────────
   Migration of quick-add pop-ups to the SHEET component (KIT).
   The modals remain <dialog class="app-modal sheet">: their markup AND
   submission/validation logic (showModal/close, .qa-form, fetch) are
   UNCHANGED — ONLY the container changes (presentation).

   public/js/sheet.js (KIT, not yet on STAGING) enhances <dialog class="sheet">
   (swipe-to-close, etc.). Until it is loaded, these styles are enough to
   present a proper sheet (grabber, rounded top corners, glass) — graceful
   fallback, never broken.

   The rules below override dialog.app-modal[open] (app.css), loaded BEFORE
   quick-add.css → specificity + order OK.
   ──────────────────────────────────────────────────────────────────────────── */

/* Grabber (iOS handle) at the top of the sheet. Decorative → aria-hidden in the markup. */
.sheet-grabber {
  flex-shrink: 0;
  width: 38px;
  height: 5px;
  margin: 0.55rem auto 0.2rem;
  border-radius: var(--r-pill, 999px);
  background: var(--fill-tertiary, rgba(15, 37, 68, 0.22));
}

/* Mobile / tablet portrait: sheet sliding up from the bottom, rounded top corners. */
@media (max-width: 640px) {
  dialog.app-modal.sheet[open] {
    inset: auto 0 0 0;
    margin: 0;
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    border-radius: 22px 22px 0 0;
    border-bottom: 0;
    padding: 0 1.1rem calc(1.1rem + env(safe-area-inset-bottom, 0px));
    animation: qaSheetUp var(--dur-3, 0.34s) var(--ease-spring, cubic-bezier(0.32, 1.4, 0.5, 1));
  }
  dialog.app-modal.sheet { border-radius: 22px 22px 0 0; }
  /* The native “×” button remains accessible, but the grabber provides the cue. */
  .sheet .qa-x { top: 0.5rem; right: 0.7rem; }
}
@keyframes qaSheetUp {
  from { transform: translateY(100%); opacity: 0.4; }
  to   { transform: translateY(0); opacity: 1; }
}

/* Desktop / large: sheet displayed as a centered glass card, with pronounced top corners. */
@media (min-width: 641px) {
  dialog.app-modal.sheet[open] {
    border-radius: 22px;
    padding: 0 1.4rem 1.4rem;
  }
  /* The grabber stays subtle but is retained for “sheet” visual consistency. */
  .sheet .sheet-grabber { opacity: 0.7; }
}

/* Shared glass + cool shadow (beyond the surface inherited from .app-modal). */
dialog.app-modal.sheet {
  box-shadow:
    var(--lg-highlight, 0 0 0 transparent),
    var(--shadow-lg, 0 -10px 60px -12px rgba(15, 37, 68, 0.34));
}

@media (prefers-reduced-motion: reduce) {
  dialog.app-modal.sheet[open] { animation: none; }
}

