
/* ==========================================================================
   Finance Web Planet - Modern UI Stylesheet
   Version: 2.0.0
   Last Updated: November 4, 2025
   ========================================================================== */

/* ==========================================================================
   1. CSS Variables & Design Tokens
   ========================================================================== */
:root {
  /* Primary Colors */
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-light: #dbeafe;
  --color-primary-dark: #1e40af;

  /* Secondary Colors */
  --color-secondary: #64748b;
  --color-accent: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --color-info: #06b6d4;

  /* Neutral Colors */
  --color-dark: #0f172a;
  --color-gray-900: #1e293b;
  --color-gray-700: #334155;
  --color-gray-500: #64748b;
  --color-gray-300: #cbd5e1;
  --color-gray-100: #f1f5f9;
  --color-white: #ffffff;

  /* Financial Colors */
  --color-profit: #10b981;
  --color-loss: #ef4444;

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 2.5rem;
  --spacing-3xl: 3rem;

  /* Typography */
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  --font-size-4xl: 2.25rem;

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-xl: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease;
}

/* ==========================================================================
   2. Base Styles
   ========================================================================== */
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', 'Roboto', 
               'Helvetica Neue', Arial, sans-serif;
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--color-dark);
  background: #fafbfc;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  width: 100%;
}

/* Prevent horizontal scrolling globally */
*, *::before, *::after {
  box-sizing: border-box;
}

.container, .container-fluid {
  max-width: 100%;
  overflow-x: hidden;
}

/* Additional background utilities */
.bg-gray-50 {
  background-color: #f8fafc !important;
}

.bg-white {
  background-color: white !important;
}

/* Typography Utilities */
.fs-7 {
  font-size: 0.875rem;
}

.fs-8 {
  font-size: 0.75rem;
}

.fw-semibold {
  font-weight: 600;
}

/* Line Height Utilities */
.lh-tight {
  line-height: 1.25;
}

.lh-normal {
  line-height: 1.5;
}

.lh-relaxed {
  line-height: 1.75;
}

/* Responsive Typography */
@media (max-width: 768px) {
  .display-3 {
    font-size: 2rem !important;
  }
  
  .display-4 {
    font-size: 1.75rem !important;
  }
  
  .display-5 {
    font-size: 1.5rem !important;
  }
  
  .display-6 {
    font-size: 1.25rem !important;
  }
}

/* ==========================================================================
   3. Navigation Bar Enhancement
   ========================================================================== */
.navbar {
  background: linear-gradient(to bottom, #ffffff 0%, #f8fafc 100%) !important;
  border-bottom: 2px solid #e2e8f0;
  box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.06);
  padding: 0.875rem 1rem;
  position: sticky;
  top: 0;
  z-index: 1030;
  backdrop-filter: blur(10px);
  overflow: visible !important;
}

/* Ensure navbar container doesn't clip */
.navbar > .container-fluid {
  overflow: visible !important;
}

/* Ensure navbar collapse doesn't clip dropdowns */
.navbar-collapse {
  position: static !important;
  overflow: visible !important;
}

/* Ensure nav list doesn't clip dropdowns */
.navbar-nav {
  overflow: visible !important;
}

/* Nav items need relative positioning so dropdowns align below them */
.nav-item {
  position: relative !important;
  overflow: visible !important;
}

.nav-item.dropdown {
  position: relative !important;
}

.navbar-brand {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-primary) !important;
  transition: var(--transition-base);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  letter-spacing: -0.02em;
}

.navbar-brand:hover {
  color: var(--color-primary-hover) !important;
  transform: translateY(-1px);
}

.navbar-brand img {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
  transition: var(--transition-base);
}

.navbar-brand:hover img {
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.15));
}

.nav-link {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--color-gray-700) !important;
  padding: 0.625rem 1.125rem !important;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--color-primary);
  transition: all var(--transition-base);
  transform: translateX(-50%);
}

.nav-link:hover::after {
  width: 80%;
}

.nav-link:hover {
  background: rgba(37, 99, 235, 0.08) !important;
  color: var(--color-primary) !important;
  transform: translateY(-1px);
}

.nav-link.active {
  background: var(--color-primary-light) !important;
  color: var(--color-primary) !important;
  font-weight: 700;
}

.nav-link i {
  width: 1.25rem;
  text-align: center;
  font-size: 1.1rem;
}

.dropdown-menu {
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  padding: 0.5rem;
  margin-top: 0.25rem;
  min-width: 220px;
  animation: dropdownFadeIn 0.15s ease-out;
  background: white;
}

/* Critical: Force dropdown to show when Bootstrap applies the .show class */
.dropdown-menu.show {
  display: block !important;
}

/* Navbar specific dropdown styling - use absolute positioning aligned with nav items */
.navbar .dropdown-menu {
  position: absolute !important;
  z-index: 1050 !important;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  overflow-x: hidden;
  margin-top: 0.5rem;
  display: none;
}

/* Ensure dropdown is visible when parent has show class */
.navbar .nav-item.show > .dropdown-menu,
.navbar .dropdown.show > .dropdown-menu {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  z-index: 1050 !important;
}

/* Let Bootstrap's Popper.js handle positioning */
.dropdown-menu[data-bs-popper] {
  position: absolute !important;
  top: 100% !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  margin-top: 0.5rem !important;
}

