/**
 * Dashboard Theme CSS
 * CSS Variables for theme customization
 * Based on fx_dashboard implementation
 */

/* Root CSS Variables - These are set dynamically by themeStore.js */
:root {
  /* Colors - Backgrounds */
  --color-background-primary: #121212;
  --color-background-secondary: #1E1E1E;
  --color-background-tertiary: #232323;

  /* Colors - Text */
  --color-text-primary: #FFFFFF;
  --color-text-secondary: #B0B0B0;
  --color-text-disabled: #6B6B6B;

  /* Colors - Accent */
  --color-primary: #BB86FC;
  --color-secondary: #03DAC6;
  --color-success: #81C784;
  --color-error: #CF6679;
  --color-warning: #FFB74D;
  --color-info: #64B5F6;

  /* Colors - Trading */
  --color-bullish: #00E676;
  --color-bearish: #FF5252;
  --color-neutral: #9E9E9E;

  /* Colors - UI Elements */
  --color-border: #2C2C2C;
  --color-divider: #2C2C2C;
  --color-hover: #232323;
  --color-selected: #2D2A4A;
  --color-disabled: #1E1E1E;

  /* Fonts - Heading */
  --font-heading-family: 'Roboto', sans-serif;
  --font-heading-size: 24px;
  --font-heading-weight: bold;
  --font-heading-style: normal;
  --font-heading-decoration: none;
  --font-heading-color: #FFFFFF;

  /* Fonts - Body */
  --font-body-family: 'Roboto', sans-serif;
  --font-body-size: 14px;
  --font-body-weight: normal;
  --font-body-style: normal;
  --font-body-decoration: none;
  --font-body-color: #FFFFFF;

  /* Fonts - Caption */
  --font-caption-family: 'Roboto', sans-serif;
  --font-caption-size: 12px;
  --font-caption-weight: normal;
  --font-caption-style: normal;
  --font-caption-decoration: none;
  --font-caption-color: #B0B0B0;

  /* Fonts - Button */
  --font-button-family: 'Roboto', sans-serif;
  --font-button-size: 14px;
  --font-button-weight: 500;
  --font-button-style: normal;
  --font-button-decoration: none;
  --font-button-color: #FFFFFF;

  /* Fonts - Code */
  --font-code-family: 'Courier New', monospace;
  --font-code-size: 13px;
  --font-code-weight: normal;
  --font-code-style: normal;
  --font-code-decoration: none;
  --font-code-color: #BB86FC;

  /* Spacing */
  --spacing-unit: 8px;

  /* Border Radius */
  --border-radius-sm: 4px;
  --border-radius-md: 8px;
  --border-radius-lg: 12px;
  --border-radius-xl: 16px;

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.6);
  --shadow-md: 0 4px 8px rgba(0,0,0,0.7);
  --shadow-lg: 0 8px 16px rgba(0,0,0,0.8);
  --shadow-xl: 0 12px 24px rgba(0,0,0,0.9);
}

/* Base body styles */
body {
  background: var(--color-background-primary);
  color: var(--color-text-primary);
  font-family: var(--font-body-family);
  font-size: var(--font-body-size);
  font-weight: var(--font-body-weight);
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading-family);
  font-weight: var(--font-heading-weight);
  color: var(--color-text-primary);
  margin: 0;
}

h1 { font-size: calc(var(--font-heading-size) * 2); }
h2 { font-size: calc(var(--font-heading-size) * 1.5); }
h3 { font-size: calc(var(--font-heading-size) * 1.25); }
h4 { font-size: var(--font-heading-size); }
h5 { font-size: calc(var(--font-heading-size) * 0.875); }
h6 { font-size: calc(var(--font-heading-size) * 0.75); }

p {
  font-family: var(--font-body-family);
  font-size: var(--font-body-size);
  color: var(--color-text-primary);
  line-height: 1.5;
}

small, .caption {
  font-family: var(--font-caption-family);
  font-size: var(--font-caption-size);
  color: var(--color-text-secondary);
}

code, pre {
  font-family: var(--font-code-family);
  font-size: var(--font-code-size);
  color: var(--color-text-secondary);
}

/* Cards */
.card {
  background: var(--color-background-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-sm);
  color: var(--color-text-primary);
}

.card-header {
  background: var(--color-background-tertiary);
  border-bottom: 1px solid var(--color-divider);
  padding: calc(var(--spacing-unit) * 2);
}

.card-body {
  padding: calc(var(--spacing-unit) * 2);
}

