/**
 * Main Styles - Vector Similarity Explorer
 * Refactored to use design tokens from variables.css
 */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  font-size: var(--text-base);
  line-height: var(--leading-normal);
}

@media (max-width: 1200px) {
  body {
    overflow-y: auto;
    overflow-x: hidden;
  }
}

/* ============================================
   RESPONSIVE GRID LAYOUT
   ============================================ */
#container {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 320px) minmax(600px, 1fr) minmax(320px, 360px);
  grid-template-rows: auto 1fr;
  align-items: center;
  justify-items: center;
  padding: var(--space-lg) var(--space-xl);
  column-gap: var(--space-xl);
  row-gap: var(--space-lg);
  overflow: hidden;
}

#canvas-container {
  grid-column: 2;
  grid-row: 2;
  width: 100%;
  height: calc(100vh - 176px);
  max-width: 1400px;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  z-index: 1;
  position: relative;
}

/* ============================================
   COLUMN LAYOUTS
   ============================================ */
.left-column {
  grid-column: 1;
  grid-row: 2;
  width: 100%;
  max-width: 320px;
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  border-radius: var(--radius-2xl);
  background: var(--bg-panel-left);
  backdrop-filter: blur(22px);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xl), var(--glow-primary);
  pointer-events: auto;
  z-index: var(--z-dropdown);
}

.right-column {
  grid-column: 3;
  grid-row: 2;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  pointer-events: auto;
  z-index: var(--z-dropdown);
}

.top-row {
  grid-column: 1 / 4;
  grid-row: 1;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-xl);
  background: var(--bg-card);
  backdrop-filter: blur(var(--blur-md));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
  box-shadow: var(--shadow-md);
}

.navbar-section {
  display: flex;
  align-items: center;
}

.navbar-left {
  justify-content: flex-start;
}

.navbar-center {
  justify-content: center;
}

.navbar-right {
  justify-content: flex-end;
}

/* ============================================
   CARD COMPONENTS
   ============================================ */
.legend {
  background: var(--bg-card);
  backdrop-filter: blur(var(--blur-md));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  min-width: 240px;
  box-shadow: var(--shadow-md);
  pointer-events: auto;
}

.legend h2 {
  color: #a8b5d1;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  margin-bottom: var(--space-md);
  opacity: 0.7;
}

.legend-item {
  display: flex;
  align-items: center;
  margin: var(--space-xs) 0;
  padding: 0;
  background: transparent;
  border-radius: 0;
}

.legend-color {
  width: 20px;
  height: 3px;
  margin-right: var(--space-sm);
  border-radius: 2px;
}

.legend-text {
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}

/* ============================================
   INSTRUCTIONS PANEL
   ============================================ */
.instructions {
  background: var(--bg-card);
  backdrop-filter: blur(var(--blur-md));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  min-width: 240px;
  box-shadow: var(--shadow-md);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--text-tertiary);
  pointer-events: auto;
}

.instructions strong {
  color: var(--accent-primary);
  font-weight: var(--weight-semibold);
}

.instruction-hint {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-medium);
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-style: italic;
}

/* ============================================
   VIEW SETTINGS PANEL (REMOVED)
   View settings are now fixed: LOD always on with 10 labels max
   ============================================ */

/* ============================================
   INFO PANEL (Comparison Results)
   ============================================ */
.info-panel {
  background: var(--bg-card);
  backdrop-filter: blur(var(--blur-md));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
  pointer-events: auto;
}

.info-panel:hover {
  border-color: var(--border-medium);
}

.info-panel h3 {
  color: #a8b5d1;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  margin-bottom: var(--space-md);
  opacity: 0.7;
}

.vector-detail {
  margin: var(--space-md) 0;
  padding: var(--space-md);
  background: rgba(255, 255, 255, 0.02);
  border-left: 2px solid;
  border-radius: var(--radius-sm);
  transition: all var(--transition-base);
}

.vector-detail:hover {
  background: rgba(255, 255, 255, 0.04);
}

.vector-name {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-xs);
  letter-spacing: var(--tracking-snug);
  line-height: var(--leading-snug);
}

.vector-coords {
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
  margin-bottom: var(--space-xs);
  line-height: var(--leading-normal);
}

.vector-magnitude {
  color: var(--text-subtle);
  font-size: var(--text-sm);
}

/* ============================================
   COMPARISON METRICS
   ============================================ */
