/* ── rStack Shell Layout ── */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

/* ── Header bar ── */

.rstack-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 9999;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.rstack-header[data-theme="light"] {
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  color: #0f172a;
}

.rstack-header[data-theme="dark"] {
  background: rgba(15, 23, 42, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}

.rstack-header__left {
  display: flex;
  align-items: center;
  gap: 4px;
}

.rstack-header__center {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 0 16px;
  min-width: 0;
}

.rstack-header__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rstack-header__demo-btn {
  display: inline-flex;
  align-items: center;
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, opacity 0.15s;
  background: linear-gradient(135deg, #14b8a6, #0d9488);
  color: #fff;
  box-shadow: 0 1px 4px rgba(20, 184, 166, 0.25);
}
.rstack-header__demo-btn:hover {
  opacity: 0.88;
}
/* Hide the demo button when already on demo space */
.rstack-header__demo-btn[data-hide] { display: none; }

.rstack-header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 700;
  color: inherit;
}

.rstack-header__brand-gradient {
  background: linear-gradient(135deg, #14b8a6, #22d3ee);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ── Tab row (below header) ── */

.rstack-tab-row {
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  z-index: 9998;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(128,128,128,0.1);
}

.rstack-tab-row[data-theme="dark"] {
  background: rgba(15, 23, 42, 0.8);
}

.rstack-tab-row[data-theme="light"] {
  background: rgba(255, 255, 255, 0.85);
}

/* ── Main content area ── */

#app {
  padding-top: 92px; /* Below fixed header (56px) + tab row (36px) */
  min-height: 100vh;
}

/* When canvas module is active, make it fill the viewport */
#app.canvas-layout {
  padding-top: 92px;
  height: 100vh;
  overflow: hidden;
}

/* ── Standalone mode (no app/space switcher) ── */

.rstack-header--standalone .rstack-header__left {
  gap: 0;
}

/* ── Shared in-app navigation bar (used by module components) ── */

.rapp-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 0;
  min-height: 36px;
}

.rapp-nav__back {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.1);
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
}

.rapp-nav__back:hover {
  color: #e2e8f0;
  border-color: rgba(255,255,255,0.2);
}

.rapp-nav__title {
  font-size: 15px;
  font-weight: 600;
  color: #e2e8f0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rapp-nav__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.rapp-nav__btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: none;
  background: #4f46e5;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s;
}

.rapp-nav__btn:hover {
  background: #6366f1;
}

.rapp-nav__btn--secondary {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  color: #94a3b8;
}

.rapp-nav__btn--secondary:hover {
  border-color: rgba(255,255,255,0.3);
  color: #e2e8f0;
}

.rapp-nav__badge {
  font-size: 11px;
  font-weight: 600;
  color: #fbbf24;
  background: rgba(251,191,36,0.15);
  border: 1px solid rgba(251,191,36,0.3);
  border-radius: 4px;
  padding: 2px 8px;
}

/* ── Mobile adjustments ── */

@media (max-width: 640px) {
  .rstack-header {
    padding: 0 12px;
  }
}
