/* ============================================================
   GLOBAL.CSS — DataNow Kinetic Obsidian Design System
   All shared components: navbar, nav-links, avatar dropdown,
   buttons, modals, layout, sidebar, common utilities
   ============================================================ */

/* === CSS VARIABLES — DARK (default) === */
:root {
  /* Surfaces & Elevation */
  --surface-base: #0b1326;
  --surface-lowest: rgba(11, 19, 38, 0.6);
  --surface-low: rgba(19, 27, 46, 0.8);
  --surface-high: rgba(34, 42, 61, 0.9);
  --surface-highest: rgba(45, 52, 73, 0.95);

  /* Borders & Glows */
  --border-ghost: rgba(69, 70, 77, 0.3);
  --border-glow: rgba(47, 217, 244, 0.4);

  /* Accents */
  --primary: #b4c5ff;
  --primary-container: #001442;
  --secondary: #b7c8e1;
  --secondary-container: #3a4a5f;
  --tertiary: #2fd9f4;

  /* Text */
  --text-primary: #dae2fd;
  --text-secondary: #c6c6cd;
  --text-inverse: #00174b;

  /* Status Colors */
  --error: #ffb4ab;
  --success: #67e48b;
  --warning: #ffda75;

  /* Typography */
  --font-headline: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Radii/Roundness */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-pill: 9999px;

  /* Custom */
  --cyan: #00d1ff;
  --amber: #ffc800;
  --gold: #ffd700;
  --muted: #64748b;
  --border: rgba(255, 255, 255, 0.08);
}

/* === CSS VARIABLES — LIGHT === */
:root[data-theme='light'] {
  --surface-base: #f8fafc;
  --surface-lowest: rgba(255, 255, 255, 0.8);
  --surface-low: rgba(241, 245, 249, 0.9);
  --surface-high: rgba(226, 232, 240, 0.95);
  --surface-highest: rgba(203, 213, 225, 1);
  --border-ghost: rgba(15, 23, 42, 0.1);
  --border-glow: rgba(2, 132, 199, 0.3);
  --primary: #0f172a;
  --primary-container: #e2e8f0;
  --secondary: #334155;
  --secondary-container: #cbd5e1;
  --tertiary: #0284c7;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-inverse: #ffffff;
}

/* === RESET & BASE === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background-color: var(--surface-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  background-image: radial-gradient(circle at top right, rgba(0, 209, 255, 0.05), transparent 40%),
                    radial-gradient(circle at bottom left, rgba(191, 90, 242, 0.03), transparent 40%);
  background-attachment: fixed;
  overflow: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-headline);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

a {
  color: var(--primary-container);
  text-decoration: none;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

a:hover {
  color: var(--primary);
  text-shadow: 0 0 8px rgba(0, 209, 255, 0.4);
}

/* Previne grids de inflar colunas infinitamente no CodeMirror ou textareas langen */
.layout > * {
  min-width: 0;
}

/* === LINTER SQUIGGLES (VSCODE STYLE) === */
.cm-error-squiggle {
  text-decoration: underline wavy var(--error);
  text-decoration-thickness: 1.5px;
}
.cm-warning-squiggle {
  text-decoration: underline wavy var(--warning);
  text-decoration-thickness: 1px;
}

