/* =====================================================
   SQLite Manager - styles.css
   Modern Dark / Light Theme
   ===================================================== */
/* ===== CSS VARIABLES ===== */
:root {
  --bg-primary: #1e1e2e;
  --bg-secondary: #181825;
  --bg-tertiary: #11111b;
  --bg-surface: #313244;
  --bg-hover: #45475a;
  --bg-active: #585b70;
  --text-primary: #cdd6f4;
  --text-secondary: #a6adc8;
  --text-muted: #6c7086;
  --text-inverse: #1e1e2e;
  --accent-blue: #89b4fa;
  --accent-green: #a6e3a1;
  --accent-red: #f38ba8;
  --accent-yellow: #f9e2af;
  --accent-orange: #fab387;
  --accent-purple: #cba6f7;
  --accent-teal: #94e2d5;
  --accent-pink: #f5c2e7;
  --border-color: #313244;
  --border-focus: #89b4fa;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
  --topbar-h: 52px;
  --statusbar-h: 28px;
  --sidebar-w: 260px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --font-sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  --transition: 0.15s ease;
}
/* ===== LIGHT THEME ===== */
[data-theme="light"] {
  --bg-primary: #eff1f5;
  --bg-secondary: #e6e9ef;
  --bg-tertiary: #dce0e8;
  --bg-surface: #ffffff;
  --bg-hover: #e6e9ef;
  --bg-active: #ccd0da;
  --text-primary: #4c4f69;
  --text-secondary: #6c6f85;
  --text-muted: #9ca0b0;
  --text-inverse: #eff1f5;
  --accent-blue: #1e66f5;
  --accent-green: #40a02b;
  --accent-red: #d20f39;
  --accent-yellow: #df8e1d;
  --accent-orange: #fe640b;
  --accent-purple: #8839ef;
  --accent-teal: #179299;
  --border-color: #ccd0da;
  --border-focus: #1e66f5;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.2);
}
/* ===== RESET & BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  font-size: 14px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  line-height: 1.5;
}
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--bg-active);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
a {
  color: var(--accent-blue);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
kbd {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 12px;
}
hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 12px 0;
}
/* ===== TOPBAR ===== */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  gap: 12px;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.topbar-center {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
  color: var(--accent-blue);
  white-space: nowrap;
}
.logo i {
  font-size: 18px;
}
.breadcrumb-item {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.breadcrumb-item.muted {
  color: var(--text-muted);
  font-style: italic;
}
.breadcrumb-sep {
  color: var(--text-muted);
}
.divider-v {
  width: 1px;
  height: 24px;
  background: var(--border-color);
  margin: 0 4px;
}
.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  transition: background var(--transition), color var(--transition);
}
.sidebar-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition), opacity var(--transition);
  white-space: nowrap;
  user-select: none;
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}
.btn-lg {
  padding: 10px 22px;
  font-size: 15px;
}
.btn-primary {
  background: var(--accent-blue);
  color: var(--text-inverse);
  border-color: var(--accent-blue);
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.1);
}
.btn-success {
  background: var(--accent-green);
  color: var(--text-inverse);
  border-color: var(--accent-green);
}
.btn-success:hover:not(:disabled) {
  filter: brightness(1.1);
}
.btn-danger {
  background: var(--accent-red);
  color: #fff;
  border-color: var(--accent-red);
}
.btn-danger:hover:not(:disabled) {
  filter: brightness(1.1);
}
.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-color);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
}
.btn-outline {
  background: transparent;
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}
.btn-outline:hover:not(:disabled) {
  background: var(--accent-blue);
  color: var(--text-inverse);
}
.btn-warning {
  background: var(--accent-yellow);
  color: var(--text-inverse);
  border-color: var(--accent-yellow);
}
.btn-icon {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}
.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.btn-icon-sm {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 3px 5px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  transition: background var(--transition), color var(--transition);
}
.btn-icon-sm:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
/* ===== LAYOUT ===== */
.layout {
  display: flex;
  position: fixed;
  top: var(--topbar-h);
  bottom: var(--statusbar-h);
  left: 0;
  right: 0;
  overflow: hidden;
}
/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.2s ease, min-width 0.2s ease;
}
.sidebar.collapsed {
  width: 0;
  min-width: 0;
  overflow: hidden;
}
.sidebar-section {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
}
.sidebar-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.sidebar-section-header span {
  flex: 1;
}
.sidebar-section-header i:first-child {
  font-size: 13px;
}
.btn-clear-recent {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  transition: color var(--transition);
}
.btn-clear-recent:hover {
  color: var(--accent-red);
}
.header-actions {
  display: flex;
  gap: 4px;
}
/* Recent list */
.recent-list {
  list-style: none;
  overflow-y: auto;
  max-height: 180px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-color);
}
.recent-list li.empty-state {
  padding: 16px 12px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  font-style: italic;
}
.recent-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid transparent;
}
.recent-item:hover {
  background: var(--bg-hover);
}
.recent-item i {
  color: var(--accent-blue);
  font-size: 13px;
  flex-shrink: 0;
}
.recent-item-info {
  flex: 1;
  min-width: 0;
}
.recent-item-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-item-path {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-item-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  font-size: 11px;
  opacity: 0;
  transition: opacity var(--transition), color var(--transition);
}
.recent-item:hover .recent-item-remove {
  opacity: 1;
}
.recent-item-remove:hover {
  color: var(--accent-red);
}
/* Sidebar search */
.sidebar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.sidebar-search i {
  color: var(--text-muted);
  font-size: 12px;
}
.sidebar-search input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 13px;
  width: 100%;
}
.sidebar-search input::placeholder {
  color: var(--text-muted);
}
/* ===== TREE ===== */
.tree-group {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.tree-group-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background var(--transition);
  user-select: none;
  flex-shrink: 0;
}
.tree-group-header:hover {
  background: var(--bg-hover);
}
.tree-group-header .toggle-icon {
  font-size: 10px;
  color: var(--text-muted);
  width: 10px;
}
.tree-group-header .badge {
  margin-left: auto;
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 10px;
}
.tree-list {
  list-style: none;
  overflow-y: auto;
  max-height: 300px;
}
.tree-list.collapsed {
  display: none;
}
.tree-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 6px 24px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
  border-left: 2px solid transparent;
}
.tree-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.tree-item.active {
  background: var(--bg-surface);
  color: var(--accent-blue);
  border-left-color: var(--accent-blue);
}
.tree-item i {
  font-size: 12px;
  flex-shrink: 0;
}
.tree-item-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tree-item-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--transition);
}
.tree-item:hover .tree-item-actions {
  opacity: 1;
}
/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-primary);
}
/* ===== WELCOME SCREEN ===== */
.welcome-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  overflow-y: auto;
}
.welcome-inner {
  text-align: center;
  max-width: 600px;
}
.welcome-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  font-size: 36px;
  color: white;
  box-shadow: 0 4px 24px rgba(137, 180, 250, 0.3);
}
.welcome-inner h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.welcome-inner p {
  color: var(--text-secondary);
  margin-bottom: 32px;
  font-size: 15px;
}
.welcome-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 48px;
  flex-wrap: wrap;
}
.welcome-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.feature-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}
.feature-item i {
  font-size: 22px;
  color: var(--accent-blue);
}
/* ===== TAB BAR ===== */
.db-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.tab-bar {
  display: flex;
  align-items: stretch;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
}
.tab-bar::-webkit-scrollbar {
  height: 3px;
}
.tabs-list {
  display: flex;
  align-items: stretch;
  flex: 1;
}
.tab-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  height: 38px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  border-right: 1px solid var(--border-color);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
  user-select: none;
  position: relative;
}
.tab-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.tab-item.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
  background: var(--bg-primary);
}
.tab-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 3px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  opacity: 0;
  transition: opacity var(--transition), color var(--transition);
}
.tab-item:hover .tab-close {
  opacity: 1;
}
.tab-close:hover {
  color: var(--accent-red);
  background: var(--bg-hover);
}
.tab-actions {
  display: flex;
  align-items: center;
  padding: 0 8px;
}
.btn-tab-action {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 5px 7px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: background var(--transition), color var(--transition);
}
.btn-tab-action:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
/* ===== TAB PANELS ===== */
.tab-panels {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.tab-panel {
  display: none;
  height: 100%;
  flex-direction: column;
  overflow: hidden;
}
.tab-panel.active {
  display: flex;
}
/* ===== TABLE BROWSER PANEL ===== */
.table-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
.panel-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.panel-toolbar-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.panel-toolbar-title i {
  color: var(--accent-blue);
}
.toolbar-sep {
  flex: 1;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  transition: border-color var(--transition);
}
.search-box:focus-within {
  border-color: var(--border-focus);
}
.search-box i {
  color: var(--text-muted);
  font-size: 12px;
}
.search-box input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 13px;
  width: 160px;
}
/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.pagination-info {
  flex: 1;
}
.page-size-select {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 3px 6px;
  font-size: 12px;
}
.btn-page {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  transition: background var(--transition), color var(--transition);
}
.btn-page:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.btn-page:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-page.active {
  background: var(--accent-blue);
  color: var(--text-inverse);
  border-color: var(--accent-blue);
}
/* ===== DATA TABLE ===== */
.data-table-wrapper {
  flex: 1;
  overflow: auto;
  position: relative;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}
