/**
 * STARPEACE ONLINE - Design System
 * Modern, lightweight design tokens and base styles
 */

/* ============================================
   CSS VARIABLES (Design Tokens)
   ============================================ */

:root {
  /* Primary Colors */
  --primary-blue: #0EA5E9;
  --primary-blue-dark: #0284C7;
  --primary-blue-light: #38BDF8;

  /* Background Colors */
  --bg-primary: #0F172A;      /* Slate 900 */
  --bg-secondary: #1E293B;    /* Slate 800 */
  --bg-tertiary: #334155;     /* Slate 700 */
  --surface: #1E293B;
  --surface-elevated: #334155;

  /* Text Colors */
  --text-primary: #F1F5F9;    /* Slate 100 */
  --text-secondary: #CBD5E1;  /* Slate 300 */
  --text-tertiary: #94A3B8;   /* Slate 400 */
  --text-muted: #64748B;      /* Slate 500 */

  /* Accent Colors */
  --success: #10B981;         /* Emerald 500 */
  --warning: #F59E0B;         /* Amber 500 */
  --error: #EF4444;           /* Red 500 */
  --info: #3B82F6;            /* Blue 500 */

  /* Glassmorphism */
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-bg-light: rgba(30, 41, 59, 0.5);
  --glass-border: rgba(148, 163, 184, 0.2);
  --glass-blur: blur(12px);

  /* Typography */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  /* Font Sizes */
  --text-xs: 0.75rem;    /* 12px */
  --text-sm: 0.875rem;   /* 14px */
  --text-base: 1rem;     /* 16px */
  --text-lg: 1.125rem;   /* 18px */
  --text-xl: 1.25rem;    /* 20px */
  --text-2xl: 1.5rem;    /* 24px */
  --text-3xl: 1.875rem;  /* 30px */

  /* Spacing */
  --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 */
  --space-12: 3rem;     /* 48px */

  /* Border Radius */
  --radius-sm: 0.375rem;  /* 6px */
  --radius-md: 0.5rem;    /* 8px */
  --radius-lg: 0.75rem;   /* 12px */
  --radius-xl: 1rem;      /* 16px */
  --radius-2xl: 1.5rem;   /* 24px */
  --radius-full: 9999px;  /* Pill shape */

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.5);

  /* Z-Index Scale */
  --z-base: 1;
  --z-dropdown: 1000;
  --z-sticky: 1100;
  --z-overlay: 2000;
  --z-modal: 3000;
  --z-tooltip: 4000;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   BASE STYLES
   ============================================ */

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

body {
  font-family: var(--font-primary);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.hidden {
  display: none !important;
}

/* ============================================
   BUTTON COMPONENTS
   ============================================ */

.btn {
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  text-decoration: none;
  user-select: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Primary Button */
.btn-primary {
  background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
  color: var(--text-primary);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  filter: brightness(1.1);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

/* Ghost Button */
.btn-ghost {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-lg);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(30, 41, 59, 0.95);
  border-color: var(--primary-blue);
  color: var(--primary-blue-light);
}

/* Icon Button */
.btn-icon {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  padding: var(--space-2);
  border-radius: var(--radius-md);
  width: 36px;
  height: 36px;
}

.btn-icon:hover:not(:disabled) {
  background: rgba(30, 41, 59, 0.95);
  border-color: var(--primary-blue);
  color: var(--primary-blue-light);
}

/* ============================================
   CARD COMPONENTS
   ============================================ */

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-md);
}

.card-glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-lg);
}

.card-elevated {
  background: var(--surface-elevated);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.card-elevated:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 0 2px var(--primary-blue);
}

/* ============================================
   INPUT COMPONENTS
   ============================================ */

.input {
  background: var(--bg-secondary);
  border: 2px solid var(--bg-tertiary);
  color: var(--text-primary);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-family: var(--font-primary);
  width: 100%;
  transition: all var(--transition-base);
}

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