/* === INTELLISENSE DROPDOWN (VSCODE STYLE) === */
.CodeMirror-hints {
  background: #1e1e1e !important;
  border: 1px solid rgba(0, 209, 255, 0.3) !important;
  border-radius: 6px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 12px rgba(0, 209, 255, 0.1) !important;
  font-family: 'JetBrains Mono', 'Fira Code', monospace !important;
  font-size: 0.82rem !important;
  padding: 4px 0 !important;
  max-height: 240px !important;
  overflow-y: auto !important;
  z-index: 99999 !important;
  position: absolute !important;
}
.CodeMirror-hints::-webkit-scrollbar { width: 6px; }
.CodeMirror-hints::-webkit-scrollbar-thumb { background: rgba(0, 209, 255, 0.3); border-radius: 3px; }
.CodeMirror-hint { color: #e5e2e1 !important; padding: 4px 12px !important; cursor: pointer !important; white-space: nowrap !important; line-height: 1.5 !important; border-radius: 3px !important; margin: 0 4px !important; }
.CodeMirror-hint-active { background: rgba(0, 209, 255, 0.15) !important; color: #a4e6ff !important; }

/* === DATAFRAME RENDERING (DATABRICKS STYLE) === */
.rich-output-wrapper { overflow-x: auto; max-width: 100%; }
.dataframe {
  border-collapse: collapse;
  width: auto;
  margin: 12px 0;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: transparent;
  border: 1px solid var(--border-ghost);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: block;
}
.dataframe thead { background: var(--surface-highest); }
.dataframe th { text-align: left; padding: 8px 16px; font-weight: 600; border-bottom: 2px solid var(--border-soft); color: var(--text-primary); white-space: nowrap; }
.dataframe td { padding: 6px 16px; border-bottom: 1px solid var(--border-ghost); color: var(--text-secondary); white-space: nowrap; }
.dataframe tbody tr:hover { background: var(--surface-high); }
.dataframe tbody tr:last-child td { border-bottom: none; }

/* === TOP NAVBAR === */
.top-navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1.5rem;
  height: 60px;
  background: var(--surface-high);
  border-bottom: 1px solid var(--border-ghost);
  z-index: 100;
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.top-navbar h2 { display: flex; align-items: center; gap: 8px; margin: 0; cursor: pointer; }
.top-navbar h2 .brand-name { font-size: 1.15rem; }
.top-navbar h2 .brand-sub { font-size: 0.52rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.12em; opacity: 0.7; }
.user-profile-icon {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary-container); color: var(--text-primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: bold; font-size: 1.1rem; cursor: pointer;
  box-shadow: 0 0 12px rgba(0,209,255,0.2);
}

/* === TOP NAV LINKS === */
.top-nav-links { display: flex; gap: 15px; margin-left: 20px; }
.top-nav-links .nav-link {
  color: #ffffff;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  margin-bottom: 0;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s;
}
.top-nav-links .nav-link:hover { background: rgba(255,255,255,0.05); color: #ffffff; }
.top-nav-links .nav-link.active { background: rgba(0,209,255,0.1); color: #ffffff; border-left: none; }

/* === NAVBAR COLLAPSE BUTTON === */
#collapseSidebarBtn {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-ghost);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.7rem;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  margin-left: 8px;
}
#collapseSidebarBtn:hover {
  background: rgba(0,209,255,0.1) !important;
  color: var(--primary) !important;
  border-color: rgba(0,209,255,0.3) !important;
}

/* === LAYOUT (sidebar grid) === */
.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: calc(100vh - 60px);
  overflow: hidden;
}
.layout.collapsed { grid-template-columns: 0px 1fr; }
.layout.editor-layout { display: flex; height: calc(100vh - 60px); overflow: hidden; }

/* === SIDEBAR (shared) === */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  min-width: 0;
  transition: width 0.3s ease, padding 0.3s ease;
  overflow-x: hidden;
  overflow-y: auto;
  background-color: var(--surface-lowest);
  border-right: 1px solid var(--border-ghost);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 10;
  position: relative;
}
.sidebar h2 {
  font-size: 1.5rem;
  margin-bottom: 2rem;
  color: var(--text-primary);
  font-family: var(--font-headline);
  letter-spacing: -0.02em;
}
.sidebar h2 span { color: var(--primary-container); text-shadow: 0 0 12px rgba(0, 209, 255, 0.4); }
.layout.collapsed .sidebar { width: 0; padding: 0; border-right: none; overflow: hidden; }
.layout.collapsed .sidebar h2,
.layout.collapsed .sidebar nav { display: none; }