.comparison {
  margin: var(--space-lg) 0;
  padding: var(--space-md);
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.comparison-header {
  color: #a8b5d1;
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-md);
  font-size: var(--text-sm);
  letter-spacing: var(--tracking-snug);
}

.metric-card {
  margin: var(--space-sm) 0;
  padding: var(--space-md);
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-base);
}

.metric-card:hover {
  background: rgba(0, 0, 0, 0.3);
  border-color: var(--border-medium);
  transform: translateX(2px);
}

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

.metric-name {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.metric-value {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  padding: 4px var(--space-sm);
  border-radius: var(--radius-sm);
}

.metric-explanation {
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  margin-top: var(--space-xs);
}

/* Similarity color classes */
.high-similarity {
  color: var(--accent-primary);
  background: var(--accent-primary-muted);
}

.medium-similarity {
  color: var(--accent-warning);
  background: var(--accent-warning-muted);
}

.low-similarity {
  color: var(--accent-danger);
  background: var(--accent-danger-muted);
}

/* ============================================
   ADD VECTOR PANEL
   ============================================ */
.add-vector-panel {
  background: var(--bg-card);
  backdrop-filter: blur(var(--blur-md));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  min-width: 300px;
  box-shadow: var(--shadow-md);
  margin-top: auto;
  transition: all var(--transition-base);
}

.add-vector-panel:hover {
  border-color: var(--border-medium);
}

.add-vector-panel h3 {
  color: #a8b5d1;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  margin-bottom: var(--space-md);
  opacity: 0.7;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* ============================================
   FORM CONTROLS
   ============================================ */
.word-input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: var(--text-sm);
  margin-bottom: var(--space-sm);
  transition: all var(--transition-base);
}

.word-input:hover {
  background: var(--bg-input-hover);
}

.word-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  background: var(--bg-input-hover);
  box-shadow: 0 0 0 3px var(--accent-primary-muted);
}

.word-input::placeholder {
  color: var(--text-subtle);
}