.input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================
   BADGE COMPONENTS
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-error {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-info {
  background: rgba(59, 130, 246, 0.15);
  color: var(--info);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

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

@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(100%);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Animation Classes */
.animate-fadeIn {
  animation: fadeIn var(--transition-slow) ease-out;
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

* {
  scrollbar-width: thin;
  scrollbar-color: var(--bg-tertiary) var(--bg-secondary);
}

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

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

*::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--surface-elevated);
}

/* ============================================
   RESPONSIVE UTILITIES
   ============================================ */

@media (max-width: 640px) {
  :root {
    --text-3xl: 1.5rem;
    --text-2xl: 1.25rem;
  }
}

/* ============================================
   BUILDING DETAILS PANEL
   ============================================ */

.building-details-panel {
  position: absolute;
  width: 650px;
  max-height: 600px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  font-family: var(--font-primary);
  box-shadow: var(--shadow-2xl);
  z-index: var(--z-modal);
}

.building-details-header {
  padding: var(--space-4) var(--space-6);
  background: linear-gradient(135deg, var(--primary-blue-dark), var(--primary-blue));
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: move;
  user-select: none;
}

.header-title-container {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: white;
}

.header-icon {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
  font-weight: 700;
}

.header-title {
  font-weight: 600;
  font-size: var(--text-lg);
}

.header-subtitle {
  font-size: var(--text-xs);
  opacity: 0.9;
}

/* Header buttons container */
.header-buttons {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.header-delete-btn,
.header-refresh-btn,
.header-close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  font-size: var(--text-lg);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-delete-btn {
  background: rgba(239, 68, 68, 0.2); /* Red with transparency */
}

.header-delete-btn:hover {
  background: rgba(239, 68, 68, 0.4);
}

.header-refresh-btn:hover,
.header-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.header-refresh-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.header-refresh-btn:active:not(:disabled) {
  transform: rotate(180deg);
}

/* Building Details Tabs */
.building-details-tabs {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid var(--glass-border);
  overflow-x: auto;
}

.building-details-tabs .tab-btn {
  padding: var(--space-2) var(--space-3);
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  white-space: nowrap;
}

.building-details-tabs .tab-btn:hover {
  background: rgba(51, 65, 85, 0.5);
  border-color: var(--glass-border);
}

.building-details-tabs .tab-btn.active {
  background: var(--primary-blue);
  color: white;
  border-color: var(--primary-blue);
}

.building-details-tabs .tab-btn.tab-empty {
  opacity: 0.5;
}

.building-details-tabs .tab-icon {
  font-weight: 700;
}

/* Building Details Content */
.building-details-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  max-height: 420px;
}

.tab-no-data {
  padding: var(--space-6);
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
}

/* Building Details Footer */
.building-details-footer {
  padding: var(--space-3) var(--space-4);
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid var(--glass-border);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* Property Row Layout */
.property-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.property-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  background: var(--surface-elevated);
  border-radius: var(--radius-md);
  min-height: 40px;
}

.property-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: 500;
}

.property-value {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
}

/* Value type colors */
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }
.text-info { color: var(--info); }

/* Ratio Bar (Progress) */
.property-ratio {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.ratio-bar {
  width: 80px;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.ratio-fill {
  height: 100%;
  background: var(--primary-blue);
  border-radius: var(--radius-full);
  transition: width var(--transition-base);
}

.ratio-text {
  font-size: var(--text-xs);
  min-width: 50px;
}

/* Slider Control */
.property-slider-container {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.property-slider {
  width: 120px;
  height: 6px;
  appearance: none;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  cursor: pointer;
}

.property-slider::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--primary-blue);
  border-radius: 50%;
  cursor: grab;
  transition: transform var(--transition-fast);
}

.property-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.property-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.1);
}

.slider-value {
  min-width: 50px;
  text-align: right;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

/* Graph Styles */
.property-graph {
  background: var(--surface-elevated);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}

.graph-canvas {
  display: block;
  width: 100%;
}

.graph-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.graph-label-current {
  font-weight: 600;
  color: var(--text-primary);
}

.graph-trend.trend-up { color: var(--success); }
.graph-trend.trend-down { color: var(--error); }

.graph-empty, .graph-error {
  padding: var(--space-4);
  text-align: center;
  color: var(--text-muted);
}

/* Table Styles */
.property-table-container {
  background: var(--surface-elevated);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.supply-header {
  padding: var(--space-3);
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--glass-border);
  position: relative;
}

.search-connection-btn {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  padding: 2px 8px;
  font-size: var(--text-xs);
  background: rgba(52, 89, 80, 0.6);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.search-connection-btn:hover {
  background: rgba(52, 89, 80, 0.9);
}

.supply-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.supply-info {
  display: flex;
  gap: var(--space-4);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.property-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-xs);
}

.property-table th {
  padding: var(--space-2);
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--glass-border);
}