/* === NAV LINKS (inside sidebar) === */
.nav-link {
  padding: 0.75rem 1rem;
  color: var(--text-secondary) !important;
  border-radius: var(--radius-sm);
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
  text-decoration: none;
}
.nav-link:hover { background-color: rgba(255,255,255,0.03); color: var(--text-primary); }
.nav-link.active { background-color: rgba(0,209,255,0.1); color: var(--primary); border-left: 2px solid var(--primary-container); }

/* === LOGOUT BUTTON === */
.logout-btn {
  margin-top: auto;
  background: transparent !important;
  border: 1px solid var(--border-ghost);
  color: var(--text-secondary);
  width: 100%;
  text-align: center;
  box-shadow: none;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.logout-btn:hover { background: rgba(255,115,115,0.1) !important; color: var(--error); border-color: rgba(255,115,115,0.3); }

/* === NAV AVATAR === */
.nav-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--amber));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(0,245,212,0.3);
}
.nav-avatar:hover { filter: brightness(1.1); }

/* === AVATAR DROPDOWN === */
.avatar-dropdown {
  position: absolute;
  top: 50px;
  right: 20px;
  background: var(--surface-high);
  border: 1px solid var(--border-ghost);
  border-radius: 10px;
  padding: 6px;
  width: 200px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s;
}
.avatar-dropdown.show { opacity: 1; visibility: visible; transform: translateY(0); }
.avatar-dropdown::before {
  content: '';
  position: absolute;
  top: -6px;
  right: 12px;
  width: 12px;
  height: 12px;
  background: var(--surface-high);
  border-left: 1px solid var(--border-ghost);
  border-top: 1px solid var(--border-ghost);
  transform: rotate(45deg);
}

/* === DROPDOWN ITEMS === */
.dd-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 0.85rem;
  transition: background 0.15s;
}
.dd-item:hover { background: rgba(255,255,255,0.06); }
.dd-item.danger { color: var(--error); }
.dd-item.danger:hover { background: rgba(255,115,115,0.1); }
.dd-divider { height: 1px; background: var(--border-ghost); margin: 4px 8px; }