.add-btn {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background: var(--state-hover-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.add-btn:hover {
  background: var(--state-active-bg);
  border-color: var(--border-focus);
  color: var(--text-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.add-btn:active {
  transform: translateY(0);
}

.add-btn:focus-visible {
  outline: 2px solid var(--state-focus-ring);
  outline-offset: 2px;
}

.add-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* ============================================
   STATUS MESSAGES
   ============================================ */
.status-message {
  position: absolute;
  top: calc(100% + var(--space-xs));
  left: 0;
  right: 0;
  padding: var(--space-sm);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  text-align: center;
  transition: all var(--transition-base);
  z-index: var(--z-dropdown);
  white-space: nowrap;
}

.status-message.success {
  background: var(--accent-primary-muted);
  border: 1px solid var(--accent-primary-border);
  color: var(--accent-primary);
}

.status-message.error {
  background: var(--accent-danger-muted);
  border: 1px solid var(--accent-danger-border);
  color: var(--accent-danger);
}

.status-message.loading {
  background: var(--accent-warning-muted);
  border: 1px solid var(--accent-warning-border);
  color: var(--accent-warning);
}

/* ============================================
   NAVBAR COMPACT COMPONENTS
   ============================================ */

/* Add Vector - Compact */
.navbar-left {
  position: relative;
}

.add-vector-compact {
  display: flex;
  gap: var(--space-xs);
  align-items: center;
}

.word-input-compact {
  padding: var(--space-sm) var(--space-md);
  background: rgba(74, 222, 128, 0.06);
  border: 1px solid var(--accent-primary-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: var(--text-base);
  min-width: 220px;
  transition: all var(--transition-base);
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.1);
}

.word-input-compact:hover {
  background: rgba(74, 222, 128, 0.1);
  border-color: var(--accent-primary);
  box-shadow: 0 0 16px rgba(74, 222, 128, 0.15);
}

.word-input-compact:focus {
  outline: none;
  border-color: var(--accent-primary);
  background: rgba(74, 222, 128, 0.1);
  box-shadow: 0 0 20px rgba(74, 222, 128, 0.2), 0 0 0 3px var(--accent-primary-muted);
}

.word-input-compact::placeholder {
  color: var(--accent-primary);
  opacity: 0.5;
}

.add-btn-compact {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  background: var(--accent-primary);
  color: #0a0e27;
  border: none;
  border-radius: var(--radius-sm);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.add-btn-compact:hover {
  background: var(--accent-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.add-btn-compact:active {
  transform: translateY(0);
}

.add-btn-compact:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.add-btn-compact svg {
  flex-shrink: 0;
}

.batch-btn-compact {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.batch-btn-compact:hover {
  background: var(--state-hover-bg);
  border-color: var(--border-strong);
  color: var(--text-secondary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.batch-btn-compact:active {
  transform: translateY(0);
}

.batch-btn-compact:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.batch-btn-compact svg {
  flex-shrink: 0;
}

/* Model Selector - Compact */
.model-selector-compact {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  align-items: center;
}

.model-label-compact {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

.model-label-compact svg {
  color: var(--accent-primary);
  flex-shrink: 0;
}

.model-select-compact {
  padding: var(--space-xs) var(--space-md);
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: all var(--transition-base);
  min-width: 160px;
  text-align: center;
}

.model-select-compact:hover {
  background: var(--bg-input-hover);
  border-color: var(--border-strong);
}

.model-select-compact:focus {
  outline: none;
  border-color: var(--accent-primary);
  background: var(--bg-input-hover);
  box-shadow: 0 0 0 3px var(--accent-primary-muted);
}

.model-select-compact option {
  background: var(--bg-primary);
  color: var(--text-primary);
}

/* Controls - Compact */
.controls-compact {
  display: flex;
  gap: var(--space-xs);
  align-items: center;
}

.control-btn-compact {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.control-btn-compact:hover {
  background: var(--state-hover-bg);
  border-color: var(--border-strong);
  color: var(--text-secondary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.control-btn-compact:active {
  transform: translateY(0);
}

.control-btn-compact svg {
  flex-shrink: 0;
}

/* ============================================
   MODEL SELECTOR (Legacy - kept for compatibility)
   ============================================ */
.model-selector-container {
  background: var(--bg-card);
  backdrop-filter: blur(var(--blur-md));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  min-width: 320px;
  flex: 1;
  max-width: 520px;
  transition: all var(--transition-base);
}

.model-selector-container:hover {
  border-color: var(--border-medium);
}

.model-label {
  color: #a8b5d1;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  opacity: 0.7;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.model-select {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition-base);
}

.model-select:hover {
  background: var(--bg-input-hover);
  border-color: var(--border-strong);
}

.model-select:focus {
  outline: none;
  border-color: var(--border-focus);
  background: var(--bg-input-hover);
  box-shadow: 0 0 0 3px var(--accent-primary-muted);
}

.model-select option {
  background: var(--bg-primary);
  color: var(--text-primary);
  padding: var(--space-xs);
}

/* ============================================
   CONTROL BUTTONS
   ============================================ */
.controls {
  background: var(--bg-card);
  backdrop-filter: blur(var(--blur-md));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  box-shadow: var(--shadow-md);
  display: flex;
  gap: var(--space-xs);
  transition: all var(--transition-base);
}

.controls:hover {
  border-color: var(--border-medium);
}

.controls-row {
  margin-left: auto;
}

.control-btn {
  padding: var(--space-xs) var(--space-md);
  margin: 0;
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.control-btn:hover {
  background: var(--state-hover-bg);
  border-color: var(--border-strong);
  color: var(--text-secondary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.control-btn:active {
  transform: translateY(0);
}

.control-btn:focus-visible {
  outline: 2px solid var(--state-focus-ring);
  outline-offset: 2px;
}

/* ============================================
   HELP TOOLTIPS
   ============================================ */
.help-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  z-index: 10;
}

.help-icon-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  background: var(--accent-primary-muted);
  border: 1px solid var(--accent-primary-border);
  color: var(--accent-primary);
  font-size: 11px;
  font-weight: var(--weight-bold);
  transition: all var(--transition-base);
}

.help-icon:hover .help-icon-text {
  background: rgba(74, 222, 128, 0.25);
  border-color: var(--accent-primary);
  transform: scale(1.1);
}

.help-tooltip {
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 15, 30, 0.98);
  border: 2px solid var(--accent-primary-border);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
  min-width: 300px;
  max-width: 360px;
  box-shadow: var(--shadow-md), var(--glow-focus);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-slow);
  pointer-events: none;
  z-index: 1000;
  text-transform: none;
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
  font-weight: var(--weight-normal);
  letter-spacing: var(--tracking-normal);
}

.help-tooltip strong {
  color: var(--accent-primary);
  font-size: var(--text-sm);
}

.tooltip-heading {
  display: block;
  color: var(--accent-primary);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-sm);
  line-height: var(--leading-snug);
}

.help-tooltip p {
  margin: var(--space-sm) 0;
  color: var(--text-tertiary);
  line-height: var(--leading-relaxed);
}

.tooltip-list {
  margin: var(--space-sm) 0;
  padding-left: var(--space-lg);
  list-style: none;
}

.tooltip-list li {
  position: relative;
  margin: var(--space-xs) 0;
  padding-left: var(--space-sm);
  color: var(--text-tertiary);
  line-height: var(--leading-normal);
}

.tooltip-list li::before {
  content: "→";
  position: absolute;
  left: -12px;
  color: var(--accent-primary);
  font-weight: var(--weight-bold);
}

.tooltip-list li strong {
  color: var(--accent-primary);
  font-weight: var(--weight-semibold);
}

.help-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-top-color: var(--accent-primary-border);
}

.help-icon:hover .help-tooltip {
  opacity: 1;
  visibility: visible;
  bottom: 140%;
}

/* Navbar tooltips - display below to avoid viewport overflow */
.navbar-left .help-icon .help-tooltip,
.navbar-center .help-icon .help-tooltip {
  bottom: auto;
  top: 130%;
}

.navbar-left .help-icon .help-tooltip::after,
.navbar-center .help-icon .help-tooltip::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: var(--accent-primary-border);
}

.navbar-left .help-icon:hover .help-tooltip,
.navbar-center .help-icon:hover .help-tooltip {
  bottom: auto;
  top: 140%;
}

/* ============================================
   LOADING OVERLAY (Model Switching)
   ============================================ */
.canvas-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 39, 0.92);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn var(--transition-base) ease-out;
  border-radius: inherit;
}

.canvas-overlay.fade-out {
  animation: fadeOut var(--transition-slow) ease-out;
}

.loading-spinner {
  width: 56px;
  height: 56px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-primary);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
  margin-bottom: var(--space-lg);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ============================================
   EMPTY STATES
   ============================================ */
.info-panel-empty {
  text-align: center;
  padding: var(--space-xl) 0;
}

.info-panel-empty .instructions {
  background: var(--state-hover-bg);
  border: 1px solid var(--border-tertiary);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
  text-align: left;
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
}

.info-panel-empty .instructions strong {
  color: var(--accent-primary);
  font-weight: var(--weight-semibold);
}

.info-panel-empty .instruction-hint {
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border-tertiary);
  font-style: italic;
  color: var(--text-tertiary);
}

.empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-lg);
  color: var(--text-muted);
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

.empty-hint {
  margin-top: var(--space-lg);
  padding: var(--space-md);
  background: rgba(74, 222, 128, 0.05);
  border: 1px solid var(--accent-primary-border);
  border-radius: var(--radius-md);
  text-align: left;
}

.hint-badge {
  display: inline-block;
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.2), rgba(59, 130, 246, 0.2));
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-lg);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--accent-primary);
  border: 1px solid var(--accent-primary-border);
}

/* Help Tour Button */
.help-tour-btn {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--accent-primary);
  color: #0a0e27;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: var(--weight-bold);
  box-shadow: var(--shadow-lg), 0 0 20px rgba(74, 222, 128, 0.4);
  transition: all var(--transition-base);
  z-index: var(--z-sticky);
}

.help-tour-btn:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-xl), 0 0 30px rgba(74, 222, 128, 0.6);
}