/* Center dropdown menu under nav item */
.navbar .dropdown-menu {
  left: 50% !important;
  transform: translateX(-50%) !important;
  right: auto !important;
}

/* Override for dropdown-menu-end if used */
.navbar .dropdown-menu-end {
  left: auto !important;
  right: 0 !important;
  transform: none !important;
}

/* Custom scrollbar for dropdown if needed */
.navbar .dropdown-menu::-webkit-scrollbar {
  width: 6px;
}

.navbar .dropdown-menu::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 3px;
}

.navbar .dropdown-menu::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.navbar .dropdown-menu::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-menu-wide {
  min-width: 300px;
}

/* Ensure dropdown stays visible when open */
.dropdown.show .dropdown-menu,
.nav-item.show .dropdown-menu {
  display: block !important;
}

.dropdown-header {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-gray-500);
  padding: 0.75rem 1rem 0.5rem;
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
}

.dropdown-item {
  border-radius: 0.375rem;
  padding: 0.625rem 1rem;
  transition: all var(--transition-fast);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-gray-700);
  display: flex;
  align-items: center;
  margin-bottom: 0.125rem;
}

.dropdown-item i {
  width: 1.5rem;
  text-align: center;
  font-size: 1rem;
  opacity: 0.8;
  transition: var(--transition-fast);
}

.dropdown-item:hover {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(37, 99, 235, 0.04) 100%);
  color: var(--color-primary);
  transform: translateX(2px);
  padding-left: 1.125rem;
}

.dropdown-item:hover i {
  opacity: 1;
  transform: scale(1.1);
}

.dropdown-item-featured {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
  color: white !important;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.dropdown-item-featured:hover {
  background: linear-gradient(135deg, var(--color-primary-hover) 0%, var(--color-primary-dark) 100%);
  color: white !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(37, 99, 235, 0.3);
}

.dropdown-divider {
  margin: 0.5rem 0;
  border-top-color: #e2e8f0;
  opacity: 1;
}

/* ==========================================================================
   4. Card Improvements
   ========================================================================== */
.card {
  border: 1px solid #e2e8f0;
  border-radius: 0.875rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px 0 rgba(0, 0, 0, 0.03);
  transition: all var(--transition-base);
  background: white;
  overflow: hidden;
}

/* Only lift interactive cards */
.card-interactive {
  cursor: pointer;
}

.card-interactive:hover {
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  transform: translateY(-3px);
  border-color: var(--color-primary-light);
}

.card-header {
  background: linear-gradient(to bottom, #f8fafc 0%, #ffffff 100%);
  border-bottom: 2px solid #e2e8f0;
  font-weight: 700;
  font-size: 1.125rem;
  padding: 1.25rem 1.5rem;
  color: var(--color-gray-900);
}

.card-body {
  padding: 1.5rem;
}

.card-footer {
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  padding: 1rem 1.5rem;
}

/* Metric Card Styles - for dashboard cards */
.metric-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  padding: 1.75rem;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(to bottom, var(--color-primary), var(--color-primary-hover));
  opacity: 0;
  transition: opacity var(--transition-base);
}

.metric-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.15), 0 10px 10px -5px rgba(37, 99, 235, 0.08);
  transform: translateY(-2px);
}

.metric-card:hover::before {
  opacity: 1;
}

.metric-card__icon {
  font-size: 2.75rem;
  color: var(--color-primary);
  margin-bottom: 1.25rem;
  display: inline-block;
  transition: var(--transition-base);
}

.metric-card:hover .metric-card__icon {
  transform: scale(1.1);
}

.metric-card__label {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--color-gray-600);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}

.metric-card__value {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--color-gray-900);
  line-height: 1.1;
  margin-bottom: 0.5rem;
  font-variant-numeric: tabular-nums;
}

.metric-card__subtitle {
  font-size: 0.875rem;
  color: var(--color-gray-500);
  font-weight: 500;
  margin-bottom: 0;
}

/* ==========================================================================
   5. Button Enhancements
   ========================================================================== */
.btn {
  font-weight: 600;
  border-radius: 0.5rem;
  transition: all var(--transition-base);
  padding: 0.625rem 1.25rem;
  font-size: 0.9375rem;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
  border: none;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--color-primary-hover) 0%, var(--color-primary-dark) 100%);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

.btn-outline-primary {
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
  font-weight: 600;
}

.btn-outline-primary:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.25);
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
  transform: translateY(-2px);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border: none;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
  transform: translateY(-2px);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: 1.0625rem;
}

/* ==========================================================================
   6. Table Styling
   ========================================================================== */
.table {
  border-collapse: separate;
  border-spacing: 0;
}

.table thead th {
  background: linear-gradient(to bottom, #f8fafc 0%, #f1f5f9 100%);
  color: var(--color-gray-700);
  font-weight: 700;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid #e2e8f0;
  padding: 1rem 0.875rem;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 10;
}

.table thead th:first-child {
  border-top-left-radius: 0.5rem;
}

.table thead th:last-child {
  border-top-right-radius: 0.5rem;
}

.table tbody tr {
  transition: all 0.15s ease;
  border-bottom: 1px solid #f1f5f9;
}

.table tbody tr:hover {
  background: #f8fafc;
  box-shadow: inset 0 0 0 1px #e2e8f0;
  transform: scale(1.001);
}

.table tbody td {
  font-size: 0.9375rem;
  padding: 0.875rem;
  vertical-align: middle;
  color: var(--color-gray-700);
}

.table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(248, 250, 252, 0.5);
}