.data-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-secondary);
}
.data-table th {
  padding: 9px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  user-select: none;
  cursor: pointer;
  transition: background var(--transition);
  white-space: nowrap;
}
.data-table th:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.data-table th.sorted-asc::after {
  content: ' ↑';
  color: var(--accent-blue);
}
.data-table th.sorted-desc::after {
  content: ' ↓';
  color: var(--accent-blue);
}
.data-table th.checkbox-col, .data-table td.checkbox-col {
  width: 36px;
  text-align: center;
  cursor: default;
}
.data-table th.action-col, .data-table td.action-col {
  width: 80px;
  text-align: center;
  cursor: default;
}
.data-table td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  color: var(--text-primary);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: top;
}
.data-table tr:hover td {
  background: var(--bg-hover);
}
.data-table tr.selected td {
  background: rgba(137, 180, 250, 0.1);
}
.null-value {
  color: var(--text-muted);
  font-style: italic;
  font-size: 12px;
}
.numeric-value {
  color: var(--accent-teal);
  font-family: var(--font-mono);
}
.blob-value {
  color: var(--accent-purple);
  font-style: italic;
  font-size: 12px;
}
.row-actions {
  display: flex;
  gap: 3px;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition);
}
.data-table tr:hover .row-actions {
  opacity: 1;
}
.btn-row-action {
  background: none;
  border: none;
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 3px;
  font-size: 12px;
  transition: background var(--transition), color var(--transition);
}
.btn-edit {
  color: var(--accent-blue);
}
.btn-edit:hover {
  background: rgba(137, 180, 250, 0.15);
}
.btn-delete {
  color: var(--accent-red);
}
.btn-delete:hover {
  background: rgba(243, 139, 168, 0.15);
}
.empty-table {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-table i {
  font-size: 40px;
  margin-bottom: 12px;
  display: block;
}
/* ===== QUERY PANEL ===== */
.query-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
.query-editor-area {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-color);
}
.query-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}
.CodeMirror {
  height: 200px;
  font-family: var(--font-mono) !important;
  font-size: 13px;
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}
[data-theme="dark"] .CodeMirror {
  background: #1e1e2e !important;
}
[data-theme="light"] .CodeMirror {
  background: #ffffff !important;
}
.CodeMirror-scroll {
  min-height: 120px;
}
.CodeMirror-gutters {
  background: var(--bg-secondary) !important;
  border-right: 1px solid var(--border-color) !important;
}
.CodeMirror-linenumber {
  color: var(--text-muted) !important;
}
.query-results {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.query-results-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.query-multi-results {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}
.query-result-block {
  margin-bottom: 0;
  border-bottom: 1px solid var(--border-color);
}
.query-result-block-header {
  padding: 6px 12px;
  background: var(--bg-secondary);
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}
/* ===== HISTORY PANEL ===== */
.history-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
}
.history-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background var(--transition);
}
.history-item:hover {
  background: var(--bg-hover);
}
.history-item-icon {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 2px;
  flex-shrink: 0;
}
.history-item-content {
  flex: 1;
  min-width: 0;
}
.history-item-sql {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.history-item-time {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}
/* ===== STATUS BAR ===== */
.statusbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--statusbar-h);
  background: var(--accent-blue);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-size: 12px;
  z-index: 100;
}
[data-theme="light"] .statusbar {
  color: white;
}
.status-left, .status-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.status-dot {
  font-size: 8px;
  margin-right: 4px;
}
.status-dot.idle {
  color: rgba(255, 255, 255, 0.6);
}
.status-dot.working {
  color: var(--accent-yellow);
  animation: pulse 1s infinite;
}
.status-dot.success {
  color: var(--accent-green);
}
.status-dot.error {
  color: var(--accent-red);
}
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}
/* ===== MODALS ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.15s ease;
  width: 100%;
}
.modal-sm {
  max-width: 400px;
}
.modal-md {
  max-width: 520px;
}
.modal-lg {
  max-width: 720px;
}
.modal-xl {
  max-width: 960px;
}
.modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.modal-header h3 {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
}
.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: background var(--transition), color var(--transition);
}
.modal-close:hover {
  background: var(--bg-hover);
  color: var(--accent-red);
}
.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}
/* ===== FORM ELEMENTS ===== */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 8px 10px;
  transition: border-color var(--transition);
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(137, 180, 250, 0.15);
}
.form-select option {
  background: var(--bg-secondary);
}
.form-textarea {
  resize: vertical;
  min-height: 80px;
}
.code-area {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
}
.radio-group, .checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.radio-label, .checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-secondary);
}
.radio-label:hover, .checkbox-label:hover {
  color: var(--text-primary);
}
.mt-2 {
  margin-top: 16px;
}
/* Columns builder */
.columns-builder {
  margin: 4px 0 16px;
}
.columns-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}
.columns-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}
.columns-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.columns-table th {
  background: var(--bg-surface);
  padding: 7px 10px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}
