/* Quint Visualizer - Shared Styles */

/* CSS Variables */
:root {
  /* Colors - Base */
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --border-color: #30363d;
  --text-primary: #c9d1d9;
  --text-secondary: #8b949e;

  /* Colors - Accent */
  --accent-blue: #58a6ff;
  --accent-green: #3fb950;
  --accent-red: #f85149;
  --accent-orange: #f0883e;
  --accent-purple: #a371f7;
  --accent-pink: #db61a2;
  --accent-yellow: #d29922;

  /* Colors - Alpha variants (for backgrounds) */
  --accent-blue-alpha: rgba(56, 139, 253, 0.2);
  --accent-green-alpha: rgba(35, 134, 54, 0.2);
  --accent-red-alpha: rgba(248, 81, 73, 0.2);
  --accent-orange-alpha: rgba(240, 136, 62, 0.2);
  --accent-purple-alpha: rgba(163, 113, 247, 0.2);
  --accent-yellow-alpha: rgba(210, 153, 34, 0.2);
  --accent-gray-alpha: rgba(139, 148, 158, 0.2);

  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --font-mono: 'SF Mono', Consolas, Monaco, 'Andale Mono', monospace;

  /* Font Size Scale */
  --text-xs: 0.6875rem;   /* 11px */
  --text-sm: 0.75rem;     /* 12px */
  --text-base: 0.8125rem; /* 13px */
  --text-md: 0.875rem;    /* 14px */
  --text-lg: 1rem;        /* 16px */
  --text-xl: 1.125rem;    /* 18px */

  /* Spacing Scale (4px base) */
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.25rem;  /* 20px */
  --space-6: 1.5rem;   /* 24px */
  --space-8: 2rem;     /* 32px */
  --space-10: 2.5rem;  /* 40px */

  /* Border Radius Scale */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease;

  /* Z-index Scale */
  --z-base: 1;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal: 1000;
  --z-tooltip: 1100;

  /* Layout Dimensions */
  --nav-height: 49px;
  --sidebar-width: 340px;
  --sidebar-width-mobile: 100%;
  --sidebar-padding-x: var(--space-5);
  --sidebar-padding-y: var(--space-5);

  /* Component Sizes */
  --input-height: 32px;
  --input-height-lg: 40px;
  --btn-height: 32px;
  --icon-btn-size: 28px;
}

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

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
}

/* Navigation */
.nav-bar {
  display: flex;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 0 16px;
}

.nav-logo {
  display: flex;
  align-items: center;
  padding: 12px 16px 12px 0;
  color: var(--accent-blue);
  font-weight: 600;
  font-size: 14px;
  border-right: 1px solid var(--border-color);
  margin-right: 8px;
}

.nav-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 0;
}