.table-hover tbody tr:hover {
  background-color: #f1f5f9;
}

/* ==========================================================================
   7. Form Elements
   ========================================================================== */
.form-label {
  font-weight: 600;
  color: var(--color-gray-900);
  font-size: 0.9375rem;
  margin-bottom: 0.5rem;
  display: inline-block;
}

/* Required field indicator */
.form-label .text-danger,
.form-label small.text-danger {
  font-weight: 700;
  color: #dc2626;
}

.form-control,
.form-select {
  border: 1.5px solid #cbd5e1;
  border-radius: 0.5rem;
  transition: all var(--transition-base);
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
  background-color: #ffffff;
}

.form-control:hover,
.form-select:hover {
  border-color: #94a3b8;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  outline: none;
  background-color: #ffffff;
}

.form-control::placeholder {
  color: #94a3b8;
  opacity: 1;
}

/* Improve focus visibility for accessibility */
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.5);
  outline-offset: 2px;
}

/* Form group spacing */
.form-group,
.mb-3 {
  margin-bottom: 1.5rem;
}

/* Input groups */
.input-group-text {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  color: var(--color-gray-700);
  font-weight: 500;
}

.input-group .form-control:focus {
  z-index: 3;
}

/* ==========================================================================
   8. Badge Enhancements
   ========================================================================== */
.badge {
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0.35rem 0.75rem;
  border-radius: 0.375rem;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.badge.bg-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: white !important;
  border: 1px solid rgba(16, 185, 129, 0.3);
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.badge.bg-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
  color: white !important;
  border: 1px solid rgba(245, 158, 11, 0.3);
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
}

.badge.bg-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
  color: white !important;
  border: 1px solid rgba(239, 68, 68, 0.3);
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

.badge.bg-info {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%) !important;
  color: white !important;
  border: 1px solid rgba(6, 182, 212, 0.3);
  box-shadow: 0 2px 4px rgba(6, 182, 212, 0.2);
}

.badge.bg-secondary {
  background: linear-gradient(135deg, #64748b 0%, #475569 100%) !important;
  color: white !important;
  border: 1px solid rgba(100, 116, 139, 0.3);
  box-shadow: 0 2px 4px rgba(100, 116, 139, 0.2);
}

.badge.bg-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%) !important;
  color: white !important;
  border: 1px solid rgba(37, 99, 235, 0.3);
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

/* ==========================================================================
   9. Alert Improvements
   ========================================================================== */
.alert {
  border-radius: 0.75rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border-width: 1px;
  border-style: solid;
  padding: 1rem 1.25rem;
  font-weight: 500;
}

.alert-success {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  border-color: #10b981;
  color: #047857;
}

.alert-warning {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-color: #f59e0b;
  color: #b45309;
}

.alert-danger {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  border-color: #ef4444;
  color: #b91c1c;
}

.alert-info {
  background: linear-gradient(135deg, #cffafe 0%, #a5f3fc 100%);
  border-color: #06b6d4;
  color: #0e7490;
}

/* ==========================================================================
   10. Animations
   ========================================================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.container > *:first-child {
  animation: fadeIn 0.3s ease-out;
}

/* ==========================================================================
   11. Responsive Design & Mobile Optimization
   ========================================================================== */

/* Mobile Navigation */
@media (max-width: 991.98px) {
  .navbar-collapse {
    background-color: var(--color-white);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-top: 0.5rem;
    box-shadow: var(--shadow-md);
  }
  
  .navbar-nav .nav-link {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-gray-100);
  }
  
  .navbar-nav .nav-link:last-child {
    border-bottom: none;
  }
  
  .dropdown-menu {
    border: none;
    box-shadow: none;
    padding-left: 1rem;
  }
}