.columns-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}
.columns-table tr:last-child td {
  border-bottom: none;
}
.columns-table input[type="text"] {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  color: var(--text-primary);
  padding: 4px 6px;
  font-size: 12px;
  width: 100%;
  outline: none;
}
.columns-table input[type="text"]:focus {
  border-color: var(--border-focus);
}
.columns-table select {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  color: var(--text-primary);
  padding: 4px 6px;
  font-size: 12px;
  outline: none;
}
/* Edit Row form */
.edit-row-field {
  margin-bottom: 12px;
}
.edit-row-field label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.field-type-badge {
  font-size: 10px;
  padding: 1px 5px;
  background: var(--bg-surface);
  border-radius: 3px;
  color: var(--accent-purple);
  font-weight: 400;
  font-family: var(--font-mono);
}
.edit-row-field input, .edit-row-field textarea {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  padding: 7px 10px;
  outline: none;
  transition: border-color var(--transition);
}
.edit-row-field input:focus, .edit-row-field textarea:focus {
  border-color: var(--border-focus);
}
/* Table Structure */
.structure-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.structure-table th {
  background: var(--bg-surface);
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}
.structure-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
}
.structure-table tr:hover td {
  background: var(--bg-hover);
}
.pk-badge {
  font-size: 10px;
  padding: 2px 5px;
  background: rgba(137, 180, 250, 0.15);
  color: var(--accent-blue);
  border-radius: 3px;
}
.nn-badge {
  font-size: 10px;
  padding: 2px 5px;
  background: rgba(243, 139, 168, 0.15);
  color: var(--accent-red);
  border-radius: 3px;
}
/* ===== IMPORT / EXPORT ===== */
.import-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
}
.import-tab {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}
.import-tab.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
}
.import-tab:hover:not(.active) {
  color: var(--text-primary);
}
.import-panel {
  display: none;
}
.import-panel.active {
  display: block;
}
.file-drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  position: relative;
}
.file-drop-zone:hover, .file-drop-zone.drag-over {
  border-color: var(--accent-blue);
  background: rgba(137, 180, 250, 0.05);
}
.file-drop-zone i {
  font-size: 36px;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: block;
}
.file-drop-zone p {
  color: var(--text-secondary);
  font-size: 13px;
}
.file-drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.code-preview {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  max-height: 200px;
  overflow: auto;
  color: var(--text-secondary);
  white-space: pre;
}
/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
  position: fixed;
  bottom: 40px;
  right: 16px;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  z-index: 500;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  min-width: 260px;
  max-width: 400px;
  box-shadow: var(--shadow-md);
  pointer-events: all;
  animation: slideInRight 0.2s ease;
  border-left: 3px solid var(--accent-blue);
}
.toast.success {
  border-left-color: var(--accent-green);
}
.toast.error {
  border-left-color: var(--accent-red);
}
.toast.warning {
  border-left-color: var(--accent-yellow);
}
@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}
.toast.dismissing {
  animation: slideOutRight 0.2s ease forwards;
}
.toast-icon {
  font-size: 14px;
  flex-shrink: 0;
}
.toast.info .toast-icon {
  color: var(--accent-blue);
}
.toast.success .toast-icon {
  color: var(--accent-green);
}
.toast.error .toast-icon {
  color: var(--accent-red);
}
.toast.warning .toast-icon {
  color: var(--accent-yellow);
}
.toast-msg {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary);
}
.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  padding: 2px;
  transition: color var(--transition);
}
.toast-close:hover {
  color: var(--text-primary);
}
/* ===== LOADING OVERLAY ===== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}
.loading-spinner {
  text-align: center;
}
.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--bg-surface);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.loading-spinner p {
  color: var(--text-secondary);
  font-size: 14px;
}
/* ===== HELP TABLE ===== */
.help-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.help-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
}
.help-table td:first-child {
  width: 160px;
}
.help-table h4 {
  margin-top: 0;
}
/* ===== MISC ===== */
.text-success {
  color: var(--accent-green);
}
.text-error {
  color: var(--accent-red);
}
.text-warning {
  color: var(--accent-yellow);
}
.text-muted {
  color: var(--text-muted);
}
.text-mono {
  font-family: var(--font-mono);
}
.badge-pk {
  color: var(--accent-blue);
  font-size: 10px;
}
.badge-fk {
  color: var(--accent-orange);
  font-size: 10px;
}
/* ===== CONTEXT MENU ===== */
.context-menu {
  position: fixed;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 4px;
  min-width: 180px;
  box-shadow: var(--shadow-lg);
  z-index: 400;
  animation: fadeIn 0.1s ease;
}
.context-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  transition: background var(--transition);
}
.context-menu-item:hover {
  background: var(--bg-hover);
}
.context-menu-item.danger {
  color: var(--accent-red);
}
.context-menu-item.danger:hover {
  background: rgba(243, 139, 168, 0.1);
}
.context-menu-sep {
  border-top: 1px solid var(--border-color);
  margin: 4px 0;
}
/* ===== DB INFO PANEL ===== */
.db-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  padding: 16px;
}
.db-info-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.db-info-card-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}
.db-info-card-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}
.db-info-card-sub {
  font-size: 12px;
  color: var(--text-muted);
}
.db-info-card i {
  font-size: 24px;
  color: var(--accent-blue);
  margin-bottom: 4px;
}
/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar {
    position: absolute;
    z-index: 50;
    height: 100%;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.collapsed {
    width: 0;
    min-width: 0;
  }
  .welcome-features {
    grid-template-columns: repeat(2, 1fr);
  }
  .topbar-center {
    display: none;
  }
}
/* ===== QUERY PANEL FIXES ===== */
.query-editor-area {
  flex-shrink: 0;
  border-bottom: 3px solid var(--border-color);
  position: relative;
  min-height: 120px;
}
/* Resize handle between editor and results */
.query-editor-area::after {
  content: '';
  display: block;
  height: 3px;
  background: var(--border-color);
  cursor: ns-resize;
  position: absolute;
  bottom: -3px;
  left: 0;
  right: 0;
  transition: background var(--transition);
}
.query-editor-area:hover::after {
  background: var(--accent-blue);
}
/* CodeMirror height control */
.query-panel .CodeMirror {
  height: 200px;
  min-height: 80px;
}
/* Make query results scrollable */
.query-results {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.query-multi-results {
  flex: 1;
  overflow-y: auto;
}
/* Fix toolbar overflow */
.query-toolbar {
  flex-wrap: wrap;
  row-gap: 4px;
}
/* Tab panel must be flex column */
.tab-panel {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
.tab-panel.active {
  display: flex;
}
/* Table panel flex fill */
.table-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
.table-panel .data-table-wrapper {
  flex: 1;
  overflow: auto;
  min-height: 0;
}
/* Sidebar db-tree overflow */
#dbTreeSection {
  overflow-y: auto;
}
/* Welcome screen button layout fix */
@media (max-width: 500px) {
  .welcome-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .welcome-features {
    grid-template-columns: repeat(2, 1fr);
  }
}