/* --- FLOW STUDIO THEME --- */

:root {
  --primary: #8b5cf6;
  --bg-dark: #111827;
  --bg-card: #1f2937;
  --text-primary: #f3f4f6;
  --text-muted: #9ca3af;
  --border-glass: rgba(255, 255, 255, 0.1);
}

.flow-studio-container {
  display: flex;
  height: 100%;
  overflow: hidden;
  position: relative;
}

/* Fix Layout Jitter */
#tab-flow {
  overflow-y: auto;
  height: calc(100vh - 200px);
  /* Fixed height to allow internal scrolling */
  padding-right: 5px;
  /* Spacing for scrollbar */
  scrollbar-gutter: stable;
  /* Prevent layout shift when scrollbar appears */
}

/* --- GRID LAYOUT --- */
.flow-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  background: rgba(0, 0, 0, 0.2);
  padding: 15px 20px;
  border-radius: 12px;
  border: 1px solid var(--border-glass);
}

.flow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  padding-bottom: 100px;
  /* Space for scrolling */
}

.flow-card {
  background: rgba(30, 30, 40, 0.6);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 20px;
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.flow-card:hover {
  background: rgba(40, 40, 55, 0.8);
  border-color: var(--primary);
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.flow-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.4);
}

.flow-card.system,
.flow-card.locked {
  background: linear-gradient(135deg, rgba(30, 30, 40, 0.8), rgba(20, 20, 30, 0.9));
  border-left: 4px solid #f59e0b;
}

.flow-card.root {
  border-left: 4px solid var(--primary);
}

.flow-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.flow-card-icon {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.1rem;
}

.flow-card.system .flow-card-icon,
.flow-card.locked .flow-card-icon {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
}

.flow-card-title {
  font-weight: 700;
  font-size: 1rem;
  color: white;
  flex: 1;
}

.flow-card-body {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 15px;
}

.flow-card-footer {
  font-size: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.flow-badge {
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 10px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
}

.flow-badge i {
  font-size: 0.8rem;
}

.flow-badge.next {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.flow-badge.menu {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.flow-badge.orphan {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* --- DRAWER EDITOR --- */
.editor-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.editor-drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.editor-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 600px;
  max-width: 90vw;
  height: 100vh;
  background: #111827;
  border-left: 1px solid var(--border-glass);
  z-index: 9999;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 50px rgba(0, 0, 0, 0.5);
}

.editor-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  padding: 20px 25px;
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
}

.drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 25px;
}