/* Overlays: modal, drawer, bottom sheet (on <dialog>, R15), popover, tooltip, dropdown menu, combobox
   (04-overlays, 03-components). Animations: motion.css (.np-scrim, .np-modal, .np-drawer, .np-sheet,
   .np-popover with data-open). Layers: z.* tokens; an open <dialog> is in the browser's top layer. */

/* overlays.js locks the page under an open window and pads the body by the scrollbar width. */
html.np-scroll-locked { overflow: hidden; }

/* ---------- dialog base: the <dialog> fills the viewport; scrim and panel are inside ---------- */
.np-dialog {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; overflow: hidden; background: transparent; color: var(--np-color-text-primary);
}
.np-dialog[open] { display: flex; }
.np-dialog::backdrop { background: transparent; }
.np-dialog > .np-scrim { position: absolute; inset: 0; background: var(--np-c-overlay-scrim); }
.np-dialog__panel {
  position: relative; display: flex; flex-direction: column; min-height: 0; max-height: 100%;
  background: var(--np-color-bg-page); box-shadow: var(--np-c-overlay-shadow);
}
.np-dialog__head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--np-space-3); flex: none;
  padding: var(--np-space-2) var(--np-space-2) var(--np-space-2) var(--np-space-5);
  border-bottom: var(--np-borderWidth-default) solid var(--np-color-border-default);
}
.np-dialog__title { font: var(--np-type-h3); letter-spacing: var(--np-type-h3-tracking); overflow-wrap: anywhere; }
/* The title gets focus from the script only to announce the window; no ring around plain text. */
.np-dialog__title:focus { outline: none; }
.np-dialog__close { flex: none; }
/* «Wyczyść» of the filter panel: next to «×», the title keeps the left side. */
.np-dialog__head-action { flex: none; margin-left: auto; font: var(--np-type-bodySm); font-weight: var(--np-font-weight-semibold); }
.np-dialog__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--np-space-5); }
.np-dialog__footer {
  flex: none; padding: var(--np-space-3) var(--np-space-5) calc(var(--np-space-3) + env(safe-area-inset-bottom));
  border-top: var(--np-borderWidth-default) solid var(--np-color-border-default); background: var(--np-color-bg-page);
}
.np-dialog__confirm {
  display: flex; flex-direction: column; gap: var(--np-space-3); flex: none;
  padding: var(--np-space-3) var(--np-space-5); background: var(--np-color-feedback-warning-bg);
  border-bottom: var(--np-borderWidth-default) solid var(--np-color-border-default); font: var(--np-type-bodySm);
}

/* ---------- cmp.modal: centred, sm / md / full ---------- */
.np-dialog--modal { z-index: var(--np-z-modal); align-items: center; justify-content: center; padding: var(--np-space-4); }
.np-modal { width: 100%; max-width: var(--np-c-overlay-modalMaxWidth); max-height: min(90dvh, 100%); border-radius: var(--np-c-overlay-radius); overflow: hidden; }
.np-modal--sm { max-width: calc(var(--np-c-overlay-modalMaxWidth) * .75); }
.np-modal--full { max-width: none; height: 100%; max-height: 100%; }
@media (max-width: 767.98px) { .np-dialog--modal { padding: var(--np-space-3); } }

/* ---------- cmp.drawer: full height, left (menu) or right (mini cart, filters) ---------- */
.np-dialog--drawer { z-index: var(--np-z-drawer); justify-content: flex-end; }
.np-dialog--left { justify-content: flex-start; }
.np-drawer { width: min(var(--np-c-overlay-drawerWidth), calc(100% - var(--np-space-12))); height: 100%; }

/* ---------- cmp.bottomSheet: phones; max 90dvh, action button sticks to the bottom ---------- */
.np-dialog--sheet { z-index: var(--np-z-sheet); align-items: flex-end; justify-content: center; }
.np-sheet { width: 100%; max-height: 90dvh; border-radius: var(--np-c-overlay-radius) var(--np-c-overlay-radius) 0 0; }
@media (min-width: 768px) { .np-sheet { max-width: var(--np-c-overlay-modalMaxWidth); } }
.np-sheet__handle { display: flex; justify-content: center; flex: none; padding: var(--np-space-2) 0 0; touch-action: none; cursor: grab; }
.np-sheet__handle span { width: var(--np-space-10); height: var(--np-space-1); border-radius: var(--np-radius-full); background: var(--np-color-border-strong); }
.np-sheet .np-dialog__head { border-bottom: 0; }

/* ---------- cmp.popover ---------- */
.np-popover-wrap { position: relative; display: inline-block; max-width: 100%; }
.np-popover {
  position: relative; display: flex; flex-direction: column; gap: var(--np-space-2);
  margin-top: var(--np-space-2); padding: var(--np-space-4); padding-right: var(--np-space-12);
  background: var(--np-color-bg-page); border: var(--np-borderWidth-default) solid var(--np-color-border-default);
  border-radius: var(--np-radius-md); box-shadow: var(--np-shadow-overlaySm); font: var(--np-type-bodySm);
}
.np-popover-wrap[data-np-ready] .np-popover {
  position: absolute; top: 100%; left: 0; z-index: var(--np-z-dropdown);
  width: max-content; max-width: min(320px, calc(100vw - 2 * var(--np-space-4)));
}
/* overlays.js / ui.js: near the right edge of the screen the panel opens to the left. */
.np-popover-wrap[data-np-ready] .np-popover.is-end, .np-menu[data-np-ready] .np-menu__list.is-end { left: auto; right: 0; }
.np-popover:focus { outline: none; }
.np-popover:focus-visible { outline: var(--np-focus-ring); outline-offset: var(--np-focus-ring-offset); }
.np-popover__close { position: absolute; top: var(--np-space-1); right: var(--np-space-1); }
.np-popover__title { font-weight: var(--np-font-weight-bold); }

