/* Modern Design System with Tailwind CSS */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;
  --primary-500: #6366f1;
  --primary-600: #4f46e5;
  --primary-700: #4338ca;
  --primary-900: #312e81;
  
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;
}

/* Critical utility fallbacks if Tailwind fails to load */
.hidden {
  display: none !important;
}
.flex {
  display: flex !important;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #f8fafc;
  color: #111827;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Compact mode - globally smaller UI when body has .ui-compact */
.ui-compact {
  font-size: 14px;
}
.ui-compact .content .navbar {
  padding: 0.5rem 1rem;
}
.ui-compact h1 { font-size: 1.375rem; }
.ui-compact h2 { font-size: 1.125rem; }
.ui-compact h3 { font-size: 1rem; }
.ui-compact .btn { padding: 0.4rem 0.6rem; font-size: 0.8rem; border-radius: 0.375rem; }
.ui-compact .btn-lg { padding: 0.6rem 0.9rem; font-size: 0.9rem; }
.ui-compact .btn-sm { padding: 0.35rem 0.5rem; font-size: 0.7rem; }
.ui-compact .form-control { padding: 0.5rem 0.75rem; font-size: 0.8rem; border-radius: 0.375rem; }
.ui-compact label, .ui-compact .form-label { font-size: 0.8rem; }
.ui-compact .table th { padding: 0.5rem 0.75rem; font-size: 0.8rem; }
.ui-compact .table td { padding: 0.5rem 0.75rem; font-size: 0.8rem; }
.ui-compact .page-link { min-width: 34px; height: 34px; padding: 0.35rem 0.6rem; font-size: 0.8rem; }
.ui-compact .stats-card { padding: 1rem; }
.ui-compact .card-header { padding: 1rem; }
.ui-compact .card-body { padding: 1rem; }
.ui-compact .card-footer { padding: 0.75rem 1rem; }
.ui-compact .sidebar .navbar-brand h3 { font-size: 1.1rem; }
.ui-compact .sidebar .navbar-nav .nav-link { padding: 0.6rem 0.85rem; font-size: 0.8rem; }

/* Layout - Fixed spacing issues */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  height: 100vh;
  overflow-y: auto;
  background: #ffffff;
  border-right: 1px solid #e5e7eb;
  transition: all 0.3s ease;
  z-index: 50;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

.content {
  margin-left: 280px;
  min-height: 100vh;
  background: #f8fafc;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

/* Desktop toggle behavior */
@media (min-width: 1025px) {
  .sidebar {
    transform: translateX(0);
  }
  .sidebar.open {
    transform: translateX(-280px);
  }
  .content.open {
    margin-left: 0;
  }
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-280px);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .content {
    width: 100%;
    margin-left: 0;
  }
  .content.open {
    width: 100%;
    margin-left: 0;
  }
}

/* Sidebar Navigation */
.sidebar .navbar {
  padding: 1.5rem 0;
}

.sidebar .navbar-brand {
  padding: 0 1.5rem 1.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.sidebar .navbar-brand h3 {
  color: var(--primary);
  font-weight: 700;
  font-size: 1.25rem;
  margin: 0;
}

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

.sidebar .navbar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.25rem;
  color: #6b7280;
  font-weight: 500;
  font-size: 0.875rem;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
  text-decoration: none;
  position: relative;
}

.sidebar .navbar-nav .nav-link:hover {
  color: var(--primary);
  background: var(--primary-50);
  transform: translateX(4px);
}

.sidebar .navbar-nav .nav-link.active {
  color: var(--primary);
  background: var(--primary-50);
  font-weight: 600;
}

.sidebar .navbar-nav .nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--primary);
  border-radius: 0 0.375rem 0.375rem 0;
}

.sidebar .navbar-nav .nav-link i {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

/* Top Navbar */
.content .navbar {
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  padding: 1rem 1.5rem;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

.content .navbar .sidebar-toggler {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  color: #6b7280;
  transition: all 0.2s ease;
  cursor: pointer;
}

.content .navbar .sidebar-toggler:hover {
  background: var(--primary-50);
  color: var(--primary);
  border-color: var(--primary-100);
}

/* Cards - Clean design without excessive hover effects */
.card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
  transition: all 0.2s ease;
  overflow: hidden;
}

.card:hover {
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

.card-header {
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  padding: 1.5rem;
}

.card-header.bg-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #ffffff;
  border: none;
}

.card-body {
  padding: 1.5rem;
}

.card-footer {
  background: #f8fafc;
  border-top: 1px solid #e5e7eb;
  padding: 1rem 1.5rem;
}

/* Statistics Cards - Removed excessive hover effects */
.stats-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
  transition: none; /* Removed hover effects */
}

