/* ============================================
   Dark Theme
   Minimal set of overrides actually used by core CSS
   ============================================ */

:root {
  /* Semantic Colors */
  --color-primary: #60a5fa;
  --color-success: #22c55e;
  --color-warning: #fbbf24;
  --color-error: #ef4444;
  --color-accent: #a78bfa; /* purple accent — graph center node, special highlights */

  /* Text Colors */
  --color-text-primary: rgba(255, 255, 255, 0.95);
  --color-text-secondary: rgba(255, 255, 255, 0.70);
  --color-text-tertiary: rgba(255, 255, 255, 0.55);
  --color-text-muted: rgba(255, 255, 255, 0.50);

  /* Background Colors */
  --color-bg-primary: #292929;
  --color-bg-secondary: rgba(40, 40, 40, 0.35);
  --color-surface: rgba(55, 55, 55, 0.8);
  /* Непрозрачный фон выпадающих меню («Ещё»): темнее фона страницы, без прозрачности. */
  --color-menu-surface: #1f1f1f;
  --color-code-bg: rgba(0, 0, 0, 0.35);

  /* Border Colors */
  --color-border: rgba(255, 255, 255, 0.20);
  --color-border-light: rgba(255, 255, 255, 0.08);
  --color-border-lighter: rgba(255, 255, 255, 0.06);

  /* Interactive States */
  --color-hover: rgba(255, 255, 255, 0.06);
  --color-hover-bg: rgba(255, 255, 255, 0.08);
  --color-active: rgba(255, 255, 255, 0.12);
  --color-disabled: rgba(255, 255, 255, 0.38);

  /* Link Colors */
  --color-link: #93c5fd;
  --color-link-hover: #bfdbfe;

  /* Table Colors */
  --table-header-bg: rgba(40, 40, 40, 1);
  --table-header-fg: rgba(255, 255, 255, 0.95);
  --table-row-odd: rgba(30, 41, 59, 0.15);
  --table-row-even: rgba(30, 41, 59, 0.25);
  --color-surface-alt: rgba(42, 48, 62, 0.85);
  --table-row-hover: rgba(255, 255, 255, 0.08);
  --table-row-selected: rgba(200, 170, 110, 0.25);
  
  /* Table Crosshair Highlight Colors */
  --table-crosshair-row: rgba(252, 252, 250, 0.04);
  --table-crosshair-col: rgba(250, 250, 250, 0.04);
  --table-crosshair-cell: rgba(250, 250, 250, 0.08);

  /* Button Variant Colors */
  --btn-primary-bg: #60a5fa;
  --btn-primary-hover: #93c5fd;
  --btn-primary-text: #ffffff;

  --btn-secondary-bg: rgba(71, 85, 105, 0.9);
  --btn-secondary-hover: rgba(100, 116, 139, 0.9);
  --btn-secondary-text: #ffffff;

  --btn-ghost-bg: transparent;
  --btn-ghost-hover: rgba(255, 255, 255, 0.10);
  --btn-ghost-text: rgba(255, 255, 255, 0.80);

  /* Badge Colors */
  --badge-primary-bg: rgba(96, 165, 250, 0.20);
  --badge-primary-text: #60a5fa;
  --badge-primary-border: rgba(96, 165, 250, 0.30);

  --badge-success-bg: rgba(34, 197, 94, 0.20);
  --badge-success-text: #22c55e;
  --badge-success-border: rgba(34, 197, 94, 0.30);

  --badge-warning-bg: rgba(251, 191, 36, 0.20);
  --badge-warning-text: #fbbf24;
  --badge-warning-border: rgba(251, 191, 36, 0.30);

  --badge-error-bg: rgba(239, 68, 68, 0.20);
  --badge-error-text: #ef4444;
  --badge-error-border: rgba(239, 68, 68, 0.30);

  --badge-neutral-bg: rgba(255, 255, 255, 0.20);
  --badge-neutral-text: rgba(255, 255, 255, 0.85);
  --badge-neutral-border: rgba(255, 255, 255, 0.30);

  --badge-accent-bg: rgba(167, 139, 250, 0.18);
  --badge-accent-text: #a78bfa;
  --badge-accent-border: rgba(167, 139, 250, 0.35);

  /* Tab Colors */
  --tab-text: rgba(255, 255, 255, 0.70);
  --tab-text-active: #60a5fa;
  --tab-border-active: #60a5fa;

  /* Modal Colors */
  --modal-overlay: rgba(0, 0, 0, 0.50);
  --modal-bg: #292929;
  --modal-border: rgba(255, 255, 255, 0.20);
  --modal-header-bg: rgba(255, 255, 255, 0.05);

  /* Sidebar Colors */
  --sidebar-bg: rgba(42, 45, 51, 0.2);
  --sidebar-text: rgba(255, 255, 255, 0.9);
  --sidebar-text-active: #93c5fd;
  --sidebar-item-hover: rgba(255, 255, 255, 0.10);
  --sidebar-item-active-bg: rgba(96, 165, 250, 0.20);
  --sidebar-item-active-border: #60a5fa;
  --sidebar-header-bg: rgba(40, 45, 55, 0.70);
  --sidebar-header-border: rgba(255, 255, 255, 0.15);
  --sidebar-border: rgba(255, 255, 255, 0.15);

  /* Header Colors */
  --header-bg: rgba(64, 72, 76, 0.85);
  --page-header-bg-solid: rgba(64, 72, 76, 0.85);
  --header-text: #ffffff;
  --header-border: rgba(255, 255, 255, 0.15);
  --header-noise-opacity: 0.01;

  /* Top Header Colors */
  --top-header-bg: rgba(17, 24, 39, 0.35);
  --top-header-text: #ffffff;
  --top-header-border: rgba(255, 255, 255, 0.20);
  --top-header-btn-hover: rgba(255, 255, 255, 0.10);

  /* Panel Colors — альфа учитывает снятый с .app-panel `opacity: 0.8`
     (он гасил заодно и текст панели) */
  --panel-bg: rgba(30, 35, 45, 0.24);
  --panel-border: rgba(255, 255, 255, 0.15);
  --panel-resizer-hover: rgba(255, 255, 255, 0.10);

  /* Card Colors */
  --card-bg: rgba(30, 41, 59, 0.25);
  --card-border: rgba(255, 255, 255, 0.10);
  --card-hover-bg: rgba(0, 0, 0, 0.20);
  --card-hover-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);

  /* Form Colors */
  --form-label-text: rgb(105, 162, 211);
  --form-input-bg: rgba(255, 255, 255, 0);
  --form-input-border: rgba(255, 255, 255, 0.20);
  --form-input-focus-border: #60a5fa;
  --form-input-focus-shadow: rgba(96, 165, 250, 0.20);
  --form-placeholder: rgba(255, 255, 255, 0.40);
  --form-input-readonly-bg: rgba(255, 255, 255, 0.05);

  /* Info/Warning/Code Box Colors */
  --info-box-bg: rgba(96, 165, 250, 0.08);
  --info-box-border: rgba(96, 165, 250, 0.25);

  --warning-box-bg: rgba(251, 191, 36, 0.08);
  --warning-box-border: rgba(251, 191, 36, 0.30);
  --warning-box-text-color: #fbbf24;

  --code-box-bg: rgba(0, 0, 0, 0.30);
  --code-box-border: rgba(255, 255, 255, 0.15);
  --code-box-text: rgba(255, 255, 255, 0.70);

  /* Cross-theme behavior tokens */
  --app-bg-color: var(--color-bg-primary);
  --app-bg-image: none;
  /* Лист непрозрачен → бар вкладок продолжает шапку (см. layout.css) */
  --sheet-bg: var(--color-bg-primary);
  --tabs-bar-bg: var(--header-bg);
  --form-select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");

  /* Color scale tokens used by core utilities */
  --color-primary-50: rgba(96, 165, 250, 0.10);
  --color-primary-100: rgba(96, 165, 250, 0.20);
  --color-primary-200: rgba(96, 165, 250, 0.35);
  --color-primary-700: #93c5fd;
  --color-primary-800: rgba(96, 165, 250, 0.35);
  --color-primary-900: rgba(96, 165, 250, 0.20);

  --color-success-600: #22c55e;
  --color-success-700: #16a34a;
  --color-success-50: rgba(34, 197, 94, 0.10);
  --color-success-100: rgba(34, 197, 94, 0.22);
  --color-success-200: rgba(34, 197, 94, 0.35);
  --color-success-500: #22c55e;
  --color-success-900: rgba(34, 197, 94, 0.20);
  --color-error-200: rgba(239, 68, 68, 0.35);
  --color-btn-primary-text: #0b1220;

  --color-warning-50: rgba(251, 191, 36, 0.12);
  --color-warning-100: rgba(251, 191, 36, 0.22);
  --color-warning-200: rgba(251, 191, 36, 0.35);
  --color-warning-500: #f59e0b;
  --color-warning-600: #d97706;
  --color-warning-700: #b45309;

  --color-error-50: rgba(239, 68, 68, 0.10);
  --color-error-100: rgba(239, 68, 68, 0.22);
  --color-error-600: #dc2626;
  --color-error-700: #b91c1c;

  --color-info-600: #0ea5e9;
  --color-info-700: #0284c7;

  --color-neutral-50: rgba(255, 255, 255, 0.06);
  --color-neutral-100: rgba(255, 255, 255, 0.08);
  --color-neutral-200: rgba(255, 255, 255, 0.14);
  --color-neutral-600: rgba(255, 255, 255, 0.70);
  --color-neutral-700: rgba(255, 255, 255, 0.16);
  --color-neutral-800: rgba(30, 41, 59, 0.60);

  /* Status badge colors */
  --badge-status-posted-bg: rgba(34, 197, 94, 0.22);
  --badge-status-posted-text: #22c55e;
  --badge-status-posted-border: rgba(34, 197, 94, 0.35);
  --badge-status-not-posted-bg: rgba(251, 191, 36, 0.22);
  --badge-status-not-posted-text: #fbbf24;
  --badge-status-not-posted-border: rgba(251, 191, 36, 0.35);

  /* Sidebar scrollbar (was missing in dark theme — black thumb on dark bg = invisible) */
  --sidebar-scrollbar-thumb: rgba(255, 255, 255, 0.18);
  --sidebar-scrollbar-thumb-hover: rgba(255, 255, 255, 0.30);

  /* List/table scrollbar (content areas) */
  --list-scrollbar-track: rgba(0, 0, 0, 0.15);
  --list-scrollbar-thumb: rgba(255, 255, 255, 0.20);
  --list-scrollbar-thumb-hover: rgba(255, 255, 255, 0.32);

  /* GL dimension chip colors (brighter for dark backgrounds) */
  --gl-dim-day:     #22d3ee;
  --gl-dim-cab:     #60a5fa;
  --gl-dim-regtype: #a78bfa;
  --gl-dim-layer:   #fbbf24;
  --gl-dim-regref:  #f472b6;
  --gl-dim-nom:     #4ade80;
  --gl-dim-uf:      #2dd4bf;
  --gl-dim-fulf:    #c084fc;
  --gl-dim-sys:     #94a3b8;

  /* GL layer badge text colors (brighter for dark backgrounds) */
  --gl-layer-oper:  #60a5fa;
  --gl-layer-fact:  #22d3ee;
  --gl-layer-plan:  #a78bfa;

  /* Палитра бейджей приложения — ярче для тёмного фона. */
  --gl-badge-amber:  #fbbf24;
  --gl-badge-green:  #4ade80;
  --gl-badge-pink:   #f472b6;
  --gl-badge-violet: #c084fc;
  --gl-badge-blue:   #60a5fa;
  --gl-badge-teal:   #2dd4bf;
  --gl-badge-slate:  #94a3b8;

  /* Интерфейс BI (ADR-0023): своя спокойная палитра поверх темы. Рамка и
     дашборд (iframe) красятся одними токенами. */
  --bi-bg: #0e1722;
  --bi-surface: #162331;
  --bi-surface-soft: #192939;
  --bi-text: #e3ebf4;
  --bi-muted: #a0b1c3;
  --bi-faint: #8c9fb3;
  --bi-border: #2a3a4c;
  --bi-accent: #79c1e3;
  --bi-accent-soft: #1b3749;
  --bi-active: #156082;
  --bi-active-text: #ffffff;
  --bi-hover: #213447;
  --bi-shadow: 0 8px 40px -20px rgba(0, 0, 0, 0.5);
  /* Центр подложки диаграмм (UI-061): к краям уходит в --bi-bg. */
  --bi-chart-glow: rgba(52, 78, 106, 0.32);
  --bi-focus: #70c9ef;
  --bi-notice: #ddb578;
  --bi-series-1: #156082;
  --bi-series-2: #e97132;
  --bi-series-3: #196b24;
  --bi-series-4: #0f9ed5;
  --bi-series-5: #a02b93;
  --bi-series-6: #4ea72e;
}