.card-footer {
  background: var(--color-background-tertiary);
  border-top: 1px solid var(--color-divider);
  padding: calc(var(--spacing-unit) * 2);
}

/* Buttons */
.btn {
  font-family: var(--font-button-family);
  font-size: var(--font-button-size);
  font-weight: var(--font-button-weight);
  border-radius: var(--border-radius-sm);
  padding: calc(var(--spacing-unit) * 1) calc(var(--spacing-unit) * 2);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--font-button-color);
}

.btn-primary:hover {
  filter: brightness(1.1);
}

.btn-secondary {
  background: var(--color-secondary);
  color: var(--font-button-color);
}

.btn-secondary:hover {
  filter: brightness(1.1);
}

.btn-success {
  background: var(--color-success);
  color: var(--font-button-color);
}

.btn-error {
  background: var(--color-error);
  color: var(--font-button-color);
}

.btn-warning {
  background: var(--color-warning);
  color: var(--font-button-color);
}

.btn-info {
  background: var(--color-info);
  color: var(--font-button-color);
}

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-background-secondary);
  color: var(--color-text-primary) !important;
}

.table thead {
  background: var(--color-background-tertiary);
  border-bottom: 2px solid var(--color-divider);
}

.table th {
  padding: calc(var(--spacing-unit) * 1.5);
  text-align: left;
  font-weight: var(--font-heading-weight);
  color: var(--color-text-primary) !important;
}

.table td {
  padding: calc(var(--spacing-unit) * 1.5);
  border-bottom: 1px solid var(--color-divider);
  color: var(--color-text-primary) !important;
}

.table tbody tr {
  color: var(--color-text-primary) !important;
}

.table tbody tr:hover {
  background: var(--color-hover);
}

/* Force white text in dark and grey themes for tables */
[data-theme="dark"] .table,
[data-theme="dark"] .table th,
[data-theme="dark"] .table td,
[data-theme="dark"] .table tbody tr,
[data-theme="grey"] .table,
[data-theme="grey"] .table th,
[data-theme="grey"] .table td,
[data-theme="grey"] .table tbody tr {
  color: #FFFFFF !important;
}

/* Fix table headers - ensure proper background colors in dark/grey themes */
[data-theme="dark"] .table thead,
[data-theme="grey"] .table thead {
  background: var(--color-background-tertiary) !important;
}

[data-theme="dark"] .table thead th,
[data-theme="grey"] .table thead th {
  background: var(--color-background-tertiary) !important;
  color: #FFFFFF !important;
}

/* Ensure table has proper background in dark themes */
[data-theme="dark"] .table,
[data-theme="grey"] .table {
  background: var(--color-background-secondary) !important;
}

/* Forms */
.form-control, input, textarea, select {
  background: var(--color-background-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  color: var(--color-text-primary);
  padding: calc(var(--spacing-unit) * 1);
  font-family: var(--font-body-family);
  font-size: var(--font-body-size);
}

.form-control:focus, input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(187, 134, 252, 0.2);
}

.form-label {
  color: var(--color-text-primary);
  font-weight: var(--font-heading-weight);
  margin-bottom: calc(var(--spacing-unit) * 0.5);
  display: block;
}

