/* Modern Theme - Dark Mode with Accent Colors */
:root {
  /* Color Palette */
  --primary: #6366f1;
  --primary-hover: #5558e3;
  --primary-light: #818cf8;
  --secondary: #8b5cf6;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  
  /* Dark Theme Colors */
  --bg-primary: #0f0f15;
  --bg-secondary: #1a1a24;
  --bg-tertiary: #252530;
  --bg-elevated: #2d2d3a;
  --bg-card: #1e1e2a;
  
  /* Text Colors */
  --text-primary: #ffffff;
  --text-secondary: #e5e7eb;
  --text-muted: #9ca3af;
  
  /* Border Colors */
  --border-color: rgba(255, 255, 255, 0.1);
  --border-hover: rgba(255, 255, 255, 0.2);
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);
  
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* Font Import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');

/* Global Styles */
* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  margin: 0;
  padding: 0;
  transition: background-color 0.3s ease;
  overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  color: #ffffff;
  margin-bottom: 1rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

/* Ensure all headings are bright white */
.h1, .h2, .h3, .h4, .h5, .h6,
.display-1, .display-2, .display-3, .display-4, .display-5, .display-6 {
  color: #ffffff !important;
}

/* Special heading styles */
.ls-tight {
  letter-spacing: -0.025em;
  color: #ffffff !important;
}

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

a:hover {
  color: var(--primary-light);
}

/* Better text readability */
p, li, span, label {
  color: var(--text-primary);
}

.text-muted {
  color: var(--text-muted) !important;
  opacity: 1;
}

/* Modern Button Styles */
.btn {
  padding: 0.75rem 1.5rem;
  font-weight: 500;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-hover);
}

/* Modern Form Controls */
.form-control,
.form-select {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
  background: var(--bg-elevated);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  outline: none;
}

.form-floating label {
  color: var(--text-secondary);
}

/* Modern Card Design */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary);
}

.card-header {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-color);
  padding: 1.5rem;
}

/* Navigation Styles */
.navbar {
  background: var(--bg-secondary) !important;
  border: none !important;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
  background: rgba(26, 26, 36, 0.95) !important;
}

.navbar * {
  color: var(--text-primary) !important;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-primary) !important;
}

.company-logo {
  height: 40px;
  width: auto;
  object-fit: contain;
}

.nav-link {
  color: var(--text-secondary) !important;
  padding: 0.75rem 1rem !important;
  border-radius: 0.5rem;
  transition: all 0.3s ease;
  margin: 0.25rem 0;
  position: relative;
}

.nav-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: var(--primary);
  transition: height 0.3s ease;
  border-radius: 0 3px 3px 0;
}

.nav-link:hover {
  color: var(--text-primary) !important;
  background: var(--bg-elevated);
  padding-left: 1.25rem !important;
}

.nav-link:hover::before {
  height: 70%;
}

.nav-link.active {
  color: var(--primary) !important;
  background: var(--bg-elevated);
}

.nav-link.active::before {
  height: 70%;
}

/* Sidebar Enhancements */
#sidebar {
  background: var(--bg-secondary) !important;
  border-right: 1px solid var(--border-color) !important;
  min-width: 250px !important;
  max-width: 250px !important;
}

#sidebar .navbar-nav {
  padding: 1rem;
}

#sidebar .nav-link {
  color: var(--text-secondary) !important;
  font-weight: 500;
}

#sidebar .nav-link:hover {
  color: var(--text-primary) !important;
}

#sidebar .nav-header {
  color: var(--text-muted) !important;
  font-weight: 700;
}

/* Login Page Styles */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  position: relative;
  overflow: hidden;
}

.login-container::before {
  content: '';
  position: absolute;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 20% 80%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
              radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
  animation: float 20s infinite ease-in-out;
}

@keyframes float {
  0%, 100% { transform: translate(-10%, -10%) rotate(0deg); }
  50% { transform: translate(10%, 10%) rotate(180deg); }
}