.nav-tab {
  padding: 8px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.2s ease;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.nav-tab.active {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.nav-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Layout */
.page-container {
  display: flex;
  height: calc(100vh - var(--nav-height));
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  overflow: hidden;
  flex-shrink: 0;
  transition: width var(--transition-base);
  position: relative;
}

.sidebar-content {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  padding: var(--space-10) var(--sidebar-padding-x) var(--sidebar-padding-y);
  height: 100%;
  overflow-y: auto;
}

.sidebar.collapsed {
  width: 0;
  border-right: none;
}

/* Sidebar Toggle Button - positioned to overlay top-right of sidebar */
.sidebar-toggle {
  position: absolute;
  left: calc(var(--sidebar-width) - var(--icon-btn-size) - var(--space-3));
  top: calc(var(--nav-height) + var(--space-2));
  width: var(--icon-btn-size);
  height: var(--icon-btn-size);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  z-index: var(--z-dropdown);
  transition: left var(--transition-base), background var(--transition-base), color var(--transition-base);
  padding: 0;
}

.sidebar-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-toggle .icon-collapse {
  display: block;
}

.sidebar-toggle .icon-expand {
  display: none;
}

/* When collapsed, move button to left edge and show expand icon */
.page-container.sidebar-collapsed .sidebar-toggle {
  left: var(--space-2);
}

.page-container.sidebar-collapsed .sidebar-toggle .icon-collapse {
  display: none;
}

.page-container.sidebar-collapsed .sidebar-toggle .icon-expand {
  display: block;
}

/* Remove old expand button - no longer needed */
.expand-sidebar-btn {
  display: none;
  z-index: var(--z-dropdown);
}

.main-content {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* Typography */
h1 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-5);
  color: var(--accent-blue);
}

h2 {
  font-size: var(--text-md);
  margin-top: var(--space-5);
  margin-bottom: var(--space-2);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

h3 {
  font-size: var(--text-lg);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

/* Stats */
.stat {
  display: flex;
  justify-content: space-between;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--bg-tertiary);
}

.stat-label {
  color: var(--text-secondary);
}

.stat-value {
  color: var(--text-primary);
  font-weight: 500;
}

/* File Input */
.file-input {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.file-input label {
  display: block;
  padding: var(--space-2) var(--space-4);
  background: var(--bg-tertiary);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-base);
}

.file-input label:hover {
  background: var(--border-color);
  border-color: var(--accent-blue);
}

.file-input input {
  display: none;
}

.file-input-btn {
  display: block;
  width: 100%;
  padding: var(--space-2) var(--space-4);
  background: var(--bg-tertiary);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-base);
  color: var(--text-primary);
  font-size: inherit;
}

.file-input-btn:hover {
  background: var(--border-color);
  border-color: var(--accent-blue);
}

/* File Selector (for multi-file navigation) */
.file-selector {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
}

.file-selector-dropdown {
  flex: 1;
  min-width: 0;
  height: var(--input-height);
  padding: 0 var(--space-3);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-base);
  cursor: pointer;
}

.file-selector-dropdown:focus {
  outline: none;
  border-color: var(--accent-blue);
}

.file-selector-nav button {
  width: var(--input-height);
  height: var(--input-height);
  padding: 0;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: var(--text-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-base);
}

.file-selector-nav button:hover:not(:disabled) {
  background: var(--border-color);
  color: var(--text-primary);
}

.file-selector-nav button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.file-selector-info {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  text-align: center;
  margin-top: var(--space-1);
}

/* Buttons */
.btn {
  padding: var(--space-2) var(--space-4);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-base);
  font-size: var(--text-md);
}

.btn:hover {
  background: var(--border-color);
  border-color: var(--accent-blue);
}

.btn-secondary {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--accent-blue);
}

.btn-primary {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #fff;
}

.btn-primary:hover {
  background: #4c9aed;
}

.btn-small {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-sm);
}

.controls {
  margin-top: var(--space-5);
  display: flex;
  gap: var(--space-2);
}

.controls button {
  flex: 1;
}

/* Status Indicator */
.status-indicator {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  font-weight: 500;
  text-align: center;
}

.status-indicator.ok {
  background: var(--accent-green-alpha);
  color: var(--accent-green);
  border: 1px solid var(--accent-green);
}

.status-indicator.violation,
.status-indicator.error {
  background: var(--accent-red-alpha);
  color: var(--accent-red);
  border: 1px solid var(--accent-red);
}

.status-indicator.warning {
  background: var(--accent-yellow-alpha);
  color: var(--accent-yellow);
  border: 1px solid var(--accent-yellow);
}

/* Cards */
.card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
}

.card-title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text-primary);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
}

.badge-blue {
  background: var(--accent-blue-alpha);
  color: var(--accent-blue);
}

.badge-green {
  background: var(--accent-green-alpha);
  color: var(--accent-green);
}

.badge-red {
  background: var(--accent-red-alpha);
  color: var(--accent-red);
}

.badge-orange {
  background: var(--accent-orange-alpha);
  color: var(--accent-orange);
}

.badge-purple {
  background: var(--accent-purple-alpha);
  color: var(--accent-purple);
}