.property-table td {
  padding: var(--space-2);
  border-bottom: 1px solid var(--glass-border);
  color: var(--text-primary);
}

.property-table tr:last-child td {
  border-bottom: none;
}

.property-table tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

.connection-active td { color: var(--text-primary); }
.connection-inactive td { color: var(--text-muted); }

.cell-facility a {
  color: var(--primary-blue);
  text-decoration: none;
}

/* Rename UI Styles */
.header-title-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.rename-btn {
  background: transparent;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  opacity: 0.6;
}

.rename-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  opacity: 1;
}

.rename-input {
  background: var(--surface-base);
  border: 1px solid var(--primary-blue);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--text-base);
  font-weight: 600;
  padding: 4px 8px;
  outline: none;
  min-width: 200px;
}

.rename-confirm-btn{
  background: var(--surface-elevated);
  border: 1px solid currentColor;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 8px;
  transition: all 0.2s ease;
  margin-left: 4px;
}

.rename-cancel-btn {
  background: var(--surface-elevated);
  border: 1px solid currentColor;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 8px;
  transition: all 0.2s ease;
  margin-left: 4px;
}

.rename-confirm-btn {
  color: var(--success);
  border-color: var(--success);
}

.rename-confirm-btn:hover {
  background: var(--success);
  color: white;
}

.rename-cancel-btn {
  color: var(--error);
  border-color: var(--error);
}

.rename-cancel-btn:hover {
  background: var(--error);
  color: white;
}

.cell-facility a:hover {
  text-decoration: underline;
}

.status-connected {
  color: var(--success);
  font-weight: 600;
}

.status-disconnected {
  color: var(--text-muted);
}

.table-empty {
  padding: var(--space-4);
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
}

/* Nested Tabs (for supplies) */
.supplies-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.nested-tabs-nav {
  display: flex;
  gap: var(--space-1);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--glass-border);
}

.nested-tab-btn {
  padding: var(--space-1) var(--space-3);
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nested-tab-btn:hover {
  background: var(--surface-elevated);
}

.nested-tab-btn.active {
  background: var(--primary-blue);
  color: white;
}

.nested-tab-pane {
  display: none;
}

.nested-tab-pane.active {
  display: block;
}

.supplies-empty {
  padding: var(--space-4);
  text-align: center;
  color: var(--text-muted);
}

/* =============================================================================
   WORKFORCE TABLE
   ============================================================================= */

.workforce-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface-base);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.workforce-table thead {
  background: var(--surface-elevated);
}

.workforce-table th {
  padding: var(--space-3);
  text-align: center;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text-primary);
  border-bottom: 2px solid var(--glass-border);
}

.workforce-table th.workforce-label-col {
  width: 25%;
  text-align: left;
  padding-left: var(--space-4);
}

.workforce-table th.workforce-class-col {
  width: 25%;
}

.workforce-table tbody tr {
  border-bottom: 1px solid var(--glass-border);
  transition: background-color var(--transition-fast);
}

.workforce-table tbody tr:hover {
  background: var(--surface-elevated);
}

.workforce-table tbody tr:last-child {
  border-bottom: none;
}

.workforce-table td {
  padding: var(--space-3);
  text-align: center;
  font-size: var(--text-sm);
}

.workforce-table td.workforce-label {
  text-align: left;
  font-weight: 500;
  padding-left: var(--space-4);
  color: var(--text-primary);
}

.workforce-table td.workforce-value {
  color: var(--text-secondary);
}

/* Salary cell with price and input */
.workforce-salary-cell {
  padding: var(--space-2) var(--space-3);
  vertical-align: middle;
}

