/* ===== PROXY MODAL ===== */
.px-modal {
  position: fixed; inset: 0; z-index: 500;
  display: flex; flex-direction: column;
  background: var(--bg-primary);
  animation: modalIn 0.25s cubic-bezier(0.4,0,0.2,1) forwards;
}
@keyframes modalIn { from{opacity:0;transform:scale(0.98)} to{opacity:1;transform:scale(1)} }
.px-modal.closing { animation: modalOut 0.22s cubic-bezier(0.4,0,0.2,1) forwards; }
@keyframes modalOut { from{opacity:1;transform:scale(1)} to{opacity:0;transform:scale(0.98)} }

.px-toolbar {
  height: 42px; background: var(--bg-secondary); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 8px; gap: 4px; flex-shrink: 0;
}
.px-tool-btn {
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); color: var(--text-secondary); transition: all var(--transition);
}
.px-tool-btn:hover { color: var(--text-primary); background: var(--bg-hover); }

/* ── More menu ── */
.px-more-wrap {
  position: relative;
}
.px-more-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: rgba(18,18,20,0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 4px;
  min-width: 150px;
  z-index: 9999;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  animation: moreMenuIn 0.15s ease;
}
@keyframes moreMenuIn {
  from { opacity: 0; transform: scale(0.95) translateY(-4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.px-more-menu.hidden { display: none; }
.px-more-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 8px 10px;
  background: transparent; border: none;
  color: var(--text-secondary); font-size: 13px; font-weight: 500;
  cursor: pointer; border-radius: 7px; text-align: left;
  transition: all 0.12s ease;
}
.px-more-item:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }

.px-url-bar {
  flex: 1; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 5px 12px; font-size: 12px;
  color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; margin: 0 4px; position: relative;
  cursor: text; /* Make it clear the URL bar is clickable */
  user-select: text; /* Allow text selection */
  transition: all 0.15s ease;
}

.px-url-bar:hover {
  background: var(--bg-hover);
  border-color: rgba(255, 255, 255, 0.15);
}

#px-url-display {
  display: block;
  width: 100%;
  cursor: text;
  user-select: text; /* Allow text selection in display mode */
}

#px-url-display.hidden {
  display: none !important;
}

.px-url-bar input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 12px;
  padding: 0;
  white-space: nowrap;
  user-select: text; /* Ensure text selection works */
}

.px-url-bar input::-webkit-input-placeholder,
.px-url-bar input::-moz-placeholder,
.px-url-bar input:-ms-input-placeholder,
.px-url-bar input::placeholder {
  color: var(--text-muted);
}

.px-url-input.hidden {
  display: none !important;
}

/* Main area */
.px-main {
  flex: 1; display: flex; flex-direction: row; overflow: hidden; position: relative;
}

/* Browsing surface: canvas (background) + iframe (proxied document — required for SW/HTML) */
.px-viewport {
  flex: 1;
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.px-surface-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  z-index: 0;
  background: #0c0c0e;
}

#px-frame {
  position: relative;
  z-index: 1;
  flex: 1;
  border: none;
  background: transparent;
  min-width: 0;
  min-height: 0;
}

/* ===== DEVTOOLS PANEL ===== */
.px-devtools-panel {
  width: 380px; flex-shrink: 0;
  background: #0d0d0d; border-left: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
  font-family: 'Consolas', 'Monaco', monospace;
}

.pdt-header {
  height: 36px; background: #111; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 8px; flex-shrink: 0;
}
.pdt-tabs { display: flex; gap: 2px; }
.pdt-tab {
  padding: 4px 10px; font-size: 11px; font-weight: 600;
  color: var(--text-muted); border-radius: 4px; cursor: pointer;
  transition: all var(--transition); background: none; border: none;
  font-family: var(--font);
}
.pdt-tab:hover { color: var(--text-secondary); background: rgba(255,255,255,0.05); }
.pdt-tab.active { color: var(--text-primary); background: rgba(255,255,255,0.08); }
.pdt-close {
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
  border-radius: 4px; color: var(--text-muted); cursor: pointer; transition: all var(--transition);
}
.pdt-close:hover { color: var(--text-primary); background: rgba(255,255,255,0.08); }

.pdt-body { flex: 1; overflow: hidden; position: relative; }
.pdt-panel { position: absolute; inset: 0; display: none; flex-direction: column; overflow: hidden; }
.pdt-panel.active { display: flex; }

/* Console */
.pdt-console-output {
  flex: 1; overflow-y: auto; padding: 8px; font-size: 11px; line-height: 1.6;
  color: #ccc;
}
.pdt-console-output::-webkit-scrollbar { width: 4px; }
.pdt-console-output::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.pdt-log   { color: #ccc; padding: 2px 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
.pdt-error { color: #ff6b6b; padding: 2px 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
.pdt-warn  { color: #ffd93d; padding: 2px 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
.pdt-info  { color: #74b9ff; padding: 2px 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
.pdt-result { color: #a29bfe; padding: 2px 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
.pdt-cmd   { color: #55efc4; padding: 2px 0; }

.pdt-console-input-row {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px; border-top: 1px solid rgba(255,255,255,0.08);
  background: #0a0a0a; flex-shrink: 0;
}
.pdt-prompt { color: #55efc4; font-size: 12px; font-weight: 700; }
.pdt-console-input {
  flex: 1; background: none; border: none; outline: none;
  font-size: 11px; color: #fff; font-family: 'Consolas', 'Monaco', monospace;
}
.pdt-console-input::placeholder { color: rgba(255,255,255,0.2); }

/* Network */
.pdt-net-list { flex: 1; overflow-y: auto; padding: 4px; font-size: 10px; }
.pdt-net-item {
  display: flex; gap: 8px; padding: 3px 6px; border-radius: 3px;
  color: #aaa; cursor: pointer; transition: background 0.1s;
}
.pdt-net-item:hover { background: rgba(255,255,255,0.05); }
.pdt-net-method { color: #74b9ff; font-weight: 700; width: 36px; flex-shrink: 0; }
.pdt-net-status { width: 28px; flex-shrink: 0; }
.pdt-net-status.ok  { color: #55efc4; }
.pdt-net-status.err { color: #ff6b6b; }
.pdt-net-url { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Storage */
.pdt-storage-content { flex: 1; overflow-y: auto; padding: 8px; font-size: 11px; }
.pdt-storage-section { margin-bottom: 12px; }
.pdt-storage-title { color: #74b9ff; font-weight: 700; margin-bottom: 4px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.pdt-storage-item { display: flex; gap: 8px; padding: 2px 0; color: #aaa; }
.pdt-storage-key { color: #a29bfe; min-width: 80px; }
.pdt-storage-val { color: #ccc; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }

/* Placeholder */
.pdt-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; gap: 10px; color: rgba(255,255,255,0.2); font-size: 11px; text-align: center; padding: 20px;
}