.badge-yellow {
  background: var(--accent-yellow-alpha);
  color: var(--accent-yellow);
}

.badge-gray {
  background: var(--accent-gray-alpha);
  color: var(--text-secondary);
}

/* Legend */
.legend {
  margin-top: var(--space-5);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  margin: 2px 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-base);
}

.legend-item:hover {
  background: var(--bg-tertiary);
}

.legend-item.selected {
  background: var(--border-color);
}

.legend-color {
  width: var(--space-3);
  height: var(--space-3);
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

/* Tooltip */
.tooltip {
  position: absolute;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  font-size: var(--text-sm);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-base);
  max-width: min(400px, 90vw);
  max-height: 400px;
  overflow-y: auto;
  z-index: var(--z-tooltip);
}

.tooltip.visible {
  opacity: 1;
}

.tooltip h3 {
  color: var(--accent-blue);
  margin-bottom: var(--space-2);
  font-size: var(--text-base);
}

.tooltip .section-title {
  color: var(--text-secondary);
  font-size: 10px;
  text-transform: uppercase;
  margin-top: var(--space-2);
  margin-bottom: var(--space-1);
  letter-spacing: 0.5px;
}

.tooltip .section-title:first-child {
  margin-top: 0;
}

/* Format Info */
.format-info {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-top: var(--space-2);
  padding: var(--space-2);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
}

.format-info code {
  color: var(--accent-blue);
}

/* SVG */
#graph-svg {
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
}

/* Tree View */
.tree-view {
  font-size: var(--text-base);
}

.tree-item {
  padding: var(--space-1) 0;
  cursor: pointer;
}

.tree-item:hover {
  background: var(--bg-tertiary);
}

.tree-item-content {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
}

.tree-item.expanded > .tree-children {
  display: block;
}

.tree-children {
  display: none;
  margin-left: var(--space-5);
  border-left: 1px solid var(--border-color);
  padding-left: var(--space-3);
}

.tree-icon {
  width: var(--space-4);
  height: var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.tree-label {
  color: var(--text-primary);
}

.tree-type {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

/* Code Block */
.code-block {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  overflow-x: auto;
  white-space: pre;
}

/* Summary Cards */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.summary-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  text-align: center;
}

.summary-card-value {
  font-size: clamp(1.5rem, 3vw, 1.75rem);
  font-weight: 600;
  color: var(--text-primary);
}

.summary-card-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

.summary-card.success .summary-card-value {
  color: var(--accent-green);
}

.summary-card.error .summary-card-value {
  color: var(--accent-red);
}

.summary-card.warning .summary-card-value {
  color: var(--accent-yellow);
}

/* Test List */
.test-list {
  margin-top: var(--space-4);
}

.test-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
}

.test-item-icon {
  width: var(--space-6);
  height: var(--space-6);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.test-item-icon.passed {
  background: var(--accent-green-alpha);
  color: var(--accent-green);
}

.test-item-icon.failed {
  background: var(--accent-red-alpha);
  color: var(--accent-red);
}

.test-item-icon.ignored {
  background: var(--accent-gray-alpha);
  color: var(--text-secondary);
}

.test-item-name {
  flex: 1;
  font-weight: 500;
}

/* Progress Bar */
.progress-bar {
  height: var(--space-2);
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: var(--space-2);
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width var(--transition-slow);
}

.progress-bar-fill.success {
  background: var(--accent-green);
}

.progress-bar-fill.error {
  background: var(--accent-red);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--space-10);
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

/* Module List */
.module-list {
  margin-top: var(--space-3);
}

.module-item {
  padding: var(--space-2) var(--space-3);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
  cursor: pointer;
  transition: all var(--transition-base);
}

.module-item:hover {
  border-color: var(--accent-blue);
}

.module-item.active {
  border-color: var(--accent-blue);
  background: var(--accent-blue-alpha);
}

.module-name {
  font-weight: 500;
  color: var(--text-primary);
}

.module-meta {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

/* Declaration Groups */
.declaration-group {
  margin-top: var(--space-4);
}

.declaration-group-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  cursor: pointer;
}

.declaration-group-header:hover {
  color: var(--accent-blue);
}

.declaration-group-count {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
}

/* Animation */
@keyframes pulse-error {
  0%, 100% { filter: drop-shadow(0 0 4px var(--accent-red)); }
  50% { filter: drop-shadow(0 0 12px var(--accent-red)); }
}

.pulse-error {
  animation: pulse-error 1.5s ease-in-out infinite;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Help Modal */
.help-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.help-modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.help-modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: min(90%, 640px);
  height: min(80vh, 480px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  transition: transform var(--transition-base);
}

.help-modal-overlay.visible .help-modal {
  transform: scale(1);
}

.help-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-color);
}