.help-tour-btn:active {
  transform: scale(1.05);
}

@media (max-width: 768px) {
  .help-tour-btn {
    bottom: var(--space-lg);
    right: var(--space-lg);
    width: 48px;
    height: 48px;
    font-size: 20px;
  }
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  transition: background var(--transition-base);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Tablet Layout (768px - 1199px) */
@media (max-width: 1200px) {
  #container {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 100vh;
    height: auto;
    padding: var(--space-md);
    gap: var(--space-md);
    align-items: center;
    overflow: visible;
  }

  .top-row {
    width: 100%;
    max-width: 100%;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: var(--space-md);
    order: 1;
  }

  .navbar-left,
  .navbar-center,
  .navbar-right {
    justify-content: stretch;
    width: 100%;
  }

  .add-vector-compact,
  .model-selector-compact,
  .controls-compact {
    width: 100%;
    justify-content: center;
  }

  .word-input-compact {
    flex: 1;
    min-width: 0;
  }

  .left-column {
    width: 100%;
    max-width: 800px;
    padding: var(--space-md);
    order: 2;
    display: flex;
    flex-direction: column;
  }

  .legend {
    order: 1;
  }

  .instructions {
    order: 3;
  }

  #canvas-container {
    width: 100%;
    max-width: 800px;
    height: 500px;
    min-height: 500px;
    border-radius: var(--radius-lg);
    order: 2;
    margin: 0 auto;
  }

  .right-column {
    width: 100%;
    max-width: 800px;
    padding: var(--space-md);
    order: 4;
  }

  .model-selector-container {
    min-width: 100%;
    max-width: 100%;
  }

  .legend,
  .instructions,
  .add-vector-panel {
    min-width: 100%;
  }

  .info-panel {
    max-width: 100%;
    max-height: none;
  }
}

