/* Light Theme */
.theme-light {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --text-primary: #212529;
  --text-secondary: #6c757d;
  --border-color: #dee2e6;
  --sidebar-bg: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
  --sidebar-text: #ecf0f1;
  --sidebar-text-muted: #bdc3c7;
  --sidebar-hover: rgba(255, 255, 255, 0.1);
  --sidebar-active: rgba(255, 255, 255, 0.2);
  --navbar-brand-color: #ffffff;
  --navbar-text-color: #ecf0f1;
  --input-bg: #ffffff;
  --input-border: #dee2e6;
  --input-text: #495057;
  --card-bg: #ffffff;
  --modal-bg: #ffffff;
  --modal-header-bg: #f8f9fa;
  --dropdown-bg: #ffffff;
  --dropdown-border: #dee2e6;
  --dropdown-link-color: #212529;
  --dropdown-link-hover-bg: #f8f9fa;
  --hover-bg: #f8f9fa;
  --primary-blue: #1e3c72;
  --primary-blue-light: #2a5298;
}

/* Dark Theme */
.theme-dark {
  --bg-primary: #212529;
  --bg-secondary: #343a40;
  --text-primary: #ffffff;
  --text-secondary: #adb5bd;
  --border-color: #495057;
  --sidebar-bg: linear-gradient(180deg, #1a1d29 0%, #1e3a5f 100%);
  --sidebar-text: #e8eaf6;
  --sidebar-text-muted: #9fa8b3;
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --sidebar-active: rgba(255, 255, 255, 0.15);
  --navbar-brand-color: #ffffff;
  --navbar-text-color: #e8eaf6;
  --input-bg: #2d3748;
  --input-border: #4a5568;
  --input-text: #f7fafc;
  --card-bg: #2d3748;
  --modal-bg: #2d3748;
  --modal-header-bg: #1a202c;
  --dropdown-bg: #343a40;
  --dropdown-border: #495057;
  --dropdown-link-color: #ffffff;
  --dropdown-link-hover-bg: #495057;
  --hover-bg: #3d4449;
  --primary-blue: #1e3c72;
  --primary-blue-light: #2a5298;
}

/* Body */
.theme-light body,
.theme-dark body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Cards */
.theme-light .card,
.theme-dark .card {
  background-color: var(--card-bg);
  border-color: var(--border-color);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.theme-dark .card-header {
  background-color: var(--bg-secondary);
  border-bottom-color: var(--border-color);
}

/* Navbar/Top Row */
.theme-light .top-row,
.theme-light .navbar,
.theme-dark .top-row,
.theme-dark .navbar {
  background: var(--sidebar-bg) !important;
  color: var(--navbar-text-color) !important;
}

.theme-light .navbar-brand,
.theme-dark .navbar-brand {
  color: var(--navbar-brand-color) !important;
}

.theme-dark .navbar-toggler {
  border-color: rgba(255, 255, 255, 0.3) !important;
}

.theme-dark .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

/* Sidebar */
.theme-light .sidebar,
.theme-dark .sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
}

/* Form Controls */
.theme-light .form-control,
.theme-dark .form-control {
  background-color: var(--input-bg);
  border-color: var(--input-border);
  color: var(--input-text);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.theme-dark .form-control:focus {
  background-color: var(--input-bg);
  color: var(--input-text);
  border-color: #4a90e2;
  box-shadow: 0 0 0 0.25rem rgba(74, 144, 226, 0.25);
}

.theme-dark .form-control::placeholder {
  color: var(--text-secondary);
}

/* Form Validation */
.theme-dark .form-control.is-invalid {
  border-color: #dc3545;
  background-color: var(--input-bg);
  color: var(--input-text);
}

.theme-dark .form-control.is-valid {
  border-color: #28a745;
  background-color: var(--input-bg);
  color: var(--input-text);
}

.theme-dark .invalid-feedback {
  color: #f8d7da;
}

.theme-dark .valid-feedback {
  color: #d4edda;
}

/* Text Colors */
.theme-light .text-muted,
.theme-dark .text-muted {
  color: var(--text-secondary) !important;
}

/* Modals */
.theme-dark .modal-content {
  background-color: var(--modal-bg);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.theme-dark .modal-header {
  background-color: var(--modal-header-bg);
  border-bottom-color: var(--border-color);
}

.theme-dark .modal-footer {
  border-top-color: var(--border-color);
}

.theme-dark .modal-backdrop {
  background-color: rgba(0, 0, 0, 0.8);
}

/* Close Button */
.theme-light .btn-close {
  background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='m.235.867 4.805 4.805-4.805 4.805.708.708 4.805-4.805 4.805 4.805.708-.708-4.805-4.805 4.805-4.805-.708-.708-4.805 4.805-4.805-4.805z'/%3e%3c/svg%3e") center/1em auto no-repeat;
}

.theme-dark .btn-close {
  background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='m.235.867 4.805 4.805-4.805 4.805.708.708 4.805-4.805 4.805 4.805.708-.708-4.805-4.805 4.805-4.805-.708-.708-4.805 4.805-4.805-4.805z'/%3e%3c/svg%3e") center/1em auto no-repeat;
  opacity: 0.8;
}

.theme-dark .btn-close:hover {
  opacity: 1;
}

/* Dropdowns */
.theme-dark .dropdown-menu {
  background-color: var(--dropdown-bg);
  border-color: var(--dropdown-border);
}

.theme-dark .dropdown-item {
  color: var(--dropdown-link-color);
}

.theme-dark .dropdown-item:hover,
.theme-dark .dropdown-item:focus {
  background-color: var(--dropdown-link-hover-bg);
  color: var(--dropdown-link-color);
}

.theme-dark .dropdown-divider {
  border-top-color: var(--border-color);
}

/* Tables */
.theme-dark .table {
  color: var(--text-primary);
  border-color: var(--border-color);
}

.theme-dark .table thead th {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border-bottom-color: var(--border-color);
}

.theme-dark .table tbody tr {
  border-bottom-color: var(--border-color);
}

.theme-dark .table-hover tbody tr:hover {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

.theme-dark .table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(255, 255, 255, 0.02);
}

/* Buttons */
.theme-dark .btn-outline-secondary {
  color: var(--text-primary);
  border-color: var(--border-color);
}

.theme-dark .btn-outline-secondary:hover {
  background-color: var(--bg-secondary);
  border-color: var(--border-color);
  color: var(--text-primary);
}

/* Alerts */
.theme-dark .alert-primary {
  background-color: rgba(13, 110, 253, 0.2);
  border-color: rgba(13, 110, 253, 0.4);
  color: #9ec5fe;
}

.theme-dark .alert-success {
  background-color: rgba(25, 135, 84, 0.2);
  border-color: rgba(25, 135, 84, 0.4);
  color: #75b798;
}

.theme-dark .alert-warning {
  background-color: rgba(255, 193, 7, 0.2);
  border-color: rgba(255, 193, 7, 0.4);
  color: #ffda6a;
}

.theme-dark .alert-danger {
  background-color: rgba(220, 53, 69, 0.2);
  border-color: rgba(220, 53, 69, 0.4);
  color: #f1aeb5;
}

.theme-dark .alert-info {
  background-color: rgba(13, 202, 240, 0.2);
  border-color: rgba(13, 202, 240, 0.4);
  color: #6edff6;
}

/* Borders */
.theme-dark .border,
.theme-dark .border-top,
.theme-dark .border-end,
.theme-dark .border-bottom,
.theme-dark .border-start {
  border-color: var(--border-color) !important;
}

/* Links */
.theme-dark a {
  color: #6ea8fe;
}

.theme-dark a:hover {
  color: #9ec5fe;
}

/* Badge */
.theme-dark .badge {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

/* List Groups */
.theme-dark .list-group-item {
  background-color: var(--bg-primary);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.theme-dark .list-group-item:hover {
  background-color: var(--bg-secondary);
}

.theme-dark .list-group-item.active {
  background-color: #0d6efd;
  border-color: #0d6efd;
}