.stats-card.bg-primary {
  background: var(--primary);
  color: #ffffff;
  border: none;
}

.stats-card.bg-success {
  background: var(--success);
  color: #ffffff;
  border: none;
}

.stats-card.bg-warning {
  background: var(--warning);
  color: #ffffff;
  border: none;
}

.stats-card.bg-info {
  background: var(--info);
  color: #ffffff;
  border: none;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.btn:focus {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

.btn-secondary {
  background: #ffffff;
  color: #374151;
  border-color: #d1d5db;
}

.btn-secondary:hover {
  background: #f9fafb;
  border-color: #9ca3af;
  transform: translateY(-1px);
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

.btn-outline-primary {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline-primary:hover {
  background: var(--primary);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

.btn-outline-secondary {
  background: transparent;
  color: #6b7280;
  border-color: #d1d5db;
}

.btn-outline-secondary:hover {
  background: #f9fafb;
  color: #374151;
  border-color: #9ca3af;
  transform: translateY(-1px);
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

.btn-outline-danger {
  background: transparent;
  color: var(--error);
  border-color: var(--error);
}

.btn-outline-danger:hover {
  background: var(--error);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

.btn-sm {
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  line-height: 1rem;
}

.btn-lg {
  padding: 1rem 1.5rem;
  font-size: 1rem;
  line-height: 1.5rem;
}

/* Forms */
.form-control {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.5;
  color: #374151;
  background-color: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

.form-control:focus {
  color: #374151;
  background-color: #ffffff;
  border-color: var(--primary);
  outline: 0;
  box-shadow: 0 0 0 3px var(--primary-100);
}

.form-control::placeholder {
  color: #9ca3af;
}

.form-label {
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #374151;
  font-size: 0.875rem;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: 9999px;
  transition: all 0.2s ease;
}

.bg-primary {
  background-color: var(--primary) !important;
  color: #ffffff;
}

.bg-secondary {
  background-color: #6b7280 !important;
  color: #ffffff;
}

.bg-success {
  background-color: var(--success) !important;
  color: #ffffff;
}

.bg-warning {
  background-color: var(--warning) !important;
  color: #ffffff;
}

.bg-info {
  background-color: var(--info) !important;
  color: #ffffff;
}

.bg-danger {
  background-color: var(--error) !important;
  color: #ffffff;
}

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0;
}

.table th {
  background-color: #f9fafb;
  color: #374151;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

.table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}

.table-hover tbody tr:hover {
  background-color: #f9fafb;
}

/* Pagination */
.pagination {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 0.25rem;
}

.page-item {
  display: flex;
}

.page-link {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.75rem;
  color: #6b7280;
  text-decoration: none;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
  font-size: 0.875rem;
  font-weight: 500;
  min-width: 40px;
  height: 40px;
}

.page-link:hover {
  color: var(--primary);
  background-color: var(--primary-50);
  border-color: var(--primary-100);
  transform: translateY(-1px);
}

.page-item.active .page-link {
  color: #ffffff;
  background-color: var(--primary);
  border-color: var(--primary);
}

.page-item.disabled .page-link {
  color: #9ca3af;
  background-color: #f3f4f6;
  border-color: #e5e7eb;
  cursor: not-allowed;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  list-style: none;
  background-color: #ffffff;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

.breadcrumb-item {
  display: flex;
  align-items: center;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: "/";
  color: #6b7280;
  margin: 0 0.5rem;
}

.breadcrumb-item a {
  color: var(--primary);
  text-decoration: none;
}

.breadcrumb-item a:hover {
  text-decoration: underline;
}

.breadcrumb-item.active {
  color: #6b7280;
}

/* Animations - Subtle only */
.fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
  from { 
    opacity: 0; 
    transform: translateY(10px); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0); 
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .container-fluid {
    padding: 1rem;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  .btn-lg {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }
  
  .table-responsive {
    font-size: 0.875rem;
  }
  
  .btn-group-sm .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
  }
}

@media (max-width: 576px) {
  .container-fluid {
    padding: 0.75rem;
  }
  
  .card-body {
    padding: 0.75rem;
  }
  
  .btn-group-sm .btn {
    padding: 0.25rem;
    font-size: 0.7rem;
  }
  
  .badge {
    font-size: 0.65rem;
    padding: 0.25rem 0.5rem;
  }
}

/* Focus States for Accessibility */
.btn:focus-visible,
.form-control:focus-visible,
.dropdown-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Print Styles */
@media print {
  .sidebar,
  .content .navbar,
  .btn,
  .dropdown,
  .pagination {
    display: none !important;
  }
  
  .content {
    margin-left: 0 !important;
    width: 100% !important;
  }
  
  .card {
    border: 1px solid #000 !important;
    box-shadow: none !important;
  }
}