/* === BUTTONS — SHARED === */
button {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-container) 100%);
  color: var(--text-inverse);
  border: none;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 209, 255, 0.15);
}
button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 209, 255, 0.3);
  filter: brightness(1.1);
}
button:disabled {
  background: var(--surface-highest);
  color: var(--text-secondary);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

/* Ghost button */
button.btn-ghost {
  background: transparent;
  color: var(--primary-container);
  border: 1px solid var(--border-ghost);
  box-shadow: none;
}
button.btn-ghost:hover {
  background: rgba(0,209,255,0.1);
  border-color: rgba(0,209,255,0.3);
}

/* Small buttons */
.btn-sm {
  background: transparent;
  border: 1px solid var(--border-ghost);
  color: var(--text-secondary);
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-sm:hover { border-color: var(--primary); color: var(--primary); background: rgba(0,209,255,0.08); }

/* Run button */
.run-btn {
  background: linear-gradient(135deg, var(--success) 0%, #2b9348 100%);
  color: #000;
  padding: 0.45rem 1.5rem;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 12px rgba(103,228,139,0.2);
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}
.run-btn:hover { filter: brightness(1.15); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(103,228,139,0.4); }

/* Viz buttons */
.viz-btn {
  background: rgba(0,209,255,0.1);
  color: var(--primary);
  border: 1px solid var(--primary);
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.viz-btn:hover { background: rgba(0,209,255,0.2); }
.viz-btn.active { background: var(--primary); color: #000; }
.viz-btn.inactive { background: transparent; border-color: var(--border-ghost); color: var(--text-secondary); }
.viz-btn.inactive:hover { border-color: var(--primary); color: var(--primary); }

/* NL button */
.ask-nl-btn-sm {
  background: rgba(139,92,246,0.15);
  border: 1px solid rgba(139,92,246,0.4);
  color: #a78bfa;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.ask-nl-btn-sm:hover { background: rgba(139,92,246,0.25); }

/* Action button */
.btn-action {
  background: transparent !important;
  border: 1px solid var(--border-ghost);
  color: var(--text-primary);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.btn-action:hover { background: var(--surface-high) !important; border-color: var(--text-secondary); }
.btn-action.primary { background: var(--primary-container) !important; color: var(--text-inverse); border: none; box-shadow: 0 0 10px rgba(0,209,255,0.2); }
.btn-action.primary:hover { background: var(--primary) !important; }

/* Workspace icon button */
.ws-icon-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  transition: all 0.15s;
  padding: 0;
}
.ws-icon-btn:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }

/* === TOOLBAR ICONS === */
.toolbar-icon {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  position: relative;
}
.toolbar-icon:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
  border-color: var(--border-ghost);
}
.toolbar-icon:active {
  background: rgba(0,209,255,0.1);
  transform: scale(0.95);
}

/* === INPUTS === */
input, select, textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background-color: var(--surface-high);
  border: 1px solid var(--border-ghost);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  transition: all 0.2s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(0,209,255,1);
  box-shadow: 0 0 0 4px rgba(0,209,255,0.1);
}
input::placeholder, textarea::placeholder {
  color: var(--text-secondary);
  opacity: 0.5;
}

/* === MODAL — SHARED === */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
}
.modal-overlay.show { display: flex; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-box {
  background: var(--surface-low);
  border: 1px solid var(--border-ghost);
  border-radius: var(--radius-lg);
  width: 95%;
  max-width: 560px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5), 0 0 40px rgba(0,209,255,0.08);
  animation: slideUp 0.25s ease;
  overflow: hidden;
}
.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-ghost);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0,0,0,0.3);
}
.modal-header h3 { font-size: 1.05rem; font-weight: 600; margin: 0; }
.modal-close {
  background: transparent !important;
  border: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  line-height: 1;
  box-shadow: none;
  transition: all 0.15s;
}
.modal-close:hover { color: var(--error); background: rgba(255,115,115,0.1) !important; }
.modal-body { flex: 1; overflow-y: auto; }
.modal-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.5rem;
  cursor: pointer;
  transition: all 0.15s;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.modal-file-item:hover { background: rgba(0,209,255,0.06); border-left: 3px solid var(--primary-container); }

/* === UTILITIES === */
.text-danger { color: var(--error); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--tertiary); text-shadow: 0 0 12px rgba(47,217,244,0.4); }
.text-secondary { color: var(--secondary); }

/* Glassmorphism Cards */
.card {
  background: var(--surface-low);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-ghost);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: 0 16px 40px rgba(114,0,163,0.04);
}

/* Glass panel */
.glass-panel {
  background: var(--surface-lowest);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--border-ghost);
}

/* Content area */
.content {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface-base);
  overflow: hidden;
}

/* === WORKSPACE TREE (shared across editor/sql) === */
.ws-section {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  border-top: 1px solid var(--border-ghost);
  padding-top: 0.5rem;
  margin-top: 0.5rem;
}
.ws-header { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 8px; border-radius: 4px; transition: background 0.15s; }
.ws-header:hover { background: rgba(255,255,255,0.04); }
.ws-title-area { display: flex; align-items: center; gap: 5px; }
.ws-label { color: var(--text-secondary); font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; }
.ws-header-actions { display: none; gap: 2px; align-items: center; }
.ws-header:hover .ws-header-actions { display: flex; }

