﻿:root {
  /* Common Variables */
  --transition-speed: 0.3s;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Dimensions */
  --sidebar-width: 260px;
  --topbar-height: 70px;

  /* Light Theme (Default) */
  --bg-body: #f8fafc;
  --bg-sidebar: #1e293b;
  /* Dark Slate - Professional */
  --text-sidebar: #e2e8f0;
  --text-sidebar-muted: #94a3b8;
  --bg-sidebar-hover: rgba(255, 255, 255, 0.05);
  --bg-sidebar-active: #3b82f6;
  /* Brand Blue */

  --bg-card: #ffffff;
  --bg-topbar: #ffffff;
  --text-primary: #1e293b;
  /* Dark Slate Text */
  --text-secondary: #64748b;
  /* Slate 500 */
  --border-color: #e2e8f0;

  /* Brand Colors */
  --primary-color: #3b82f6;
  /* Royal Blue */
  --primary-hover: #2563eb;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --info-color: #6366f1;
  /* Indigo */

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] {
  /* Dark Theme */
  --bg-body: #0f172a;
  /* Slate 900 */
  --bg-sidebar: #0f172a;
  /* Darker Sidebar */
  --text-sidebar: #f1f5f9;

  --bg-card: #1e293b;
  /* Slate 800 */
  --bg-topbar: #1e293b;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --border-color: #334155;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);

  --bg-sidebar-active: #3b82f6;
}

/* Base Styles */
body {
  background-color: var(--bg-body);
  color: var(--text-primary);
  font-family: var(--font-family);
  overflow-x: hidden;
  margin: 0;
  padding: 0;
}

/* Layout Wrapper */
#wrapper {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  color: var(--text-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform var(--transition-speed);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.05);
}

.sidebar-brand {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff !important;
  /* Always white on dark sidebar */
  text-decoration: none;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-nav {
  flex: 1;
  padding: 1.5rem 0;
  overflow-y: auto;
}

.nav-heading {
  padding: 0 1.5rem;
  margin-bottom: 0.75rem;
  margin-top: 1.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: var(--text-sidebar-muted);
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  color: var(--text-sidebar) !important;
  text-decoration: none;
  transition: all 0.2s;
  font-weight: 500;
  border-left: 3px solid transparent;
}

.nav-link i {
  width: 24px;
  text-align: center;
  margin-right: 0.75rem;
  opacity: 0.8;
}

.nav-link:hover {
  background-color: var(--bg-sidebar-hover);
  color: #fff !important;
  text-decoration: none;
}

.nav-link.active {
  background-color: rgba(59, 130, 246, 0.1);
  color: #60a5fa !important;
  border-left-color: var(--primary-color);
}

/* Active in dark sidebar usually wants a solid highlight */
.nav-link.active i {
  color: var(--primary-color);
  opacity: 1;
}

/* Content Wrapper */
#content-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin var(--transition-speed);
}

/* Topbar */
.topbar {
  height: var(--topbar-height);
  background-color: var(--bg-topbar);
  border-bottom: 1px solid var(--border-color);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  /* Push items to right */
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

/* Hamburger Menu Toggle - NOW IN responsive.css */
/* Moved to responsive.css to avoid specificity conflicts */

/* Topbar Navigation Links */
.topbar .nav-link {
  color: #1e293b !important;
  /* Dark text for light theme */
  font-weight: 500;
  transition: color var(--transition-speed);
}

.topbar .nav-link:hover {
  color: var(--primary-color) !important;
}

[data-theme="dark"] .topbar .nav-link {
  color: #f1f5f9 !important;
  /* Light text for dark theme */
}

[data-theme="dark"] .topbar .nav-link:hover {
  color: var(--primary-color) !important;
}

/* Topbar Icons */
.topbar .fas,
.topbar .far {
  color: inherit;
}

.main-content {
  flex: 1;
  padding: 2rem;
}

/* Cards */
.card {
  background-color: var(--bg-card);
  border: none;
  /* Cleaner look */
  box-shadow: var(--shadow-sm);
  border-radius: 0.75rem;
  margin-bottom: 1.5rem;
}

.card-header {
  background-color: #f8f9fc;
  /* Light background */
  border-bottom: 1px solid var(--border-color);
  padding: 1.25rem 1.5rem;
  font-weight: 600;
  color: #1e293b;
  /* Dark text for light mode */
}

[data-theme="dark"] .card-header {
  background-color: rgba(255, 255, 255, 0.02);
  color: #f1f5f9;
  /* Light text for dark mode */
  border-bottom-color: var(--border-color);
}

.card-body {
  padding: 1.5rem;
}

/* Tables */
.table {
  color: var(--text-primary);
  margin-bottom: 0;
  border-color: var(--border-color);
}

.table td,
.table th {
  border-color: var(--border-color);
}

/* Ensure proper text contrast in both themes */
.text-gray-800 {
  color: #1e293b !important;
}

[data-theme="dark"] .text-gray-800 {
  color: #f1f5f9 !important;
}

.text-primary {
  color: var(--primary-color) !important;
}

.text-muted {
  color: var(--text-secondary) !important;
}

.table thead th {
  border-bottom: 2px solid var(--border-color);
  background-color: rgba(0, 0, 0, 0.02);
  color: #495057;
  /* Always dark gray for light theme */
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  padding: 1rem 0.75rem;
  border-top: none;
}

/* Dark theme table headers */
[data-theme="dark"] .table thead th {
  background-color: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  /* Light gray for dark theme */
  border-bottom-color: var(--border-color);
}

.table td {
  padding: 1rem 0.75rem;
  border-top: 1px solid var(--border-color);
  vertical-align: middle;
}

[data-theme="dark"] .table thead th {
  background-color: rgba(255, 255, 255, 0.05);
}

/* Buttons */
.btn {
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  font-weight: 500;
  box-shadow: none;
}

.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
}

/* Utilities */
.text-gray-800 {
  color: var(--text-primary) !important;
}

.text-gray-600 {
  color: var(--text-secondary) !important;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  #content-wrapper {
    margin-left: 0;
  }

  .sidebar.toggled {
    transform: translateX(0);
  }
}

/* Helper for scrollable sidebar nav */
.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Dark Theme Form & Bootstrap Overrides */
[data-theme="dark"] .form-control {
  background-color: var(--bg-body);
  color: var(--text-primary);
  border-color: var(--border-color);
}

[data-theme="dark"] .form-control:focus {
  background-color: var(--bg-body);
  color: var(--text-primary);
  border-color: var(--primary-color);
}

[data-theme="dark"] .form-control::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

[data-theme="dark"] .bg-white {
  background-color: var(--bg-card) !important;
}

[data-theme="dark"] .text-dark {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .text-muted {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .table-hover tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .border-top {
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .jumbotron {
  background-color: var(--bg-card) !important;
}

/* Toggle Switch (Keep existing) */
.theme-switch-wrapper {
  display: flex;
  align-items: center;
}

.theme-switch {
  display: inline-block;
  height: 24px;
  position: relative;
  width: 48px;
}

.theme-switch input {
  display: none;
}

.slider {
  background-color: #ccc;
  bottom: 0;
  cursor: pointer;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  transition: .4s;
}

.slider:before {
  background-color: #fff;
  bottom: 3px;
  content: "";
  height: 18px;
  left: 3px;
  position: absolute;
  transition: .4s;
  width: 18px;
}

input:checked+.slider {
  background-color: var(--primary-color);
}

input:checked+.slider:before {
  transform: translateX(24px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}