.login-box {
  background: var(--bg-card);
  padding: 3rem;
  border-radius: 1.5rem;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-color);
  position: relative;
  z-index: 1;
  max-width: 450px;
  width: 100%;
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-header .subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

/* Dashboard Cards */
.dashboard-card {
  background: var(--bg-card);
  border-radius: 1rem;
  padding: 2rem;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

/* Stats Card Specific */
.stats-card h3 {
  color: #ffffff;
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.stats-card p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
}

.dashboard-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.dashboard-card:hover::before {
  transform: scaleX(1);
}

.dashboard-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

/* Table Styles */
.table {
  background: var(--bg-card);
  color: var(--text-primary);
}

.table thead th {
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--border-color);
  padding: 1rem;
}

.table tbody tr {
  transition: all 0.2s ease;
}

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

.table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

/* DataTables Custom Styling */
.dataTables_wrapper {
  font-family: var(--font-sans);
}

/* DataTable Container */
table.dataTable {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 0.75rem;
  overflow: hidden;
  width: 100% !important;
}

/* DataTable Headers */
table.dataTable thead {
  background: var(--bg-elevated) !important;
}

table.dataTable thead th,
table.dataTable thead td {
  background: var(--bg-elevated) !important;
  color: var(--text-primary) !important;
  font-weight: 600 !important;
  text-transform: uppercase;
  font-size: 0.85rem !important;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--primary) !important;
  padding: 1rem !important;
  position: relative;
}

/* Sorting arrows */
table.dataTable thead .sorting,
table.dataTable thead .sorting_asc,
table.dataTable thead .sorting_desc {
  cursor: pointer;
  position: relative;
  padding-right: 1.5rem !important;
}

table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:after {
  position: absolute;
  bottom: 1rem;
  right: 0.5rem;
  display: block;
  opacity: 0.6;
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
}

table.dataTable thead .sorting:after {
  content: "\f0dc";
  color: var(--text-muted);
}

table.dataTable thead .sorting_asc:after {
  content: "\f0de";
  color: var(--primary);
}

table.dataTable thead .sorting_desc:after {
  content: "\f0dd";
  color: var(--primary);
}

/* DataTable Body */
table.dataTable tbody tr {
  background-color: var(--bg-card) !important;
  transition: all 0.2s ease;
}

table.dataTable tbody tr:hover {
  background-color: var(--bg-elevated) !important;
}

table.dataTable tbody td {
  color: var(--text-secondary) !important;
  padding: 1rem !important;
  border-bottom: 1px solid var(--border-color) !important;
  vertical-align: middle;
}

/* Striped rows */
table.dataTable.stripe tbody tr.odd,
table.dataTable.display tbody tr.odd {
  background-color: var(--bg-card) !important;
}

table.dataTable.stripe tbody tr.even,
table.dataTable.display tbody tr.even {
  background-color: rgba(255, 255, 255, 0.02) !important;
}

/* Remove default borders */
table.dataTable,
table.dataTable th,
table.dataTable td {
  border: none !important;
}

table.dataTable tbody td {
  border-bottom: 1px solid var(--border-color) !important;
}

/* DataTable Controls */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  color: var(--text-primary) !important;
  margin-bottom: 1rem;
}

.dataTables_wrapper .dataTables_filter {
  text-align: right;
}

.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
  color: var(--text-primary) !important;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  background: var(--bg-tertiary) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-primary) !important;
  padding: 0.5rem 1rem !important;
  border-radius: 0.5rem !important;
  font-size: 0.95rem !important;
  margin-left: 0.5rem !important;
  transition: all 0.3s ease;
}

.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
  background: var(--bg-elevated) !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1) !important;
  outline: none !important;
}

