/* shell.css — outer-tab nav, busy bar, and toast stack for the merged toolbox.
 *
 * Scoped tightly so it doesn't fight the cleaner (.ae-/.pec-) or utils (.tabs/.card) themes.
 */

/* Guarantee a usable dark canvas even if a per-app stylesheet fails to load —
 * the merged shell must never fall back to the browser's white default. */
html, body {
  background: var(--pkm-bg, #0c0f1a);
  color: var(--pkm-text, #e4e8f7);
}

/* The browser's default `[hidden]` rule is `display: none`, but we override
 * conflicting display rules from per-app CSS so non-active app panels truly
 * hide instead of stacking on top of the active one. */
main[hidden] { display: none !important; }

.app-topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.app-tabs {
  display: inline-flex;
  gap: 0.25rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 0.25rem;
}

.app-tabs button {
  appearance: none;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.app-tabs button:hover {
  background: rgba(255, 255, 255, 0.06);
}

.app-tabs button[aria-selected="true"] {
  background: #2c4480;
  color: #fff;
}

.app-tabs button[hidden] {
  display: none;
}

/* ───────── busy bar (top of viewport while requests are in flight) ───────── */
.app-busy-bar {
  position: sticky;
  top: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1rem;
  background: linear-gradient(90deg, #1d3a8a, #2c5fbe 60%, #3d7adb);
  background-size: 200% 100%;
  animation: app-busy-shimmer 1.4s linear infinite;
  color: #f4f7ff;
  font-size: 0.8125rem;
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.app-busy-bar[hidden] {
  display: none;
}

@keyframes app-busy-shimmer {
  0% { background-position: 0% 0%; }
  100% { background-position: -200% 0%; }
}

.app-busy-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-top-color: #fff;
  border-radius: 50%;
  animation: app-busy-spin 0.85s linear infinite;
}

@keyframes app-busy-spin { to { transform: rotate(360deg); } }

/* ───────── toast stack (bottom-right, stacking up to several at a time) ───────── */
.app-toast-stack {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.5rem;
  max-width: min(420px, calc(100vw - 2rem));
  z-index: 90;
  pointer-events: none;
}

.app-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  background: #15203b;
  color: #e3ecff;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  font-size: 0.8125rem;
  line-height: 1.35;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.app-toast--in {
  opacity: 1;
  transform: translateY(0);
}

.app-toast--out {
  opacity: 0;
  transform: translateY(8px);
}

.app-toast-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4f8df6;
  flex: 0 0 8px;
}

.app-toast--ok .app-toast-dot { background: #4ade80; }
.app-toast--warn { border-color: rgba(248, 113, 113, 0.45); }
.app-toast--warn .app-toast-dot { background: #f87171; }
.app-toast--info .app-toast-dot { background: #60a5fa; }

.app-toast-msg {
  flex: 1;
  word-break: break-word;
}

.app-toast-x {
  appearance: none;
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.25rem;
}

.app-toast-x:hover { color: #fff; }

/* ───────── PKL hero/section sit on the same dark canvas as the cleaner shell ───────── */
.pkl-hero,
.pkl-section {
  margin-left: auto;
  margin-right: auto;
  max-width: 1200px;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.pkl-hero {
  padding-top: 2rem;
  padding-bottom: 1rem;
}

.pkl-section {
  padding-top: 1rem;
  padding-bottom: 2rem;
}