/* Touch Targets - Minimum 44x44px for mobile */
@media (max-width: 768px) {
  /* Prevent table button groups from causing overflow */
  .table .d-flex {
    flex-wrap: wrap;
    gap: 0.25rem;
  }
  
  .table .btn-sm {
    padding: 0.375rem 0.5rem;
    font-size: 0.8125rem;
  }
  
  .dropdown-item {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  
  /* Ensure navigation dropdown menus are fully visible on mobile */
  .navbar .dropdown-menu {
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    overflow-x: hidden;
    position: absolute !important;
  }
  
  .navbar .dropdown-menu.show {
    display: block !important;
  }
  
  .navbar .dropdown-menu[data-bs-popper] {
    position: absolute !important;
  }
  
  .btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    min-height: 44px;
  }
  
  .nav-link {
    padding: 0.75rem 1rem;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  
  .navbar-nav .nav-link {
    padding: 0.75rem 1.5rem;
  }
  
  .form-control,
  .form-select {
    min-height: 44px;
    font-size: 16px; /* Prevents zoom on iOS */
  }
}

/* Container and Spacing Optimization */
@media (max-width: 576px) {
  .container-fluid {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  
  .card-body {
    padding: 0.75rem;
  }
  
  .row {
    --bs-gutter-x: 0.75rem;
    margin-left: 0;
    margin-right: 0;
  }
  
  .col, [class*="col-"] {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}

@media (max-width: 768px) {
  .container, .container-fluid {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  /* Ensure cards don't overflow */
  .card {
    margin-left: 0;
    margin-right: 0;
    max-width: 100%;
  }
}

/* Icon Size Optimization */
@media (max-width: 768px) {
  .fs-1 {
    font-size: 2rem !important;
  }
  
  .fs-2 {
    font-size: 1.75rem !important;
  }
  
  .navbar-brand img {
    max-height: 32px !important;
  }
  
  h1.h3 {
    font-size: 1.5rem !important;
  }
  
  h1 {
    font-size: 1.75rem !important;
  }
}

/* Dropdown Menu Scrolling */
@media (max-width: 768px) {
  .dropdown-menu {
    max-height: 70vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Statistics Cards Mobile Optimization */
@media (max-width: 576px) {
  .card .d-flex.justify-content-between {
    flex-direction: column;
    align-items: flex-start !important;
  }
  
  .card .d-flex.justify-content-between > div:last-child {
    margin-top: 0.5rem;
  }
}

/* Table Responsiveness Helper */
.table-responsive {
  -webkit-overflow-scrolling: touch;
  overflow-x: auto;
  width: 100%;
  margin-bottom: 1rem;
}

.table-responsive::-webkit-scrollbar {
  height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Ensure tables don't overflow */
.table {
  width: 100%;
  margin-bottom: 0;
}

.table th,
.table td {
  white-space: nowrap;
  min-width: 80px;
}

/* Allow text wrapping for specific columns */
.table td:first-child,
.table th:first-child {
  min-width: 120px;
}

/* Actions column should be narrower */
.table th:last-child,
.table td:last-child {
  min-width: 120px;
  white-space: nowrap;
}

/* Form Layout Improvements */
@media (max-width: 768px) {
  .form-group,
  .mb-3 {
    margin-bottom: 1.25rem;
  }
  
  label {
    font-weight: 600;
    margin-bottom: 0.5rem;
  }
  
  /* Search and filter forms */
  form.d-flex {
    flex-direction: column;
    gap: 0.75rem !important;
  }
  
  form.d-flex .form-control {
    width: 100% !important;
  }
  
  form.d-flex .btn {
    width: 100%;
  }
  
  /* Action bar responsiveness */
  .d-flex.justify-content-between {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 1rem;
  }
  
  .d-flex.justify-content-between > * {
    width: 100%;
  }
}

/* Navbar Toggler Styling */
.navbar-toggler {
  border: 2px solid var(--color-gray-300);
  padding: 0.5rem 0.75rem;
}

.navbar-toggler:focus {
  box-shadow: 0 0 0 0.25rem rgba(37, 99, 235, 0.25);
  border-color: var(--color-primary);
}

/* Smooth Scrolling */
@media (max-width: 768px) {
  body {
    overscroll-behavior-y: auto;
  }
}

/* Landscape Mode Optimization */
@media (max-height: 500px) and (orientation: landscape) {
  .navbar-collapse {
    max-height: 300px;
    overflow-y: auto;
  }
}

/* Tablet Specific */
@media (min-width: 768px) and (max-width: 991.98px) {
  .col-md-3 {
    flex: 0 0 50%;
    max-width: 50%;
  }
}

/* ==========================================================================
   Enhanced Form Validation UI Styles
   Added: November 7, 2025
   ========================================================================== */

/* Required Field Indicators */
.required-indicator {
  color: var(--color-danger, #ef4444);
  font-weight: bold;
  margin-left: 2px;
}

/* Character Counter */
.char-counter {
  display: block;
  font-size: var(--font-size-sm, 0.875rem);
  margin-top: 0.25rem;
  transition: color 0.2s ease;
}

.char-counter.text-warning {
  color: var(--color-warning, #f59e0b) !important;
  font-weight: 500;
}

.char-counter.text-danger {
  color: var(--color-danger, #ef4444) !important;
  font-weight: 600;
}

/* File Upload Requirements */
.file-requirements {
  display: block;
  font-size: var(--font-size-sm, 0.875rem);
  margin-top: 0.25rem;
  color: var(--color-gray-500, #64748b);
}

.file-requirements i {
  font-size: 1rem;
}

/* File Validation Feedback */
.file-validation-feedback {
  display: block;
  font-size: var(--font-size-sm, 0.875rem);
  margin-top: 0.25rem;
}

.file-validation-feedback i {
  margin-right: 0.25rem;
}

/* Numeric Range Hints */
.range-hint {
  display: block;
  font-size: var(--font-size-sm, 0.875rem);
  margin-top: 0.25rem;
  color: var(--color-gray-500, #64748b);
}

.range-hint i {
  font-size: 1rem;
}

/* Password Strength Meter */
.password-strength-meter {
  margin-top: 0.5rem;
}

.password-strength-meter .progress {
  height: 5px;
  border-radius: 3px;
  background-color: var(--color-gray-200, #e2e8f0);
}

.password-strength-meter .progress-bar {
  transition: width 0.3s ease, background-color 0.3s ease;
}

.strength-text {
  display: block;
  margin-top: 0.25rem;
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: 500;
}

/* Enhanced Validation States */
.form-control.is-valid,
.form-select.is-valid {
  border-color: var(--color-accent, #10b981);
  padding-right: calc(1.5em + 0.75rem);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2310b981' d='M2.3 6.73.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-control.is-invalid,
.form-select.is-invalid {
  border-color: var(--color-danger, #ef4444);
  padding-right: calc(1.5em + 0.75rem);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23ef4444'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23ef4444' stroke='none'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-control.is-valid:focus,
.form-select.is-valid:focus {
  border-color: var(--color-accent, #10b981);
  box-shadow: 0 0 0 0.2rem rgba(16, 185, 129, 0.25);
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
  border-color: var(--color-danger, #ef4444);
  box-shadow: 0 0 0 0.2rem rgba(239, 68, 68, 0.25);
}

/* Valid Feedback */
.valid-feedback {
  display: none;
  width: 100%;
  margin-top: 0.25rem;
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-accent, #10b981);
}

.valid-feedback.d-block {
  display: block !important;
}

/* Invalid Feedback */
.invalid-feedback {
  display: none;
  width: 100%;
  margin-top: 0.25rem;
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-danger, #ef4444);
}

.invalid-feedback.d-block {
  display: block !important;
}

/* Field Validation Error (ASP.NET MVC) */
.field-validation-error {
  color: var(--color-danger, #ef4444);
  font-size: var(--font-size-sm, 0.875rem);
  margin-top: 0.25rem;
  display: block;
}

.field-validation-error i {
  margin-right: 0.25rem;
}

/* Validation Summary */
.validation-summary-errors {
  margin-bottom: 1rem;
  padding: 1rem;
  background-color: #fee2e2;
  border: 1px solid var(--color-danger, #ef4444);
  border-radius: 0.375rem;
}

.validation-summary-errors ul {
  margin-bottom: 0;
  padding-left: 1.25rem;
}

.validation-summary-errors li {
  color: var(--color-danger, #ef4444);
  font-size: var(--font-size-sm, 0.875rem);
}

/* Input Group Validation */
.input-group .form-control.is-valid,
.input-group .form-select.is-valid {
  z-index: 3;
}

.input-group .form-control.is-invalid,
.input-group .form-select.is-invalid {
  z-index: 4;
}

/* Floating Labels with Validation */
.form-floating > .form-control.is-valid,
.form-floating > .form-select.is-valid {
  padding-right: calc(1.5em + 0.75rem);
}

.form-floating > .form-control.is-invalid,
.form-floating > .form-select.is-invalid {
  padding-right: calc(1.5em + 0.75rem);
}

/* Tooltip Validation */
.form-control[data-bs-toggle="tooltip"],
.form-select[data-bs-toggle="tooltip"] {
  cursor: help;
}

/* Help Text Enhancement */
.form-text {
  margin-top: 0.25rem;
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-gray-500, #64748b);
}

.form-text i {
  margin-right: 0.25rem;
}

/* Form Control Focus States */
.form-control:focus,
.form-select:focus {
  border-color: var(--color-primary, #2563eb);
  box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
}

/* Disabled State */
.form-control:disabled,
.form-select:disabled {
  background-color: var(--color-gray-100, #f1f5f9);
  opacity: 0.6;
  cursor: not-allowed;
}

/* Mobile Optimization for Validation */
@media (max-width: 575.98px) {
  .char-counter,
  .file-requirements,
  .range-hint,
  .form-text {
    font-size: 0.8125rem; /* Slightly smaller on mobile */
  }
  
  .password-strength-meter {
    margin-top: 0.375rem;
  }
  
  .validation-summary-errors {
    padding: 0.75rem;
    font-size: 0.8125rem;
  }
}

/* Animation for Validation State Changes */
@keyframes validationFadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.invalid-feedback.d-block,
.valid-feedback.d-block,
.field-validation-error {
  animation: validationFadeIn 0.3s ease;
}

/* Accessibility Enhancements */
.form-control[aria-invalid="true"],
.form-select[aria-invalid="true"] {
  border-color: var(--color-danger, #ef4444);
}

.form-control[aria-describedby],
.form-select[aria-describedby] {
  /* Ensure proper spacing for screen reader descriptions */
  margin-bottom: 0.5rem;
}

/* Focus Visible for Keyboard Navigation */
.form-control:focus-visible,
.form-select:focus-visible {
  outline: 2px solid var(--color-primary, #2563eb);
  outline-offset: 2px;
}

/* ==========================================================================
   UI OPTIMIZATIONS - November 8, 2025
   Based on Screenshot Analysis & Testing
   ========================================================================== */

/* --------------------------------------------------------------------------
   Table Improvements - Better Readability & Density
   -------------------------------------------------------------------------- */
.table td,
.table th {
  padding: 0.75rem 1rem; /* Increased from default 0.5rem */
  vertical-align: middle;
}

.table-hover tbody tr:hover {
  background-color: rgba(37, 99, 235, 0.05);
  transition: background-color var(--transition-fast, 0.15s);
}

/* Sticky Table Headers for Long Tables */
.table-responsive {
  max-height: 70vh;
  overflow-y: auto;
  position: relative;
}

.table-responsive .table thead th {
  position: sticky;
  top: 0;
  background: var(--color-white, #ffffff);
  z-index: 10;
  box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.1);
}

/* Action Buttons in Tables */
.table .btn-sm {
  padding: 0.25rem 0.75rem;
  font-size: var(--font-size-sm, 0.875rem);
  min-width: 70px;
  transition: all var(--transition-fast, 0.15s);
}

/* --------------------------------------------------------------------------
   Card Enhancements - Hover Effects & Visual Polish
   -------------------------------------------------------------------------- */
.card {
  transition: transform var(--transition-base, 0.2s), 
              box-shadow var(--transition-base, 0.2s);
  border: 1px solid var(--color-gray-300, #cbd5e1);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card-title {
  transition: color var(--transition-fast, 0.15s);
}

.card:hover .card-title {
  color: var(--color-primary, #2563eb);
}

/* Dashboard Cards - Enhanced Interaction */
.card.border-primary:hover,
.card.border-success:hover,
.card.border-info:hover,
.card.border-warning:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

/* --------------------------------------------------------------------------
   Enhanced Focus Indicators - Accessibility
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--color-primary, #2563eb);
  outline-offset: 2px;
  border-radius: var(--radius-sm, 0.375rem);
}

.btn:focus-visible {
  box-shadow: 0 0 0 0.25rem rgba(37, 99, 235, 0.25);
  outline: none;
}

a:focus-visible {
  outline: 2px solid var(--color-primary, #2563eb);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --------------------------------------------------------------------------
   Validation States - Enhanced Visual Feedback
   -------------------------------------------------------------------------- */
.was-validated .form-control:valid,
.form-control.is-valid {
  border-color: var(--color-accent, #10b981);
  padding-right: calc(1.5em + 0.75rem);
}

.was-validated .form-control:invalid,
.form-control.is-invalid {
  border-color: var(--color-danger, #ef4444);
}

/* Character Counter States */
.character-counter {
  font-size: var(--font-size-sm, 0.875rem);
  transition: color var(--transition-fast, 0.15s);
}

.character-counter.warning {
  color: var(--color-warning, #f59e0b);
  font-weight: var(--font-weight-semibold, 600);
}

.character-counter.danger {
  color: var(--color-danger, #ef4444);
  font-weight: var(--font-weight-bold, 700);
  animation: pulse 0.5s ease;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* --------------------------------------------------------------------------
   Loading States - Skeleton Screens
   -------------------------------------------------------------------------- */
.skeleton-loader {
  width: 100%;
}

.skeleton-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.skeleton-cell {
  height: 40px;
  flex: 1;
  border-radius: var(--radius-sm, 0.375rem);
}

.skeleton-shimmer {
  background: linear-gradient(
    90deg,
    var(--color-gray-100, #f1f5f9) 25%,
    var(--color-gray-300, #cbd5e1) 50%,
    var(--color-gray-100, #f1f5f9) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --------------------------------------------------------------------------
   Button Toolbar - Mobile Responsive
   -------------------------------------------------------------------------- */
.btn-toolbar {
  flex-wrap: wrap;
  gap: 0.5rem;
}

@media (max-width: 768px) {
  .btn-toolbar .btn {
    flex: 1 0 auto;
    min-width: 44px; /* Touch target size */
  }
  
  .btn-toolbar .btn-group {
    flex: 1 1 100%;
  }
}

/* --------------------------------------------------------------------------
   Breadcrumb Responsiveness
   -------------------------------------------------------------------------- */
.breadcrumb {
  flex-wrap: wrap;
  overflow-x: auto;
  white-space: nowrap;
  margin-bottom: var(--spacing-lg, 1.5rem);
}

@media (max-width: 768px) {
  .breadcrumb-item {
    font-size: var(--font-size-sm, 0.875rem);
  }
  
  /* Show ellipsis for long breadcrumb trails */
  .breadcrumb-item:not(:nth-last-child(-n+2)):not(:first-child) {
    display: none;
  }
  
  .breadcrumb-item:nth-last-child(3)::after {
    content: " ... ";
  }
}

/* --------------------------------------------------------------------------
   Responsive Tables - Mobile Card View
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .table-responsive {
    max-height: none;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Add scroll indicator */
  .table-responsive::after {
    content: "← Scroll →";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    font-size: var(--font-size-xs, 0.75rem);
    color: var(--color-gray-500, #64748b);
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: var(--radius-sm, 0.375rem) var(--radius-sm, 0.375rem) 0 0;
    opacity: 0.7;
  }
}

/* --------------------------------------------------------------------------
   Improved Spacing System
   -------------------------------------------------------------------------- */
:root {
  --card-spacing: 1.5rem;
  --section-spacing: 3rem;
}

.card-container {
  margin-bottom: var(--card-spacing);
}

.page-section {
  margin-bottom: var(--section-spacing);
}

/* --------------------------------------------------------------------------
   Performance Optimizations
   -------------------------------------------------------------------------- */
/* Reduce repaints with will-change for animated elements */
.card:hover,
.btn:hover {
  will-change: transform;
}

/* Optimize rendering for large tables */
.table-responsive {
  contain: layout style paint;
}

/* --------------------------------------------------------------------------
   Print Styles
   -------------------------------------------------------------------------- */
@media print {
  .table-responsive {
    max-height: none !important;
    overflow: visible !important;
  }
  
  .table thead th {
    position: static !important;
  }
  
  .btn,
  .breadcrumb,
  .alert {
    display: none !important;
  }
  
  .card {
    border: 1px solid #dee2e6 !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }
}

/* ==========================================================================
   Phase 2: Enhanced Mobile Responsiveness & Loading States
   ========================================================================== */

/* --------------------------------------------------------------------------
   Mobile Table Scroll Indicators
   -------------------------------------------------------------------------- */
.table-scroll-wrapper {
  position: relative;
}

.table-scroll-wrapper::before,
.table-scroll-wrapper::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 30px;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transition: opacity var(--transition-base, 0.2s);
}

.table-scroll-wrapper::before {
  left: 0;
  background: linear-gradient(to right, rgba(255, 255, 255, 0.9), transparent);
}

.table-scroll-wrapper::after {
  right: 0;
  background: linear-gradient(to left, rgba(255, 255, 255, 0.9), transparent);
}

.table-scroll-wrapper.scrolled-left::before {
  opacity: 1;
}

.table-scroll-wrapper.scrolled-right::after {
  opacity: 1;
}

/* Mobile Table Improvements */
@media (max-width: 768px) {
  .table-responsive {
    border: 1px solid var(--color-gray-300, #e5e7eb);
    border-radius: var(--radius-md, 0.5rem);
    max-height: none;
    margin-left: -0.75rem;
    margin-right: -0.75rem;
    border-left: none;
    border-right: none;
    border-radius: 0;
  }
  
  .table-responsive .table {
    margin-bottom: 0;
    min-width: 100%; /* Let table fit container width */
  }
  
  .table-responsive .table th,
  .table-responsive .table td {
    white-space: nowrap;
    padding: 0.5rem 0.5rem;
    font-size: 0.8125rem;
  }
  
  /* Hide less important columns on mobile */
  .table th:nth-child(3),
  .table td:nth-child(3),
  .table th:nth-child(5),
  .table td:nth-child(5) {
    display: none;
  }
  
  /* Make first column sticky on mobile for context */
  .table-responsive .table th:first-child,
  .table-responsive .table td:first-child {
    position: sticky;
    left: 0;
    background: white;
    z-index: 1;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.05);
  }
  
  .table-responsive .table thead th:first-child {
    background: linear-gradient(to bottom, #f8fafc 0%, #f1f5f9 100%);
  }
  
  /* Scroll hint shadow */
  .table-responsive {
    background: 
      linear-gradient(90deg, white 30%, transparent),
      linear-gradient(90deg, transparent, white 70%) 100% 0,
      radial-gradient(farthest-side at 0% 50%, rgba(0,0,0,.15), transparent),
      radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.15), transparent) 100% 0;
    background-repeat: no-repeat;
    background-color: white;
    background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
    background-attachment: local, local, scroll, scroll;
  }
}

/* Column Visibility Control */
.column-hidden {
  display: none !important;
}

#columnSelector {
  min-width: 420px;
  max-width: 500px;
}

#columnSelector .form-check {
  padding: 0.4rem 0.5rem;
  margin-bottom: 0.35rem;
  cursor: pointer;
  border-radius: 0.25rem;
  transition: background-color 0.15s ease;
}

#columnSelector .form-check:hover {
  background-color: #f8f9fa;
}

#columnSelector .form-check-input {
  cursor: pointer;
  margin-top: 0.25rem;
  width: 1.1rem;
  height: 1.1rem;
}

#columnSelector .form-check-label {
  cursor: pointer;
  user-select: none;
  font-size: 0.9rem;
  padding-left: 0.25rem;
}

#columnSelector .border-bottom,
#columnSelector .border-top {
  border-color: #e5e7eb !important;
}

#columnSelector small {
  font-size: 0.8rem;
}

@media (max-width: 576px) {
  #columnSelector {
    min-width: 280px;
    max-width: 90vw;
  }
  
  #columnSelector .row .col-6 {
    width: 100%;
  }
}

/* --------------------------------------------------------------------------
   Mobile Button Toolbar Optimization
   -------------------------------------------------------------------------- */
@media (max-width: 576px) {
  .btn-toolbar {
    flex-direction: column;
    align-items: stretch !important;
  }
  
  .btn-toolbar .btn-group,
  .btn-toolbar .btn {
    width: 100%;
    margin-bottom: 0.5rem;
  }
  
  .btn-toolbar .btn-group:last-child,
  .btn-toolbar .btn:last-child {
    margin-bottom: 0;
  }
}

/* ==========================================================================
   Professional Page Layout Enhancements
   ========================================================================== */

/* Main container styling */
.container,
.container-fluid {
  margin-top: 2rem;
  margin-bottom: 2rem;
}

/* Page headers */
.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e2e8f0;
}

.page-header h1,
.page-header h2 {
  font-weight: 800;
  color: var(--color-gray-900);
  letter-spacing: -0.02em;
}

/* Action bar */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #f8fafc;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
}

@media (max-width: 768px) {
  .action-bar {
    flex-direction: column;
    gap: 1rem;
  }
  
  .action-bar > * {
    width: 100%;
  }
}

/* List group enhancements */
.list-group-item {
  border-color: #e2e8f0;
  transition: all var(--transition-base);
}

.list-group-item:hover {
  background: #f8fafc;
  border-left: 3px solid var(--color-primary);
  padding-left: calc(1rem - 2px);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--color-gray-500);
}

.empty-state i {
  font-size: 4rem;
  margin-bottom: 1rem;
  color: var(--color-gray-400);
}

.empty-state h3 {
  color: var(--color-gray-700);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

/* Loading spinner */
.spinner-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
}

/* Breadcrumb enhancement */
.breadcrumb {
  background: transparent;
  padding: 0;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.breadcrumb-item + .breadcrumb-item::before {
  color: var(--color-gray-400);
}

.breadcrumb-item.active {
  color: var(--color-primary);
  font-weight: 600;
}

/* Smooth scrolling for anchor links */
html {
  scroll-padding-top: 80px;
}

@media (max-width: 768px) {
  .btn-toolbar .btn:last-child,
  .btn-toolbar .btn-group:last-child {
    margin-bottom: 0;
  }
  
  /* Stack action buttons in table rows */
  .table .btn-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }
  
  .table .btn-group .btn {
    width: 100%;
  }
}

/* --------------------------------------------------------------------------
   Mobile Card View Alternative (for complex tables)
   -------------------------------------------------------------------------- */
.mobile-card-view {
  display: none;
}

@media (max-width: 768px) {
  .mobile-card-view {
    display: block;
  }
  
  .desktop-table-view {
    display: none;
  }
  
  .mobile-card-view .card {
    margin-bottom: 1rem;
    border-left: 4px solid var(--color-primary, #2563eb);
  }
  
  .mobile-card-view .card-body {
    padding: 1rem;
  }
  
  .mobile-card-view .mobile-card-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-gray-200, #e5e7eb);
  }
  
  .mobile-card-view .mobile-card-row:last-child {
    border-bottom: none;
  }
  
  .mobile-card-view .mobile-card-label {
    font-weight: 600;
    color: var(--color-gray-700, #374151);
    flex: 0 0 45%;
  }
  
  .mobile-card-view .mobile-card-value {
    flex: 1;
    text-align: right;
    color: var(--color-gray-900, #111827);
  }
  
  .mobile-card-view .mobile-card-actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid var(--color-gray-200, #e5e7eb);
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
  }
  
  .mobile-card-view .mobile-card-actions .btn {
    flex: 1;
    min-width: 100px;
  }
}

@media (min-width: 769px) {
  .desktop-table-view {
    display: block;
  }
  
  .mobile-card-view {
    display: none !important;
  }
}

/* --------------------------------------------------------------------------
   Page Size Selector Mobile Optimization
   -------------------------------------------------------------------------- */
@media (max-width: 576px) {
  .d-flex.justify-content-between.align-items-center.mb-3 {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 0.75rem;
  }
  
  #pageSizeSelect {
    width: 100%;
  }
}

/* --------------------------------------------------------------------------
   Loading Skeleton Screens
   -------------------------------------------------------------------------- */
.skeleton-loader {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
}

.skeleton-card {
  background: white;
  border-radius: var(--radius-lg, 0.5rem);
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.skeleton-line {
  height: 16px;
  background: linear-gradient(
    90deg,
    var(--color-gray-200, #e5e7eb) 25%,
    var(--color-gray-100, #f3f4f6) 50%,
    var(--color-gray-200, #e5e7eb) 75%
  );
  background-size: 200% 100%;
  border-radius: var(--radius-sm, 0.375rem);
  animation: skeleton-shimmer 1.5s infinite;
  margin-bottom: 0.75rem;
}

.skeleton-line:last-child {
  margin-bottom: 0;
}

.skeleton-line.short {
  width: 60%;
}

.skeleton-line.medium {
  width: 80%;
}

.skeleton-line.long {
  width: 100%;
}

.skeleton-table {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.skeleton-table-row {
  display: flex;
  gap: 1rem;
  padding: 0.75rem;
  background: white;
  border-radius: var(--radius-sm, 0.375rem);
  border: 1px solid var(--color-gray-200, #e5e7eb);
}

.skeleton-table-cell {
  height: 20px;
  flex: 1;
  background: linear-gradient(
    90deg,
    var(--color-gray-200, #e5e7eb) 25%,
    var(--color-gray-100, #f3f4f6) 50%,
    var(--color-gray-200, #e5e7eb) 75%
  );
  background-size: 200% 100%;
  border-radius: var(--radius-sm, 0.375rem);
  animation: skeleton-shimmer 1.5s infinite;
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Hide skeleton when content loads */
.content-loaded .skeleton-loader {
  display: none;
}

/* --------------------------------------------------------------------------
   Improved Touch Targets for Mobile
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .pagination .page-link {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  
  .btn {
    min-height: 44px;
    padding: 0.5rem 1rem;
  }
  
  .btn-sm {
    min-height: 38px;
    padding: 0.375rem 0.75rem;
  }
  
  .form-check-input {
    width: 1.25rem;
    height: 1.25rem;
  }
  
  .form-select,
  .form-control {
    min-height: 44px;
  }
}

/* --------------------------------------------------------------------------
   Mobile Search and Filter Forms
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .search-filter-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .search-filter-form .form-group,
  .search-filter-form .mb-3 {
    margin-bottom: 0;
  }
  
  .search-filter-form .btn {
    width: 100%;
  }
  
  /* Filter collapse improvements */
  .filter-section {
    background: var(--color-gray-50, #f9fafb);
    padding: 1rem;
    border-radius: var(--radius-md, 0.5rem);
    margin-bottom: 1rem;
  }
}

/* --------------------------------------------------------------------------
   Loading Spinner Overlay
   -------------------------------------------------------------------------- */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base, 0.2s);
}

.loading-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--color-gray-300, #e5e7eb);
  border-top-color: var(--color-primary, #2563eb);
  border-radius: 50%;
  animation: spinner-rotate 0.8s linear infinite;
}

@keyframes spinner-rotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   End of UI Optimizations
   ========================================================================== */