/* DataTable Pagination */
.dataTables_wrapper .dataTables_paginate {
  margin-top: 1rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  background: var(--bg-elevated) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
  padding: 0.5rem 1rem !important;
  margin: 0 0.25rem !important;
  border-radius: 0.5rem !important;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--primary) !important;
  color: white !important;
  border-color: var(--primary) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--primary) !important;
  color: white !important;
  border-color: var(--primary) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
  background: var(--bg-elevated) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* DataTable Info */
.dataTables_wrapper .dataTables_info {
  color: var(--text-muted) !important;
  font-size: 0.875rem;
}

/* DataTable Empty */
.dataTables_empty {
  text-align: center;
  padding: 2rem !important;
  color: var(--text-muted) !important;
}

/* Custom scrollbar for DataTables */
.dataTables_scrollBody::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.dataTables_scrollBody::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

.dataTables_scrollBody::-webkit-scrollbar-thumb {
  background: var(--bg-elevated);
  border-radius: 4px;
}

.dataTables_scrollBody::-webkit-scrollbar-thumb:hover {
  background: var(--bg-tertiary);
}

/* Responsive DataTables */
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:before,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control:before {
  background-color: var(--primary) !important;
}

/* Alert Styles */
.alert {
  border: none;
  border-radius: 0.75rem;
  padding: 1rem 1.5rem;
  font-weight: 500;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Loading Animation */
.loader {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-color);
  border-bottom-color: var(--primary);
  border-radius: 50%;
  display: inline-block;
  animation: rotate 1s linear infinite;
}

@keyframes rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Icon Box Styles */
.icon-box {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-box.icon-primary {
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
}

.icon-box.icon-success {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.icon-box.icon-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.icon-box.icon-info {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

/* Activity Icon Styles */
.activity-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.activity-icon.icon-primary {
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
}

.activity-icon.icon-success {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.activity-icon.icon-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.activity-icon.icon-info {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

/* Custom Badge Styles */
.badge {
  padding: 0.375rem 0.75rem;
  font-weight: 600;
  font-size: 0.75rem;
  border-radius: 0.375rem;
}

.badge-success {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.badge-info {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

/* Utility Classes */
.text-gradient {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.glass-effect {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
}

.hover-lift {
  transition: transform 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-4px);
}

/* Responsive Design */
@media (max-width: 768px) {
  #sidebar {
    min-width: 100% !important;
    max-width: 100% !important;
  }
  
  .login-box {
    padding: 2rem;
    margin: 1rem;
  }
  
  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
}

/* Improved Contrast for Forms and Checkboxes */
.form-check-label {
  color: var(--text-secondary) !important;
  opacity: 1;
}

.form-check-input {
  background-color: var(--bg-tertiary);
  border-color: rgba(255, 255, 255, 0.3);
}

.form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

/* Better contrast for small text */
small, .small {
  color: var(--text-muted) !important;
  opacity: 1;
}

/* Improve dashboard card labels */
.stats-card p.text-muted,
.action-card p.text-muted {
  color: #b3b8c0 !important;
  opacity: 1;
}

/* Improve contrast for login page footer */
.login-footer small {
  color: #9ca3af !important;
  opacity: 1;
}

/* Override specific elements using dark color #16192c */
/* For panels and backgrounds, keep the lighter color */
[style*="background-color:#16192c"],
[style*="background-color: #16192c"],
.bg-dark {
  background-color: #e5e7eb !important;
}

/* For text elements specifically using #16192c, use a readable gray */
[style*="color:#16192c"]:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6),
[style*="color: #16192c"]:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6) {
  color: #9ca3af !important;
}

/* Keep headings white for maximum readability */
/* Already defined above in the file */

/* Form labels should use secondary text color for balance */
label {
  color: var(--text-secondary) !important;
  opacity: 1;
}

/* Override kbd elements that use the dark background */
kbd {
  background-color: var(--bg-tertiary) !important;
  color: var(--text-secondary) !important;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Fix any elements that might be using the dark color variable */
.text-dark {
  color: var(--text-secondary) !important;
}