/* Navigation */
.navbar {
  background: var(--color-background-secondary);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.nav-link {
  color: var(--color-text-secondary);
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: var(--color-primary);
}

.nav-link.active {
  color: var(--color-primary);
  font-weight: var(--font-heading-weight);
}

/* Modals */
.modal-content {
  background: var(--color-background-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-xl);
  color: var(--color-text-primary);
}

.modal-header {
  background: var(--color-background-tertiary);
  border-bottom: 1px solid var(--color-divider);
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.modal-footer {
  background: var(--color-background-tertiary);
  border-top: 1px solid var(--color-divider);
  border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}

/* Alerts */
.alert {
  border-radius: var(--border-radius-sm);
  padding: calc(var(--spacing-unit) * 2);
  margin-bottom: calc(var(--spacing-unit) * 2);
}

.alert-success {
  background: var(--color-success);
  color: var(--font-button-color);
  border: 1px solid var(--color-success);
}

.alert-error {
  background: var(--color-error);
  color: var(--font-button-color);
  border: 1px solid var(--color-error);
}

.alert-warning {
  background: var(--color-warning);
  color: var(--font-button-color);
  border: 1px solid var(--color-warning);
}

.alert-info {
  background: var(--color-info);
  color: var(--font-button-color);
  border: 1px solid var(--color-info);
}

/* Badges */
.badge {
  display: inline-block;
  padding: calc(var(--spacing-unit) * 0.5) calc(var(--spacing-unit) * 1);
  font-size: var(--font-caption-size);
  font-weight: var(--font-button-weight);
  border-radius: var(--border-radius-sm);
}

.badge-primary {
  background: var(--color-primary);
  color: var(--font-button-color);
}

.badge-success {
  background: var(--color-success);
  color: var(--font-button-color);
}

.badge-error {
  background: var(--color-error);
  color: var(--font-button-color);
}

.badge-warning {
  background: var(--color-warning);
  color: var(--font-button-color);
}

/* KPI Cards */
.kpi-card {
  background: var(--color-background-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-md);
  padding: calc(var(--spacing-unit) * 2);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-value {
  font-size: calc(var(--font-heading-size) * 1.5);
  font-weight: var(--font-heading-weight);
  color: var(--color-primary);
}

.kpi-label {
  font-size: var(--font-caption-size);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Dividers */
hr {
  border: none;
  border-top: 1px solid var(--color-divider);
  margin: calc(var(--spacing-unit) * 2) 0;
}

/* Links */
a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--color-secondary);
  text-decoration: underline;
}

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

::-webkit-scrollbar-track {
  background: var(--color-background-primary);
}

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

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

/* Dashboard Header Icon Fix */
[data-theme="dark"] .header img,
[data-theme="grey"] .header img {
  filter: invert(1) brightness(2);
}

[data-theme="dark"] .header,
[data-theme="grey"] .header {
  background: var(--color-background-secondary) !important;
}

/* Utility Classes */
.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-success { color: var(--color-success); }
.text-error { color: var(--color-error); }
.text-warning { color: var(--color-warning); }
.text-info { color: var(--color-info); }
.text-muted { color: var(--color-text-disabled); }

.bg-primary { background: var(--color-background-primary); }
.bg-secondary { background: var(--color-background-secondary); }
.bg-tertiary { background: var(--color-background-tertiary); }

.border { border: 1px solid var(--color-border); }
.border-top { border-top: 1px solid var(--color-border); }
.border-bottom { border-bottom: 1px solid var(--color-border); }
.border-left { border-left: 1px solid var(--color-border); }
.border-right { border-right: 1px solid var(--color-border); }

.rounded-sm { border-radius: var(--border-radius-sm); }
.rounded-md { border-radius: var(--border-radius-md); }
.rounded-lg { border-radius: var(--border-radius-lg); }
.rounded-xl { border-radius: var(--border-radius-xl); }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }

/* Grey theme specific colors for main page titles */
[data-theme="grey"] .nav-card h2,
[data-theme="grey"] .nav-card h5 {
  color: #152027 !important;
}

/* Fix explanation text color in alert-info to be black/dark for all themes */
.alert-info {
  color: #000000 !important;
}

.alert-info strong {
  color: #000000 !important;
}

/* Grey theme - slightly darker form fields for better contrast */
[data-theme="grey"] .form-control,
[data-theme="grey"] input,
[data-theme="grey"] textarea,
[data-theme="grey"] select {
  background: rgba(0, 0, 0, 0.15) !important;
  color: #FFFFFF !important;
  border: 1px solid rgba(0, 0, 0, 0.2) !important;
}

[data-theme="grey"] .form-control:focus,
[data-theme="grey"] input:focus,
[data-theme="grey"] textarea:focus,
[data-theme="grey"] select:focus {
  background: rgba(0, 0, 0, 0.15) !important;
  border-color: var(--color-primary) !important;
}

/* Form labels and card titles in grey theme */
[data-theme="grey"] .form-label {
  color: #FFFFFF !important;
}

/* Fix textbox titles under חלוקת תשלומים and הוצאה חוזרת in grey theme */
[data-theme="grey"] .card-body label,
[data-theme="grey"] .card-body .form-label,
[data-theme="grey"] label {
  color: #4a4a4a !important;
}

/* Dark theme - form fields with specific background color */
[data-theme="dark"] .form-control,
[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background: #474D5A !important;
  color: #FFFFFF !important;
  border: 1px solid #5a6070 !important;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus {
  background: #474D5A !important;
  border-color: var(--color-primary) !important;
}

/* Grey theme - darker green in KPI cards and darker titles */
[data-theme="grey"] .kpi-positive {
  color: #2E7D32 !important; /* Darker green for better visibility */
}

[data-theme="grey"] .kpi-title {
  color: #424242 !important; /* Darker grey for titles */
}

[data-theme="grey"] .chart-title {
  color: #212121 !important; /* Darker grey for chart titles */
}