/* Smaller Height Windows */
@media (max-height: 700px) {
  .left-column,
  .right-column {
    padding: var(--space-md);
  }

  .legend,
  .instructions,
  .add-vector-panel,
  .controls {
    padding: var(--space-md);
  }

  .legend {
    font-size: var(--text-sm);
  }

  .instructions {
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
  }

  .add-vector-panel {
    min-width: 240px;
  }

  .control-btn {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--text-sm);
  }

  .model-selector-container {
    padding: var(--space-md) var(--space-lg);
  }
}

/* Tablet Specific Adjustments */
@media (max-width: 1200px) and (max-height: 900px) {
  .info-panel {
    padding: var(--space-md);
    min-width: 280px;
    max-width: 100%;
  }

  .vector-detail {
    padding: var(--space-md);
    margin: var(--space-sm) 0;
  }

  .metric-card {
    padding: var(--space-sm);
    margin: var(--space-xs) 0;
  }
}

/* Mobile Layout (< 768px) */
@media (max-width: 768px) {
  #container {
    padding: var(--space-sm);
    gap: var(--space-sm);
  }

  .model-selector-container {
    min-width: 100%;
    max-width: 100%;
    padding: var(--space-md);
  }

  .model-label {
    font-size: var(--text-xs);
  }

  .model-select {
    font-size: var(--text-sm);
    padding: var(--space-xs) var(--space-sm);
  }

  .controls {
    flex-direction: column;
  }

  .control-btn {
    width: 100%;
  }

  #canvas-container {
    height: 350px;
    min-height: 350px;
    max-width: 100%;
  }

  .left-column,
  .right-column {
    max-width: 100%;
  }

  .top-row {
    padding: var(--space-sm) var(--space-md);
  }
}

/* ============================================
   VECTOR SEARCH
   ============================================ */
.search-container {
  background: var(--bg-card);
  backdrop-filter: blur(var(--blur-md));
  border: 1px solid var(--accent-info-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg) var(--space-md) var(--space-md);
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  position: relative;
}

.search-container::before {
  content: 'Search';
  position: absolute;
  top: var(--space-xs);
  left: var(--space-md);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--accent-info);
  opacity: 0.8;
}

/* Comparison Summary Mode */
.comparison-summary {
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.08) 0%, var(--bg-card) 100%);
  border: 2px solid var(--accent-primary-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-lg), 0 0 25px rgba(74, 222, 128, 0.15);
  pointer-events: auto;
}

.comparison-summary::before {
  display: none;
}

/* Reverse column order when in comparison mode */
.left-column:has(.legend-prominent) {
  flex-direction: column-reverse;
}

.legend-prominent {
  border: 2px solid var(--accent-primary-border);
  box-shadow: var(--shadow-lg), 0 0 30px rgba(74, 222, 128, 0.2);
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.05) 0%, var(--bg-card) 100%);
  padding: var(--space-xl);
}

.legend-prominent h2 {
  font-size: var(--text-base);
  color: var(--accent-primary);
}

.legend-prominent .legend-text {
  font-size: var(--text-base);
}

.comparison-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: #a8b5d1;
  opacity: 0.7;
  padding-bottom: var(--space-md);
}

.comparison-header {
  font-size: var(--text-lg);
  color: var(--text-primary);
  padding-bottom: var(--space-lg);
  letter-spacing: var(--tracking-snug);
}

.comparison-header strong {
  font-weight: var(--weight-semibold);
}

.comparison-metrics {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.comparison-metrics p {
  padding: var(--space-xs) 0;
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--text-tertiary);
}

.comparison-metrics strong {
  font-weight: var(--weight-semibold);
}

.comparison-metrics .high-similarity {
  color: var(--accent-primary);
}

.comparison-metrics .medium-similarity {
  color: var(--accent-warning);
}

.comparison-metrics .low-similarity {
  color: var(--accent-danger);
}