/* ---------- cmp.tooltip: CSS only; overlays.js adds Esc (.is-dismissed) ---------- */
.np-tooltip { position: relative; display: inline-flex; vertical-align: middle; }
.np-tooltip__trigger {
  display: inline-flex; align-items: center; justify-content: center; min-width: var(--np-space-6); min-height: var(--np-space-6);
  padding: 0; border: 0; border-radius: var(--np-radius-sm); background: none; color: var(--np-color-text-secondary);
}
.np-tooltip__trigger .np-icon { width: var(--np-size-icon-sm); height: var(--np-size-icon-sm); }
.np-tooltip__trigger--text { text-decoration: underline dotted; text-underline-offset: 3px; color: inherit; }
.np-tooltip__trigger:focus-visible { outline: var(--np-focus-ring); outline-offset: var(--np-focus-ring-offset); }
.np-tooltip__bubble {
  position: absolute; bottom: calc(100% + var(--np-space-1-5)); left: 50%; z-index: var(--np-z-tooltip);
  width: max-content; max-width: min(240px, calc(100vw - 2 * var(--np-space-4)));
  padding: var(--np-space-1-5) var(--np-space-2); border-radius: var(--np-radius-sm);
  background: var(--np-color-bg-inverse); color: var(--np-color-text-inverse); font: var(--np-type-caption);
  transform: translateX(calc(-50% + var(--np-tooltip-shift, 0px))); pointer-events: none;
  visibility: hidden; opacity: 0; transition: opacity var(--np-duration-fast) linear, visibility 0s linear var(--np-duration-fast);
}
/* Mouse: after 300 ms (04-overlays); keyboard focus: at once; touch screens: never (no hover there). */
@media (hover: hover) {
  .np-tooltip:hover .np-tooltip__bubble { visibility: visible; opacity: 1; transition-delay: 300ms; }
}
.np-tooltip__trigger:focus-visible + .np-tooltip__bubble { visibility: visible; opacity: 1; transition-delay: 0s; }
.np-tooltip.is-dismissed .np-tooltip__bubble { visibility: hidden; opacity: 0; transition: none; }
.np-tooltip.is-shown .np-tooltip__bubble { visibility: visible; opacity: 1; } /* /dev/ui/ only */

/* ---------- cmp.menu (dropdown) ---------- */
.np-menu { position: relative; display: inline-block; }
.np-menu__list {
  display: flex; flex-direction: column; min-width: 200px; margin-top: var(--np-space-1); padding: var(--np-space-1) 0;
  background: var(--np-color-bg-page); border: var(--np-borderWidth-default) solid var(--np-color-border-default);
  border-radius: var(--np-radius-md); box-shadow: var(--np-shadow-overlaySm); font: var(--np-type-bodySm);
}
.np-menu[data-np-ready] .np-menu__list { position: absolute; top: 100%; left: 0; z-index: var(--np-z-dropdown); }
.np-menu__separated { margin-top: var(--np-space-1); padding-top: var(--np-space-1); border-top: var(--np-borderWidth-default) solid var(--np-color-border-default); }
.np-menu__separated form { margin: 0; }
.np-menu__item {
  display: flex; align-items: center; width: 100%; min-height: var(--np-size-control-md); padding: 0 var(--np-space-3);
  border: 0; background: none; color: var(--np-color-text-primary); text-align: left; text-decoration: none; font: inherit;
}
.np-menu__item:hover, .np-menu__item:focus, .np-menu__item.is-active { background: var(--np-color-bg-subtle); color: var(--np-color-text-primary); outline: none; }
.np-menu__item:focus-visible { box-shadow: inset 2px 0 0 var(--np-color-border-focus); }

/* ---------- cmp.combobox ---------- */
.np-combobox__box { position: relative; }
.np-combobox__list {
  position: absolute; top: calc(100% + var(--np-space-1)); left: 0; right: 0; z-index: var(--np-z-dropdown);
  max-height: 280px; overflow-y: auto; padding: var(--np-space-1) 0;
  background: var(--np-color-bg-page); border: var(--np-borderWidth-default) solid var(--np-color-border-default);
  border-radius: var(--np-radius-md); box-shadow: var(--np-shadow-overlaySm); font: var(--np-type-bodySm);
}
.np-combobox__list[aria-busy="true"] { opacity: .6; }
.np-combobox__option {
  display: flex; flex-direction: column; gap: var(--np-space-0-5); padding: var(--np-space-2) var(--np-space-2-5);
  border-left: var(--np-borderWidth-strong) solid transparent; cursor: pointer;
}
.np-combobox__option:hover { background: var(--np-color-bg-subtle); }
.np-combobox__option.is-active { background: var(--np-color-bg-selected); border-left-color: var(--np-color-border-focus); }
.np-combobox__option mark { background: none; color: inherit; font-weight: var(--np-font-weight-bold); }
.np-combobox__note { font: var(--np-type-caption); color: var(--np-color-text-secondary); }
.np-combobox__empty { padding: var(--np-space-2) var(--np-space-2-5); color: var(--np-color-text-secondary); }