.workforce-salary-cell > * {
  display: block;
  margin: 0 auto;
}

.workforce-salary-cell .workforce-salary-price {
  margin-bottom: var(--space-1);
}

.workforce-salary-price {
  font-weight: 600;
  color: var(--success-green);
  font-size: var(--text-sm);
}

.workforce-salary-input {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.workforce-salary-input .salary-input {
  width: 60px;
  padding: var(--space-1) var(--space-2);
  background: var(--surface-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--text-sm);
  text-align: center;
  transition: all var(--transition-fast);
}

.workforce-salary-input .salary-input:hover {
  border-color: var(--primary-blue);
}

.workforce-salary-input .salary-input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.workforce-salary-input .percent-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: 500;
}

/* =============================================================================
   UPGRADE ACTIONS (Simplified Design)
   ============================================================================= */

.upgrade-actions-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--surface);
  border-radius: var(--radius-md);
  margin-top: var(--space-3);
}

/* Level text: "Level X/Y" or "Level X(+N)/Y" */
.upgrade-level-text {
  font-size: var(--text-base);
  color: var(--text-primary);
  font-weight: 600;
  font-family: var(--font-mono);
  margin-bottom: var(--space-2);
}

.upgrade-pending {
  color: var(--success);
  font-weight: 700;
  margin-left: 2px;
}

/* Upgrade row: Upgrade [-] [qty] [+] [OK] */
.upgrade-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.upgrade-label {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: var(--text-sm);
  min-width: 70px;
}

.upgrade-qty-input {
  width: 60px;
  height: 32px;
  padding: var(--space-1) var(--space-2);
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: var(--font-mono);
  text-align: center;
  transition: border-color var(--transition-fast);
}

.upgrade-qty-input:hover:not(:disabled) {
  border-color: var(--primary-blue);
}

.upgrade-qty-input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2);
}

.upgrade-qty-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.upgrade-decrement-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  background: var(--surface-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--text-lg);
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.upgrade-decrement-btn:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--text-secondary);
  color: var(--text-primary);
  transform: scale(1.05);
}

.upgrade-decrement-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.upgrade-decrement-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.upgrade-increment-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  background: var(--surface-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--success);
  font-size: var(--text-lg);
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.upgrade-increment-btn:hover:not(:disabled) {
  background: var(--success);
  border-color: var(--success);
  color: var(--text-primary);
  transform: scale(1.05);
}

