/* ============ NAVBAR ============ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-emoji {
  font-size: 24px;
}

.brand-text {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent-light), var(--secondary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-version {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(108, 92, 231, 0.15);
  color: var(--accent-light);
  font-weight: 600;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Prevent right-side content from squeezing the nav */
.navbar > div:last-child {
  flex-shrink: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.nav-btn {
  padding: 6px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.nav-btn:hover {
  color: var(--text-primary);
  background: rgba(0,0,0,0.04);
}

.nav-btn.active {
  background: rgba(108, 92, 231, 0.12);
  color: var(--accent-light);
  border-color: rgba(108, 92, 231, 0.2);
}

.server-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--success);
  font-weight: 500;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse-dot 2s ease-in-out infinite;
}


/* ============ CONTAINER ============ */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 20px 40px;
}


/* ============ MAIN GRID (three-column layout) ============ */
.main-grid {
  display: grid;
  grid-template-columns: var(--icon-bar-width) 1fr auto;
  gap: 0;
  align-items: start;
  min-height: calc(100vh - 56px - 60px);
}

.icon-bar {
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 12px;
  z-index: 50;
}
.icon-bar-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all var(--transition);
}
.icon-bar-btn:hover {
  background: var(--bg-input);
  color: var(--text-secondary);
}
.icon-bar-btn.active {
  background: var(--accent-glow);
  color: var(--accent);
}

.workspace {
  padding: 24px;
  min-width: 0;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.history-drawer {
  position: fixed;
  top: 56px;
  right: 0;
  width: var(--drawer-width);
  height: calc(100vh - 56px);
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-drawer);
  z-index: 90;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.history-drawer.open {
  transform: translateX(0);
}
.history-drawer-handle {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  width: 24px;
  height: 80px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 8px 0 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 89;
  font-size: 10px;
  color: var(--text-muted);
  writing-mode: vertical-rl;
  letter-spacing: 2px;
  transition: all var(--transition);
}
.history-drawer-handle:hover {
  color: var(--accent);
  width: 28px;
}
.history-drawer-handle.hidden {
  opacity: 0;
  pointer-events: none;
}
.drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drawer-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.drawer-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all var(--transition);
}
.drawer-close:hover {
  background: var(--border-hover);
  color: var(--text-primary);
}
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.panel-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  backdrop-filter: blur(2px);
  z-index: 60;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}
.panel-overlay.active {
  opacity: 1;
  visibility: visible;
}
.side-panel {
  position: fixed;
  top: 56px;
  left: var(--icon-bar-width);
  width: var(--panel-width);
  height: calc(100vh - 56px);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-panel);
  z-index: 70;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  padding: 20px;
}
.side-panel.open {
  transform: translateX(0);
}


/* ============ FOOTER ============ */
.footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}


/* ============ RESPONSIVE ============ */
@media (max-width: 1100px) {
  .main-grid {
    grid-template-columns: var(--icon-bar-width) 1fr;
  }
  .history-drawer {
    width: 320px;
  }
  .workspace {
    padding: 16px;
  }
}

@media (max-width: 900px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
  .icon-bar {
    position: fixed;
    bottom: 0;
    top: auto;
    left: 0;
    right: 0;
    height: 52px;
    width: 100%;
    flex-direction: row;
    justify-content: center;
    border-right: none;
    border-top: 1px solid var(--border);
    z-index: 100;
  }
  .workspace {
    padding: 12px;
    padding-bottom: 70px;
    max-width: 100%;
  }
  .history-drawer {
    width: 100%;
    top: 56px;
  }
  .history-drawer-handle {
    display: none;
  }
}

@media (max-width: 480px) {
  .control-grid {
    grid-template-columns: 1fr;
  }
  .brand-version {
    display: none;
  }
  .run-images {
    grid-template-columns: 1fr 1fr;
  }
}