.help-modal-header h2 {
  margin: 0;
  font-size: var(--text-xl);
  color: var(--text-primary);
}

.help-modal-close {
  width: var(--input-height);
  height: var(--input-height);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
  transition: all var(--transition-base);
}

.help-modal-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.help-tabs {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-6);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
}

.help-tab {
  padding: var(--space-2) var(--space-4);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: var(--text-md);
  white-space: nowrap;
  transition: all var(--transition-base);
}

.help-tab:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.help-tab.active {
  background: var(--accent-blue);
  color: #fff;
}

.help-content {
  padding: var(--space-6);
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.help-panel {
  display: none;
}

.help-panel.active {
  display: block;
}

.help-panel h3 {
  color: var(--accent-blue);
  margin: 0 0 var(--space-3) 0;
  font-size: var(--text-lg);
}

.help-panel p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 var(--space-4) 0;
}

.help-panel ul {
  margin: 0 0 var(--space-4) 0;
  padding-left: var(--space-5);
  color: var(--text-secondary);
  line-height: 1.8;
}

.help-panel code {
  background: var(--bg-tertiary);
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  color: var(--accent-blue);
}

.help-panel .tip {
  background: var(--accent-blue-alpha);
  border-left: 3px solid var(--accent-blue);
  padding: var(--space-3) var(--space-4);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-top: var(--space-4);
}

.help-panel .tip-title {
  font-weight: 600;
  color: var(--accent-blue);
  margin-bottom: var(--space-1);
}

/* Help Button */
.help-btn {
  width: var(--icon-btn-size);
  height: var(--icon-btn-size);
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-md);
  font-weight: 600;
  transition: all var(--transition-base);
}

.help-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

/* ========================================
   Responsive Breakpoints
   ======================================== */

/* Tablet and below */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 300px;
  }
}

/* Mobile */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 280px;
    --sidebar-padding-x: var(--space-4);
  }

  .page-container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    max-height: 40vh;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  .sidebar-content {
    width: 100%;
    min-width: 100%;
  }

  .sidebar.collapsed {
    max-height: 0;
    border-bottom: none;
  }

  .sidebar-toggle {
    left: auto;
    right: var(--space-3);
    top: calc(var(--nav-height) + var(--space-2));
  }

  .page-container.sidebar-collapsed .sidebar-toggle {
    left: auto;
    right: var(--space-3);
  }

  .main-content {
    flex: 1;
    min-height: 0;
  }

  .file-selector {
    flex-wrap: wrap;
  }

  .file-selector-dropdown {
    order: -1;
    width: 100%;
    flex: none;
  }

  .help-modal {
    width: 95%;
    height: 90vh;
  }

  .help-tabs {
    padding: var(--space-2) var(--space-4);
  }

  .help-content {
    padding: var(--space-4);
  }

  .summary-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .nav-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .nav-tab {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-base);
  }
}

/* Small mobile */
@media (max-width: 480px) {
  :root {
    --sidebar-padding-x: var(--space-3);
    --sidebar-padding-y: var(--space-4);
  }

  .summary-cards {
    grid-template-columns: 1fr;
  }

  .nav-logo {
    display: none;
  }
}