.comparison-metrics span {
  font-weight: var(--weight-medium);
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: var(--space-sm);
  color: var(--accent-info);
  opacity: 0.7;
  pointer-events: none;
  transition: all var(--transition-base);
}

.search-input-wrapper:focus-within .search-icon {
  opacity: 1;
}

.vector-search-input {
  width: 100%;
  padding: var(--space-sm) var(--space-sm) var(--space-sm) calc(var(--space-sm) + 24px);
  background: rgba(96, 165, 250, 0.06);
  border: 1px solid var(--accent-info-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  transition: all var(--transition-base);
  box-shadow: 0 0 10px rgba(96, 165, 250, 0.08);
}

.vector-search-input:hover {
  background: rgba(96, 165, 250, 0.1);
  border-color: var(--accent-info);
  box-shadow: 0 0 14px rgba(96, 165, 250, 0.12);
}

.vector-search-input:focus {
  outline: none;
  border-color: var(--accent-info);
  background: rgba(96, 165, 250, 0.1);
  box-shadow: 0 0 18px rgba(96, 165, 250, 0.18), 0 0 0 3px var(--accent-info-muted);
}

.vector-search-input::placeholder {
  color: var(--accent-info);
  opacity: 0.5;
}

.search-clear-btn {
  position: absolute;
  right: var(--space-xs);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-base);
}

.search-clear-btn:hover {
  background: var(--state-hover-bg);
  color: var(--accent-primary);
}

.search-results {
  margin-top: var(--space-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  max-height: 300px;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.search-result-item {
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  transition: all var(--transition-base);
  border-bottom: 1px solid var(--border-tertiary);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover,
.search-result-item.selected {
  background: var(--state-hover-bg);
}

.search-result-item.selected {
  border-left: 2px solid var(--accent-primary);
  padding-left: calc(var(--space-md) - 2px);
}

.search-result-name {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.result-text {
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: var(--font-mono);
}

.result-text strong {
  color: var(--accent-primary);
  font-weight: var(--weight-semibold);
}

.result-score {
  font-size: var(--text-xs);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-weight: var(--weight-medium);
}

.result-score.high {
  background: rgba(74, 222, 128, 0.2);
  color: var(--accent-primary);
}

.result-score.medium {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
}

.result-score.low {
  background: rgba(248, 113, 113, 0.2);
  color: #f87171;
}

/* Scrollbar styling for search results */
.search-results::-webkit-scrollbar {
  width: 6px;
}

.search-results::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}

.search-results::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: var(--radius-sm);
}

.search-results::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary-border);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .search-container {
    margin-bottom: var(--space-md);
    padding: var(--space-sm);
  }

  .search-results {
    max-height: 200px;
  }
}

/* ============================================
   IDEAS PANEL
   ============================================ */
.ideas-panel {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-lg);
  animation: fadeIn var(--transition-base);
}

.ideas-panel-content {
  background: var(--bg-secondary);
  border: 2px solid var(--accent-primary-border);
  border-radius: var(--radius-2xl);
  max-width: 900px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-2xl), var(--glow-info);
  animation: slideUp var(--transition-slow) ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ideas-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-tertiary);
  background: rgba(74, 222, 128, 0.05);
}

.ideas-panel-header h3 {
  color: var(--accent-primary);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  margin: 0;
}

.ideas-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all var(--transition-base);
}

.ideas-close-btn:hover {
  background: var(--state-hover-bg);
  color: var(--accent-primary);
}

.ideas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-lg);
  padding: var(--space-lg);
}

.idea-category {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
}

.idea-category h4 {
  color: var(--text-primary);
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  margin: 0 0 var(--space-sm) 0;
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--border-tertiary);
}

.idea-category ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.idea-category li {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  padding: var(--space-xs) 0;
  transition: color var(--transition-base);
}

.idea-category li:hover {
  color: var(--text-primary);
}

.idea-category li strong {
  color: var(--accent-primary);
  font-weight: var(--weight-semibold);
}

.ideas-footer {
  padding: var(--space-md) var(--space-lg);
  background: rgba(74, 222, 128, 0.05);
  border-top: 1px solid var(--border-tertiary);
  text-align: center;
}

.ideas-footer p {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.ideas-footer strong {
  color: var(--accent-primary);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .ideas-panel-content {
    max-width: 95vw;
    max-height: 90vh;
  }

  .ideas-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
    padding: var(--space-md);
  }

  .ideas-panel-header {
    padding: var(--space-md);
  }
}
