/* Drawer: the only dialog pattern of NovaPOS. A panel slides in from the right over a dimmed page.
   Markup: .nova-drawer-layer (full-screen backdrop) > .nova-drawer (panel) > header / body / footer.
   Keyboard (app.js): Esc closes the top drawer, Enter confirms its primary action. */

.nova-drawer-layer {
  position: fixed;
  inset: 0;
  z-index: 1055;
  display: flex;
  justify-content: flex-end;
  background: rgba(10, 12, 24, .35);
}

.nova-drawer {
  position: relative;
  width: min(640px, 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--nova-surface);
  color: var(--nova-ink);
  border-left: 1px solid var(--nova-line);
  box-shadow: var(--nova-shadow);
  animation: nova-drawer-in .22s ease-out;
}

.nova-drawer.is-narrow { width: min(420px, 100%); }
.nova-drawer.is-wide { width: min(880px, 100%); }
.nova-drawer.is-xwide { width: min(1040px, 100%); }

@keyframes nova-drawer-in {
  from { transform: translateX(28px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .nova-drawer { animation: none; }
}

/* Wrappers between the panel and its sections stay full height, so the footer is pinned to the bottom. */
.nova-drawer > * { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
/* Non-visual children (JSON for Alpine, hidden fields, templates) must not get the layout above. */
.nova-drawer > :is(script, style, template, input, [hidden]) { display: none !important; }
.nova-drawer form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }

.nova-drawer-header {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--nova-line);
}

.nova-drawer-header h2 {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.2px;
  margin: 0;
  color: var(--nova-ink);
}

.nova-drawer-header p {
  font-size: 13px;
  color: var(--nova-muted);
  margin: 4px 0 0;
}

.nova-drawer-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 20px;
}

.nova-drawer-footer {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--nova-line);
  background: var(--nova-subtle);
}

.nova-drawer-close {
  width: 34px;
  height: 34px;
  flex: none;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--nova-line);
  border-radius: 9px;
  background: var(--nova-surface);
  color: var(--nova-ink-2);
}

.nova-drawer-close:hover { background: var(--nova-subtle); color: var(--nova-ink); }
.nova-drawer-close:focus-visible { outline: 2px solid var(--nova-accent); outline-offset: 2px; }

.nova-drawer-danger { background: #e25b74; border-color: #e25b74; }
.nova-drawer-danger:hover { background: #cf4a62; border-color: #cf4a62; color: #fff; }

@media (max-width: 575.98px) {
  .nova-drawer { width: 100%; }
}