.upgrade-increment-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.upgrade-increment-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.upgrade-validate-btn {
  padding: var(--space-2) var(--space-4);
  background: var(--primary-blue);
  border: 1px solid var(--primary-blue);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.upgrade-validate-btn:hover:not(:disabled) {
  background: var(--primary-blue-dark);
  border-color: var(--primary-blue-dark);
  transform: translateY(-1px);
}

.upgrade-validate-btn:active:not(:disabled) {
  transform: translateY(0);
}

.upgrade-validate-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Stop upgrade button (full width orange button, shown when upgrade is pending) */
.upgrade-stop-btn {
  width: 100%;
  padding: var(--space-2) var(--space-4);
  background: #ea580c;
  border: 1px solid #ea580c;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-3);
}

.upgrade-stop-btn:hover {
  background: #c2410c;
  border-color: #c2410c;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.3);
}

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

/* Downgrade button (full width red button) */
.downgrade-btn {
  width: 100%;
  padding: var(--space-2) var(--space-4);
  background: var(--error);
  border: 1px solid var(--error);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.downgrade-btn:hover:not(:disabled) {
  background: #b91c1c;
  border-color: #b91c1c;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.downgrade-btn:active:not(:disabled) {
  transform: translateY(0);
}

.downgrade-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ============================================
   DELETE CONFIRMATION DIALOG
   ============================================ */

.delete-confirmation-backdrop {
  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: 10000;
  animation: fadeIn 0.2s ease-out;
}

.delete-confirmation-dialog {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  width: 400px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: scaleIn 0.2s ease-out;
}

.delete-confirmation-dialog h3 {
  margin: 0 0 var(--space-4) 0;
  color: var(--error);
  font-size: var(--text-xl);
  font-weight: 600;
}

.delete-confirmation-dialog p {
  margin: 0 0 var(--space-6) 0;
  color: var(--text-secondary);
  font-size: var(--text-base);
  line-height: 1.6;
}

.delete-confirmation-buttons {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}

.delete-confirm-btn,
.delete-cancel-btn {
  padding: var(--space-2) var(--space-4);
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
}

.delete-confirm-btn {
  background: var(--error);
  color: white;
}

.delete-confirm-btn:hover {
  background: #DC2626; /* Darker red */
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

.delete-cancel-btn {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.delete-cancel-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

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

/* ============================================================================
   ROAD BUILDING MODE STYLES
   ============================================================================ */

/* Road building button active state */
.toolbar-btn.road-active {
  background: rgba(234, 88, 12, 0.3) !important;
  border-color: #ea580c !important;
  color: #fb923c !important;
  box-shadow: 0 0 10px rgba(234, 88, 12, 0.3);
}

.toolbar-btn.road-active:hover {
  background: rgba(234, 88, 12, 0.5) !important;
  border-color: #f97316 !important;
  color: #fdba74 !important;
}

/* Road drawing cursor hint */
.road-drawing-cursor {
  cursor: crosshair !important;
}

/* ============================================================================
   LOGOUT BUTTON STYLES
   ============================================================================ */

/* Logout button - positioned at end with separator space */
.toolbar-btn.logout-btn {
  margin-left: var(--space-3);
  border-left: 1px solid var(--glass-border);
  padding-left: var(--space-4);
}

.toolbar-btn.logout-btn:hover {
  background: rgba(239, 68, 68, 0.3) !important;
  border-color: #ef4444 !important;
  color: #fca5a5 !important;
}

/* Road preview tooltip */
.road-preview-tooltip {
  position: absolute;
  background: rgba(0, 0, 0, 0.9);
  color: #4ade80;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 600;
  pointer-events: none;
  z-index: 1000;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.road-preview-tooltip.invalid {
  color: #ff6b6b;
  border-color: rgba(255, 107, 107, 0.3);
}

/* Road mode notification */
.road-mode-notification {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(234, 88, 12, 0.9);
  color: white;
  padding: 10px 20px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 600;
  z-index: 1000;
  animation: slideDown 0.3s ease-out;
  box-shadow: var(--shadow-xl);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* =============================================================================
   DATA TABLE (PropertyType.TABLE — bank loans, votes, towns, taxes, etc.)
   ============================================================================= */

.data-table-container {
  width: 100%;
  overflow-x: auto;
}

.data-table-empty {
  padding: var(--space-4);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface-base);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.data-table thead {
  background: var(--surface-elevated);
}

.data-table th {
  padding: var(--space-2) var(--space-3);
  text-align: left;
  font-weight: 600;
  font-size: var(--text-xs);
  color: var(--text-primary);
  border-bottom: 2px solid var(--glass-border);
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--glass-border);
  transition: background-color var(--transition-fast);
}

.data-table tbody tr:hover {
  background: var(--surface-elevated);
}

.data-table tbody tr:last-child {
  border-bottom: none;
}

.data-table td {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.data-cell-currency {
  color: var(--success-green);
  font-weight: 500;
}

.data-cell-percentage {
  text-align: right;
}

.data-cell-number {
  text-align: right;
}

.data-cell-boolean {
  text-align: center;
}

/* Inline slider in table cells */
.table-cell-slider {
  width: 80px;
  height: 4px;
  vertical-align: middle;
  accent-color: var(--accent-primary);
}

.table-cell-slider-value {
  display: inline-block;
  width: 36px;
  text-align: right;
  font-size: var(--text-xs);
  color: var(--text-primary);
  margin-left: var(--space-1);
}

/* =============================================================================
   ENUM SELECT (PropertyType.ENUM — TradeRole, TradeLevel dropdowns)
   ============================================================================= */

.property-enum-select {
  background: var(--surface-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-sm);
  cursor: pointer;
}

.property-enum-select:hover {
  border-color: var(--accent-primary);
}

/* =============================================================================
   BOOLEAN CHECKBOX (editable boolean properties)
   ============================================================================= */

.property-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}
