/* global-theme.css */
/* Advanced UI Aesthetics with Auto Dark Mode Support for Bootstrap 5 */

:root {
  /* Light Theme Variables */
  --bg-body-custom: #f8f9fa;
  --bg-sidebar-custom: #222e3c;
  --text-sidebar-custom: #ffffff;
  --sidebar-hover: #3b4a5a;
  
  --card-bg-custom: #ffffff;
  --card-shadow-custom: 0 4px 12px rgba(0,0,0,0.05);
  --card-border-custom: rgba(0,0,0,0.05);

  --accent-primary: #0d6efd;
  --accent-success: #198754;
  --accent-info: #0dcaf0;
  
  /* Table */
  --table-bg-custom: #ffffff;
  --table-border-custom: #e9ecef;
}

[data-bs-theme="dark"] {
  /* Dark Theme Variables */
  --bg-body-custom: #121212;
  --bg-sidebar-custom: #1a1d20;
  --text-sidebar-custom: #e9ecef;
  --sidebar-hover: #2c3034;
  
  --card-bg-custom: #1e1e1e;
  --card-shadow-custom: 0 4px 12px rgba(0,0,0,0.3);
  --card-border-custom: rgba(255,255,255,0.08);

  --accent-primary: #3b82f6;
  --accent-success: #22c55e;
  --accent-info: #38bdf8;
  
  /* Table */
  --table-bg-custom: #1e1e1e;
  --table-border-custom: #2d2d2d;
}

/* Global Body */
body {
  background-color: var(--bg-body-custom) !important;
  color: var(--bs-body-color); /* Bootstrap handles text color natively */
  transition: background-color 0.3s ease, color 0.3s ease;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Cards Enhancement */
.card {
  background-color: var(--card-bg-custom) !important;
  box-shadow: var(--card-shadow-custom) !important;
  border: 1px solid var(--card-border-custom) !important;
  border-radius: 12px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.1) !important;
}
[data-bs-theme="dark"] .card:hover {
  box-shadow: 0 8px 16px rgba(0,0,0,0.4) !important;
}

.card-header, .card-footer {
  background-color: transparent !important;
  border-color: var(--card-border-custom) !important;
}

/* Sidebar Enhancement */
.sidebar {
  background-color: var(--bg-sidebar-custom) !important;
  color: var(--text-sidebar-custom) !important;
  transition: background-color 0.3s ease;
  box-shadow: 2px 0 8px rgba(0,0,0,0.1);
}

.sidebar a {
  color: var(--text-sidebar-custom) !important;
  transition: background-color 0.2s ease, padding-left 0.2s ease;
  border-radius: 8px;
  margin: 0 12px 8px 12px;
}

.sidebar a:hover, .sidebar a.active {
  background-color: var(--sidebar-hover) !important;
  padding-left: 28px; /* Micro animation on hover */
}

/* Tables Enhancement */
.table, .table-responsive table {
  background-color: var(--table-bg-custom) !important;
  border-color: var(--table-border-custom) !important;
  border-radius: 8px;
  overflow: hidden;
}

[data-bs-theme="dark"] .table {
    color: #e9ecef;
}

[data-bs-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * {
    color: #e9ecef;
}

/* Forms Enhancement */
.form-control, .form-select {
  border-radius: 8px;
  border: 1px solid var(--card-border-custom);
  transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
  border-color: var(--accent-primary);
}

[data-bs-theme="dark"] .form-control, [data-bs-theme="dark"] .form-select {
  background-color: #2b2b2b;
  color: #fff;
  border-color: #444;
}

[data-bs-theme="dark"] .form-control::placeholder {
  color: #888;
}

/* Buttons Polish */
.btn {
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.2s;
}

.btn:active {
  transform: scale(0.97);
}

/* Specific component fixes for Bootstrap items in Dark Mode */
[data-bs-theme="dark"] .modal-content {
    background-color: var(--card-bg-custom);
    border-color: var(--card-border-custom);
}

[data-bs-theme="dark"] .text-bg-primary { background-color: #0d6efd !important; color: white !important; }
[data-bs-theme="dark"] .text-bg-success { background-color: #198754 !important; color: white !important; }
[data-bs-theme="dark"] .text-bg-danger { background-color: #dc3545 !important; color: white !important; }
[data-bs-theme="dark"] .text-bg-warning { background-color: #ffc107 !important; color: black !important; }
[data-bs-theme="dark"] .text-bg-info { background-color: #0dcaf0 !important; color: black !important; }
[data-bs-theme="dark"] .text-bg-secondary { background-color: #6c757d !important; color: white !important; }

/* Dashboard Card Texts (Icon + Numbers inside colored cards) */
/* We make sure they stay visible and pop in both light/dark */
[data-bs-theme="dark"] .card.text-bg-primary,
[data-bs-theme="dark"] .card.text-bg-success,
[data-bs-theme="dark"] .card.text-bg-danger,
[data-bs-theme="dark"] .card.text-bg-warning,
[data-bs-theme="dark"] .card.text-bg-info,
[data-bs-theme="dark"] .card.text-bg-secondary {
    border: none !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5) !important;
}

/* Remove hardcoded styles */
/* Any element styled via style="background: ..." inline will override this,
   we handle those via Node script replacement where needed */
