/* ============================================================================
 * OPORTAL "new UX" layer
 * ----------------------------------------------------------------------------
 * Applies only when <html data-ux="new">. The choice is made in
 * Account & Settings > Preferences (stored per browser); the default is set in
 * portal.html. Removing this file and the switch returns the classic look.
 * ========================================================================== */

/* ── Buttons that look like buttons ──
   Actions use a squared, filled style so they read as tappable; rounded pills
   remain only for non-interactive badges and status chips. */
html[data-ux="new"] :is(.button, .hd-pill-btn, .nft-collection-collapse-btn, .nft-detail-back-btn,
  .wallet-copy-btn, .dev-portal-footer-link, .settings-ext-link) {
  border-radius: 10px !important;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s, box-shadow 0.15s;
}

html[data-ux="new"] .button {
  min-height: 42px;
  box-shadow: 0 6px 16px rgba(54, 164, 218, 0.22);
}

html[data-ux="new"] :is(.button, .hd-pill-btn, .wallet-copy-btn):active {
  transform: translateY(1px);
}

html[data-ux="new"] :is(.button--ghost, .hd-pill-btn, .nft-collection-collapse-btn, .nft-detail-back-btn,
  .wallet-copy-btn, .dev-portal-footer-link, .settings-ext-link) {
  color: #e6f6ff !important;
  background: linear-gradient(180deg, rgba(107, 208, 255, 0.16), rgba(107, 208, 255, 0.07)) !important;
  border: 1px solid rgba(107, 208, 255, 0.42) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 2px 8px rgba(0, 0, 0, 0.25) !important;
}

html[data-ux="new"] :is(.button--ghost, .hd-pill-btn, .nft-collection-collapse-btn, .nft-detail-back-btn,
  .wallet-copy-btn, .dev-portal-footer-link, .settings-ext-link):hover {
  background: linear-gradient(180deg, rgba(107, 208, 255, 0.26), rgba(107, 208, 255, 0.12)) !important;
  border-color: rgba(107, 208, 255, 0.7) !important;
  color: #ffffff !important;
}

html[data-ux="new"] .hd-pill-btn {
  min-height: 34px;
  padding: 6px 14px !important;
  font-size: 12px !important;
}

html[data-ux="new"] :is(.button, .hd-pill-btn, .wallet-copy-btn):focus-visible {
  outline: 2px solid rgba(107, 208, 255, 0.7);
  outline-offset: 2px;
}

/* Plain buttons inside popups (no class of their own) get the same style. */
html[data-ux="new"] :where(.modal__block, .oasis-modal-box) button:not([class]) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 10px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #e6f6ff;
  background: linear-gradient(180deg, rgba(107, 208, 255, 0.16), rgba(107, 208, 255, 0.07));
  border: 1px solid rgba(107, 208, 255, 0.42);
  cursor: pointer;
}

html[data-ux="new"] :where(.modal__block, .oasis-modal-box) button:not([class]):hover {
  border-color: rgba(107, 208, 255, 0.7);
  color: #fff;
}

html[data-ux="new"] :is(:where(.modal__block, .oasis-modal-box) button:not([class]), .button, .hd-pill-btn):disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 47.99rem) {
  /* Phones: every popup is a full-screen sheet, so content gets the whole
     width instead of sitting inside a card inside a card. */
  html[data-ux="new"] .modal__block.is-selected {
    position: fixed !important;
    inset: 0 !important;
    left: 0 !important;
    top: 0 !important;
    transform: none !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    border: 0 !important;
    padding: 18px 16px calc(24px + env(safe-area-inset-bottom)) !important;
    background: #071120 !important;
    box-shadow: none !important;
    /* backdrop-filter/filter would make the pinned X scroll with content. */
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    filter: none !important;
  }

  /* The sheet's own outer card(s) drop their frame: no second border/padding. */
  html[data-ux="new"] .modal__block.is-selected > :where(section, div):first-of-type,
  html[data-ux="new"] .modal__block.is-selected > :where(section, div):first-of-type > :where([class*="-card"], [class*="-shell"]):only-child {
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-top: 0 !important;
    max-width: none !important;
    width: 100% !important;
  }

  /* The main close X stays pinned in the top-right corner while scrolling. */
  html[data-ux="new"] .modal__block.is-selected .modal-close-btn:not([onclick]):not(#nft-detail-send-close-btn) {
    position: fixed !important;
    top: calc(12px + env(safe-area-inset-top));
    right: 12px;
    z-index: 30;
    width: 40px;
    height: 40px;
    background: rgba(13, 24, 41, 0.92);
    border-color: rgba(107, 208, 255, 0.35);
    color: var(--color-white);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  }

  /* Ancestors of the pinned X must not become its containing block. */
  html[data-ux="new"] .modal__block.is-selected :has(.modal-close-btn:not([onclick]):not(#nft-detail-send-close-btn)) {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    transform: none !important;
    filter: none !important;
    perspective: none !important;
    will-change: auto !important;
    contain: none !important;
    container-type: normal !important;
  }

  /* Leave room so titles never run under the pinned X. */
  html[data-ux="new"] .modal__block.is-selected :where(h1, h2):first-of-type,
  html[data-ux="new"] .modal__block.is-selected :where(h1, h2):first-of-type + p,
  html[data-ux="new"] .modal__block.is-selected :where(h1, h2):first-of-type + div:not([class*="tab"]) {
    padding-right: 52px;
  }

  html[data-ux="new"] .modal__block.is-selected h1 {
    font-size: 1.55rem !important;
    line-height: 1.2;
  }

  html[data-ux="new"] .modal__block.is-selected h2 {
    font-size: 1.3rem;
    line-height: 1.25;
  }

  /* Tab strips: one swipeable row with a clear active tab, not wrapped words. */
  html[data-ux="new"] .modal__block.is-selected :where([class*="-tabs"], [role="tablist"]):has(> button, > a) {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    margin-left: -16px !important;
    margin-right: -16px !important;
    padding: 0 16px 2px !important;
    scroll-padding: 0 16px;
    mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 24px), transparent 100%);
  }

  html[data-ux="new"] .modal__block.is-selected :where([class*="-tabs"], [role="tablist"]):has(> button, > a)::-webkit-scrollbar {
    display: none;
  }

  html[data-ux="new"] .modal__block.is-selected :where([class*="-tabs"], [role="tablist"]) > :where(button, a) {
    flex: 0 0 auto !important;
    white-space: nowrap;
  }

  /* Label-beside-field form rows stack so fields get the full width. */
  html[data-ux="new"] .modal__block.is-selected [class*="field-row"] {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }

  html[data-ux="new"] .modal__block.is-selected [class*="field-row"] > :is(label, [class*="label"]) {
    text-align: left !important;
    justify-self: start;
  }
}