.tree-row { display: flex; align-items: center; padding: 3px 4px 3px 0; border-radius: 4px; cursor: pointer; position: relative; user-select: none; transition: background 0.12s; min-height: 24px; }
.tree-row:hover { background: rgba(255,255,255,0.06); }
.tree-row.drag-over { outline: 1px dashed var(--primary); background: rgba(0,209,255,0.08); }
.tree-row-left { display: flex; align-items: center; flex: 1; min-width: 0; gap: 4px; overflow: hidden; }
.tree-row-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.83rem; color: var(--text-primary); }
.tree-row-actions { display: none; align-items: center; gap: 1px; flex-shrink: 0; margin-left: auto; }
.tree-row:hover .tree-row-actions { display: flex; }
.tree-act-btn { background: transparent; border: none; color: var(--text-secondary); cursor: pointer; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; border-radius: 3px; transition: all 0.12s; padding: 0; }
.tree-act-btn:hover { background: rgba(255,255,255,0.12); color: var(--text-primary); }

/* Context menus */
.ws-ctx-menu, .ws-create-submenu {
  position: fixed;
  background: var(--surface-high);
  border: 1px solid var(--border-ghost);
  border-radius: 6px;
  padding: 4px;
  min-width: 160px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.05);
  z-index: 9999;
  display: none;
  backdrop-filter: blur(12px);
}
.ws-ctx-menu.active, .ws-create-submenu.active { display: block; }
.ws-ctx-item { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 4px; font-size: 0.8rem; color: var(--text-primary); cursor: pointer; transition: background 0.1s; white-space: nowrap; }
.ws-ctx-item:hover { background: rgba(255,255,255,0.08); color: var(--primary); }
.ws-ctx-item.danger { color: var(--error); }
.ws-ctx-item.danger:hover { background: rgba(255,100,100,0.1); }
.ws-ctx-item.disabled { opacity: 0.32; cursor: not-allowed; pointer-events: none; }
.ws-ctx-sep { height: 1px; background: var(--border-ghost); margin: 3px 2px; }

/* New folder/file inputs */
#wsNewFolderUI, #wsNewFileUI { display: none; margin-bottom: 0.5rem; padding: 0 8px; }
#wsNewFolderName, #wsNewFileName { width: 100%; background: rgba(0,0,0,0.4); border: 1px solid var(--primary-container); color: var(--text-primary); padding: 0.3rem 0.5rem; border-radius: 3px; font-size: 0.8rem; font-family: var(--font-mono); outline: none; }

/* === FOOTER (shared) === */
.footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  padding: 1.5rem 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: rgba(8,13,20,0.8);
  backdrop-filter: blur(12px);
}
.footer-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.footer-brand img { width: 22px; height: 22px; border-radius: 4px; box-shadow: 0 0 10px rgba(0,245,212,0.3); }
.footer-tagline { font-size: 0.78rem; color: var(--muted); font-style: italic; }
.footer-links { display: flex; gap: 1.5rem; }
.footer-links a { font-size: 0.78rem; color: var(--muted); text-decoration: none; transition: color 0.2s; }
.footer-links a:hover { color: var(--cyan); }
.footer-copy { font-size: 0.75rem; color: rgba(107,122,144,0.6); font-family: var(--font-mono); }

