/* Browser Popup — floating agent-openable in-app browser window.
 *
 * Paired with ui/browser-popup/js/browser-popup.js (built + shown by the agent's
 * browser_popup tool). Uses design-system tokens only, so it follows the app
 * palette in dark AND light mode. See docs/claude/ui-guidance.md.
 *
 * COLOR SCHEME → all colours are var(--*) from ui/shared/css/design-system.css.
 * REMOVE-WHEN: the Browser Control ability is dropped from the ability catalog.
 */

.wa-bpop {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  pointer-events: none;            /* only the card is interactive — app stays usable */
}
.wa-bpop.open { display: block; }

.wa-bpop-card {
  position: absolute;
  left: 50%;
  top: 8vh;
  transform: translateX(-50%);
  width: min(880px, 92vw);
  height: min(620px, 78vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  pointer-events: auto;
  background: var(--bg-elev);
  border: var(--border-width) solid var(--border);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-xl);
  animation: wa-bpop-in .18s ease-out;
}

@keyframes wa-bpop-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px) scale(.985); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0)   scale(1); }
}

.wa-bpop-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 16px;
  cursor: move;
  user-select: none;
  border-bottom: var(--border-width) solid var(--border-soft);
  background: var(--bg-elev-2);
}

.wa-bpop-titlewrap { min-width: 0; flex: 1; }
.wa-bpop-title {
  font: 600 13px/1.3 var(--font-sans);
  color: var(--fg-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wa-bpop-url {
  font: 400 11px/1.3 var(--font-mono);
  color: var(--fg-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.wa-bpop-actions { display: flex; align-items: center; gap: 4px; }

.wa-bpop-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  padding: 0;
  border: none;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--fg-2);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.wa-bpop-btn:hover { background: var(--bg-tint); color: var(--fg-1); }
.wa-bpop-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.wa-bpop-btn svg { width: 17px; height: 17px; }
.wa-bpop-close:hover { background: rgba(var(--danger-rgb), 0.15); color: var(--danger); }

.wa-bpop-body { position: relative; flex: 1; min-height: 0; background: var(--bg-1); }

.wa-bpop-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: var(--bg-0);
}

.wa-bpop-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 500 13px/1.4 var(--font-sans);
  color: var(--fg-3);
  background: var(--bg-1);
  pointer-events: none;
}
.wa-bpop-loading.hidden { display: none; }

/* Mobile: near-fullscreen sheet, no dragging headroom needed. */
@media (max-width: 560px) {
  .wa-bpop-card {
    left: 3vw; right: 3vw; top: 4vh;
    transform: none;
    width: auto;
    height: 90vh;
  }
  @keyframes wa-bpop-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}

@media (prefers-reduced-motion: reduce) {
  .wa-bpop-card { animation: none; }
}
