/* Bottom sheets (touch dropdowns), the native-select sheet, the Undo pill and
   the pull-to-refresh spinner. Shared by the app and the vendor page. */

/* Modal backdrop in the top layer: a tap here closes the sheet and reaches nothing behind it. */
.sheet-backdrop { position: fixed; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; background: rgba(4, 8, 18, .55); }
.sheet-backdrop[hidden] { display: none !important; }
.sheet-backdrop:not(:popover-open):not(.is-layer-fallback) { display: none; }
.sheet-backdrop.is-layer-fallback { display: block; z-index: 139; }

/* The promoted panel keeps its own inner layout; only its placement changes. */
:is([popover].is-sheet:popover-open, .is-layer-fallback.is-sheet) {
  position: fixed !important; inset: auto 0 0 0 !important; top: auto !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
  transform: none !important; width: auto !important; min-width: 0 !important; max-width: none !important; margin: 0 !important;
  max-height: min(74vh, 640px) !important; overflow: auto !important; overscroll-behavior: contain; box-sizing: border-box;
  padding: 18px 16px calc(14px + env(safe-area-inset-bottom, 0px)) !important;
  border: 1px solid var(--line, #334664) !important; border-bottom: 0 !important; border-radius: 20px 20px 0 0 !important;
  background: var(--bg-2, #19253b) !important; color: var(--ink, #edf2ff); box-shadow: 0 -14px 44px rgba(0, 0, 0, .45) !important;
  display: block !important; z-index: auto; animation: sheet-up .22s ease-out;
}
[popover].is-sheet:popover-open::before { content: ''; display: block; width: 40px; height: 4px; margin: -8px auto 12px; border-radius: 2px; background: var(--line, #334664); }
.is-layer-fallback:is(.is-sheet, .is-popover) { z-index: 140 !important; }
.sheet-done { display: block; width: 100%; min-height: 46px; margin-top: 14px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line, #334664); background: var(--action, #3b65df); color: var(--on-action, #fff); font: inherit; font-size: 15px; font-weight: 600; }
html.sheet-open { overscroll-behavior: contain; }
@keyframes sheet-up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }

/* Watchlist actions inside a sheet: every group open at once, no nested dropdowns. */
.watch-inline-actions.is-sheet .watch-mobile-action-toggle { display: none !important; }
.watch-inline-actions.is-sheet .watch-mobile-action-body { display: block !important; position: static !important; margin: 0; padding: 0 !important; max-height: none !important; box-shadow: none !important; border: 0 !important; background: none !important; }
.watch-inline-actions.is-sheet .watch-action-group > h3 { display: block !important; margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3, #8fa0bd); }
.watch-inline-actions.is-sheet .watch-actions-grid { display: grid !important; grid-template-columns: minmax(0, 1fr) !important; gap: 14px !important; }
.watch-inline-actions.is-sheet .watch-actions-heading { display: none !important; }
.watch-inline-actions.is-sheet .watch-action-buttons .btn, .watch-inline-actions.is-sheet .watch-action-group > .btn { min-height: 44px !important; font-size: 14px !important; }

/* Native <select> replacement on touch screens. */
.select-sheet:not(:popover-open) { display: none; }
.select-sheet-title { margin: 0 0 10px; font-size: 15px; font-weight: 700; }
.select-sheet-options { display: grid; gap: 6px; }
.select-sheet-group { display: grid; gap: 6px; }
.select-sheet-group h4 { margin: 8px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3, #8fa0bd); }
.select-sheet-option { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 46px; padding: 8px 12px; border: 1px solid var(--line, #334664); border-radius: 12px; background: var(--bg, #101a2d); color: var(--ink, #edf2ff); font: inherit; font-size: 15px; text-align: left; }
.select-sheet-option::after { content: ''; width: 18px; height: 18px; flex: none; border-radius: 50%; border: 2px solid var(--line, #334664); }
.select-sheet-option.is-selected { border-color: var(--action, #3b65df); background: var(--selected, #22324d); }
.select-sheet-option.is-selected::after { content: '✓'; display: grid; place-items: center; border-color: var(--action, #3b65df); background: var(--action, #3b65df); color: #fff; font-size: 12px; font-weight: 700; }
.select-sheet-option:disabled { opacity: .45; }

/* Undo pill above the search dock. */
.undo-pill { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); z-index: 70; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 24px); padding: 8px 8px 8px 14px; border-radius: 999px; border: 1px solid var(--line, #334664); background: var(--bg-elevated, #22324d); color: var(--ink, #edf2ff); font-size: 14px; box-shadow: 0 8px 28px rgba(0, 0, 0, .4); animation: undo-in .18s ease-out; }
.undo-pill[hidden] { display: none; }
.undo-pill-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.undo-pill-btn { min-height: 36px; padding: 4px 14px; border-radius: 999px; border: 0; background: var(--action, #3b65df); color: var(--on-action, #fff); font: inherit; font-weight: 700; }
.undo-pill-close { width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: var(--ink-2, #b7c4da); font: inherit; font-size: 14px; }
@keyframes undo-in { from { transform: translate(-50%, 10px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@media (min-width: 701px) { .undo-pill { bottom: 28px; } }
@media print { .undo-pill, .sheet-backdrop, .select-sheet { display: none !important; } }

/* Wide screens: the same panel as an anchored popover under its button (top layer, above sticky bars). */
:is([popover].is-popover:popover-open, .is-layer-fallback.is-popover) {
  position: fixed !important; inset: auto !important; margin: 0 !important; transform: none !important;
  min-width: 0 !important; max-width: none !important; overflow: auto !important; overscroll-behavior: contain; box-sizing: border-box;
  display: block !important; padding: 10px !important;
  border: 1px solid var(--control-line, var(--line, #334664)) !important; border-radius: 12px !important;
  background: var(--bg-2, #19253b) !important; color: var(--ink, #edf2ff); box-shadow: 0 16px 40px rgba(0, 0, 0, .45) !important;
  animation: popover-in .12s ease-out;
}
.sheet-backdrop.is-clear { background: transparent; }
@keyframes popover-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