/* === NAVBAR LEFT CONTAINER === */
.navbar-left { display: flex; align-items: center; gap: 20px; }
.brand-icon { width: 28px; height: 28px; border-radius: 6px; box-shadow: 0 0 12px rgba(0,209,255,0.4); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-tagline { font-size: 0.52rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.12em; opacity: 0.7; }

/* === WORKSPACE TREE EXTRAS === */
.new-item-row { display: flex; gap: 0.25rem; }
.new-item-row input { flex: 1; }
.ws-confirm-btn { background: var(--primary-container) !important; border: none !important; color: #000 !important; padding: 2px 6px; border-radius: 3px; cursor: pointer; font-size: 0.8rem; box-shadow: none !important; transform: none !important; }
.ws-confirm-btn:hover { filter: none !important; }
.ws-cancel-btn { background: transparent !important; border: 1px solid var(--border-ghost) !important; color: var(--text-secondary) !important; padding: 2px 6px; border-radius: 3px; cursor: pointer; font-size: 0.8rem; box-shadow: none !important; transform: none !important; }
.ws-cancel-btn:hover { border-color: var(--error) !important; color: var(--error) !important; }
.file-tree { font-family: var(--font-mono); font-size: 0.8rem; overflow-y: auto; flex: 1; padding-top: 4px; }
.tree-loading { color: var(--text-secondary); text-align: center; padding: 1rem 0; font-size: 0.75rem; }

/* === SQL ACTIONS BAR === */
.actions-left { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

/* === EXPLAIN SQL PANEL === */
.explain-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.explain-label { font-size: 0.75rem; color: #a78bfa; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.1em; }
.explain-close { background: transparent; border: none; color: var(--text-secondary); cursor: pointer; font-size: 1rem; padding: 0.2rem 0.5rem; }
.explain-close:hover { color: var(--error); }

.ml-auto { margin-left: auto; }

/* === WORKSPACE TREE EXTRAS === */
.ws-section-top { border-top: none; margin-top: 0; padding-top: 0; }
.ws-chevron { opacity: 0.4; }
.ws-new-ui { display: none; margin-bottom: 0.5rem; padding: 0 8px; }
.new-item-row { display: flex; gap: 0.25rem; }
.new-item-row input { flex: 1; }
.ws-confirm-btn { background: var(--primary-container) !important; border: none !important; color: #000 !important; padding: 2px 6px; border-radius: 3px; cursor: pointer; font-size: 0.8rem; box-shadow: none !important; transform: none !important; }
.ws-confirm-btn:hover { filter: none !important; }
.ws-cancel-btn { background: transparent !important; border: 1px solid var(--border-ghost) !important; color: var(--text-secondary) !important; padding: 2px 6px; border-radius: 3px; cursor: pointer; font-size: 0.8rem; box-shadow: none !important; transform: none !important; }
.ws-cancel-btn:hover { border-color: var(--error) !important; color: var(--error) !important; }
.file-tree { font-family: var(--font-mono); font-size: 0.8rem; overflow-y: auto; flex: 1; padding-top: 4px; }
.tree-loading { color: var(--text-secondary); text-align: center; padding: 1rem 0; font-size: 0.75rem; }

/* === SQL ACTIONS BAR === */
.actions-left { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

/* === EXPLAIN SQL PANEL === */
.explain-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.explain-label { font-size: 0.75rem; color: #a78bfa; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.1em; }
.explain-close { background: transparent; border: none; color: var(--text-secondary); cursor: pointer; font-size: 1rem; padding: 0.2rem 0.5rem; }
.explain-close:hover { color: var(--error); }

/* === FOOTER BRAND === */
.footer-brand-name { font-weight: 700; font-size: 0.9rem; color: #e2e8f0; }
.footer-brand-sub { color: var(--muted); }

/* === RESPONSIVIDADE GLOBAL === */
@media (max-width: 1024px) {
  .layout {
    display: flex !important;
    flex-direction: column !important;
    min-height: 100vh !important;
    overflow-y: auto !important;
  }
  .sidebar {
    position: sticky !important;
    top: 0 !important;
    z-index: 999 !important;
    width: 100% !important;
    height: auto !important;
    min-height: auto !important;
    flex-direction: column !important;
    padding: 1rem !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border-ghost) !important;
    background: rgba(14,14,14,0.9) !important;
  }
  .sidebar h2 { margin-bottom: 1rem !important; justify-content: center !important; }
  .sidebar nav {
    display: flex !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    gap: 0.5rem !important;
    padding-bottom: 0.25rem !important;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }
  .nav-link { white-space: nowrap !important; margin-bottom: 0 !important; padding: 0.5rem 1rem !important; font-size: 0.85rem !important; color: #ffffff !important; }
  .sidebar > div:last-child {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-top: 1rem !important;
    gap: 1rem !important;
    width: 100%;
  }
  .sidebar > div:last-child a,
  .sidebar > div:last-child button { margin: 0 !important; flex: 1 !important; padding: 0.5rem !important; }
  .content, .notebook-area { padding: 1.5rem 1rem !important; height: auto !important; min-height: 60vh !important; }
  .header { flex-direction: column !important; align-items: flex-start !important; gap: 1rem !important; }
  .header-actions { display: flex !important; flex-direction: row !important; flex-wrap: wrap !important; width: 100% !important; gap: 0.5rem !important; }
  .header-actions button, .header-actions select, .header-actions a { flex: 1 1 auto !important; }
  table { display: block !important; overflow-x: auto !important; white-space: nowrap !important; }
  .actions { flex-direction: column !important; gap: 1rem !important; }
  .actions > div { width: 100% !important; flex-wrap: wrap !important; justify-content: center !important; }
  .modal-content { width: 95% !important; padding: 1.25rem !important; margin: 1rem auto !important; }
  .right-info, .vars-panel { width: 100% !important; border-left: none !important; border-top: 1px solid var(--border-ghost) !important; height: auto !important; min-height: 40vh !important; }
  .nb-header { flex-direction: column !important; align-items: flex-start !important; gap: 1rem !important; padding: 1rem !important; }
  #nbTitle { font-size: 1.1rem !important; }
  .stats-grid, .connectors-grid, .templates-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 600px) {
  .header h1 { font-size: 1.5rem !important; }
  .card, .glass-panel { padding: 1rem !important; }
}

@media (max-width: 1100px) {
  .sidebar { width: 200px; }
  .layout { grid-template-columns: 200px 1fr; }
}
@media (max-width: 900px) {
  .sidebar { width: 0; padding: 0; border-right: none; }
  .layout { grid-template-columns: 0px 1fr; }
}

/* === SPINNER === */
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.spinning svg { animation: spin 0.8s linear infinite; }

/* === KBD === */
.kbd {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-ghost);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

/* === FORM GROUP (shared) === */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.4rem; font-weight: 500; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--primary-container); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* === TOAST === */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 2000; display: flex; flex-direction: column; gap: 0.5rem; }
.toast { padding: 0.75rem 1.25rem; border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,0.4); animation: toastIn 0.2s ease-out; }
.toast-success { background: rgba(0,200,100,0.2); color: #00c864; border: 1px solid rgba(0,200,100,0.4); }
.toast-error { background: rgba(255,115,115,0.2); color: var(--error); border: 1px solid rgba(255,115,115,0.4); }
.toast-info { background: rgba(0,209,255,0.2); color: var(--primary); border: 1px solid rgba(0,209,255,0.4); }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* === STATUS BADGES === */
.status-badge { font-size: 0.7rem; font-weight: 600; padding: 0.2rem 0.6rem; border-radius: 99px; text-transform: uppercase; letter-spacing: 0.05em; }
.status-success { background: rgba(0,200,100,0.15); color: #00c864; border: 1px solid rgba(0,200,100,0.3); }
.status-failed { background: rgba(255,115,115,0.15); color: var(--error); border: 1px solid rgba(255,115,115,0.3); }
.status-running { background: rgba(0,209,255,0.15); color: var(--primary); border: 1px solid rgba(0,209,255,0.3); }
.status-pending { background: rgba(255,200,0,0.15); color: #ffc800; border: 1px solid rgba(255,200,0,0.3); }
.status-idle { background: rgba(255,255,255,0.05); color: var(--text-secondary); border: 1px solid var(--border-ghost); }

/* === EMPTY STATE === */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4rem 2rem; text-align: center; color: var(--text-secondary); gap: 1rem; }
.empty-state .emoji { font-size: 3rem; opacity: 0.5; }
.empty-state p { font-size: 0.9rem; max-width: 300px; line-height: 1.6; }