/**
 * ITQAN BMS - Modern Design System
 * 
 * A comprehensive, accessible, and mobile-first design system
 * following global best practices for UX, accessibility, and responsiveness.
 * 
 * Key Features:
 * - WCAG 2.1 AA compliant color contrast
 * - Mobile-first responsive design
 * - Consistent spacing and typography
 * - Accessible focus states and interactions
 * - RTL support for bilingual interface
 * - Performance optimized
 */

/* ========================================
   1. CSS CUSTOM PROPERTIES (Design Tokens)
   ======================================== */

:root {
  /* Color Palette - Primary */
  --primary-50: #e3f2fd;
  --primary-100: #bbdefb;
  --primary-200: #90caf9;
  --primary-300: #64b5f6;
  --primary-400: #42a5f5;
  --primary-500: #2196f3;
  --primary-600: #1e88e5;
  --primary-700: #1976d2;
  --primary-800: #1565c0;
  --primary-900: #0d47a1;
  
  /* Color Palette - Semantic */
  --success-50: #e8f5e9;
  --success-500: #4caf50;
  --success-700: #388e3c;
  --success-900: #1b5e20;
  
  --warning-50: #fff3e0;
  --warning-500: #ff9800;
  --warning-700: #f57c00;
  --warning-900: #e65100;
  
  --error-50: #ffebee;
  --error-500: #f44336;
  --error-700: #d32f2f;
  --error-900: #b71c1c;
  
  --info-50: #e1f5fe;
  --info-500: #03a9f4;
  --info-700: #0288d1;
  --info-900: #01579b;
  
  /* Neutral Palette */
  --neutral-0: #ffffff;
  --neutral-50: #fafafa;
  --neutral-100: #f5f5f5;
  --neutral-200: #eeeeee;
  --neutral-300: #e0e0e0;
  --neutral-400: #bdbdbd;
  --neutral-500: #9e9e9e;
  --neutral-600: #757575;
  --neutral-700: #616161;
  --neutral-800: #424242;
  --neutral-900: #212121;
  
  /* Typography Scale */
  --font-family-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Helvetica Neue', sans-serif;
  --font-family-mono: 'SF Mono', 'Monaco', 'Cascadia Code', 'Consolas', 'Courier New', monospace;
  --font-family-rtl: 'Segoe UI', 'Tahoma', 'Arial', sans-serif;
  
  --font-size-xs: 0.75rem;     /* 12px */
  --font-size-sm: 0.875rem;    /* 14px */
  --font-size-base: 1rem;      /* 16px */
  --font-size-lg: 1.125rem;    /* 18px */
  --font-size-xl: 1.25rem;     /* 20px */
  --font-size-2xl: 1.5rem;     /* 24px */
  --font-size-3xl: 1.875rem;   /* 30px */
  --font-size-4xl: 2.25rem;    /* 36px */
  --font-size-5xl: 3rem;       /* 48px */
  
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;
  
  /* Spacing Scale (8px base) */
  --space-0: 0;
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */
  --space-20: 5rem;     /* 80px */
  
  /* Border Radius */
  --radius-sm: 0.25rem;   /* 4px */
  --radius-md: 0.375rem;  /* 6px */
  --radius-lg: 0.5rem;    /* 8px */
  --radius-xl: 0.75rem;   /* 12px */
  --radius-2xl: 1rem;     /* 16px */
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --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);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Z-index Scale */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  
  /* Layout */
  --container-max-width: 1280px;
  --sidebar-width: 260px;
  --navbar-height: 64px;
  --touch-target-min: 44px;
}

/* ========================================
   2. GLOBAL RESETS & BASE STYLES
   ======================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--neutral-900);
  background-color: var(--neutral-50);
  min-height: 100vh;
  overflow-x: hidden;
}

/* RTL Support */
[dir="rtl"] body {
  font-family: var(--font-family-rtl);
  direction: rtl;
  text-align: right;
}

/* ========================================
   3. TYPOGRAPHY
   ======================================== */

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--neutral-900);
  margin-bottom: var(--space-4);
}

h1 {
  font-size: var(--font-size-4xl);
  letter-spacing: -0.025em;
}

h2 {
  font-size: var(--font-size-3xl);
  letter-spacing: -0.025em;
}

h3 {
  font-size: var(--font-size-2xl);
}

h4 {
  font-size: var(--font-size-xl);
}

h5 {
  font-size: var(--font-size-lg);
}

h6 {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
}

p {
  margin-bottom: var(--space-4);
  line-height: var(--line-height-relaxed);
}

a {
  color: var(--primary-700);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-800);
  text-decoration: underline;
}

a:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Text Utilities */
.text-muted {
  color: var(--neutral-600) !important;
}

.text-small {
  font-size: var(--font-size-sm);
}

.text-xs {
  font-size: var(--font-size-xs);
}

/* ========================================
   4. LAYOUT COMPONENTS
   ======================================== */

/* Container */
.container-custom {
  width: 100%;
  max-width: var(--container-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

@media (min-width: 768px) {
  .container-custom {
    padding-left: var(--space-6);
    padding-right: var(--space-6);
  }
}

/* Card Component */
.card-custom {
  background: var(--neutral-0);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  transition: box-shadow var(--transition-base);
}

.card-custom:hover {
  box-shadow: var(--shadow-md);
}

.card-custom-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--neutral-200);
}

.card-custom-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--neutral-900);
  margin: 0;
}

.card-custom-body {
  /* Already has padding from .card-custom */
}

/* ========================================
   5. NAVIGATION
   ======================================== */

.navbar-custom {
  background: var(--neutral-0);
  box-shadow: var(--shadow-sm);
  height: var(--navbar-height);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

.navbar-brand-custom {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--primary-700);
  text-decoration: none;
}

.navbar-brand-custom:hover {
  color: var(--primary-800);
  text-decoration: none;
}

.navbar-nav-custom {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link-custom {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  color: var(--neutral-700);
  font-weight: var(--font-weight-medium);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  white-space: nowrap;
  min-height: var(--touch-target-min);
}

.nav-link-custom:hover {
  background: var(--neutral-100);
  color: var(--neutral-900);
  text-decoration: none;
}

.nav-link-custom.active {
  background: var(--primary-50);
  color: var(--primary-700);
}

/* Mobile Navigation */
.navbar-toggle {
  display: none;
  background: none;
  border: none;
  padding: var(--space-2);
  cursor: pointer;
  color: var(--neutral-700);
  min-height: var(--touch-target-min);
  min-width: var(--touch-target-min);
}

@media (max-width: 991px) {
  .navbar-toggle {
    display: block;
  }
  
  .navbar-nav-custom {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    background: var(--neutral-0);
    flex-direction: column;
    align-items: stretch;
    padding: var(--space-4);
    box-shadow: var(--shadow-lg);
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-base);
  }
  
  .navbar-nav-custom.show {
    max-height: calc(100vh - var(--navbar-height));
    overflow-y: auto;
  }
  
  .nav-link-custom {
    width: 100%;
    justify-content: flex-start;
  }
}

/* ========================================
   6. BUTTONS
   ======================================== */

.btn-custom {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-tight);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  min-height: var(--touch-target-min);
  user-select: none;
}

.btn-custom:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.btn-custom:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* Button Variants */
.btn-primary {
  background: var(--primary-600);
  color: var(--neutral-0);
  border-color: var(--primary-600);
}

.btn-primary:hover {
  background: var(--primary-700);
  border-color: var(--primary-700);
  color: var(--neutral-0);
  text-decoration: none;
}

.btn-secondary {
  background: var(--neutral-100);
  color: var(--neutral-900);
  border-color: var(--neutral-300);
}

.btn-secondary:hover {
  background: var(--neutral-200);
  border-color: var(--neutral-400);
  color: var(--neutral-900);
  text-decoration: none;
}

.btn-success {
  background: var(--success-500);
  color: var(--neutral-0);
  border-color: var(--success-500);
}

.btn-success:hover {
  background: var(--success-700);
  border-color: var(--success-700);
  color: var(--neutral-0);
}

.btn-danger {
  background: var(--error-500);
  color: var(--neutral-0);
  border-color: var(--error-500);
}

.btn-danger:hover {
  background: var(--error-700);
  border-color: var(--error-700);
  color: var(--neutral-0);
}

.btn-warning {
  background: var(--warning-500);
  color: var(--neutral-900);
  border-color: var(--warning-500);
}

.btn-warning:hover {
  background: var(--warning-700);
  color: var(--neutral-0);
  border-color: var(--warning-700);
}

.btn-outline {
  background: transparent;
  color: var(--primary-700);
  border-color: var(--primary-600);
}

.btn-outline:hover {
  background: var(--primary-600);
  color: var(--neutral-0);
}

.btn-ghost {
  background: transparent;
  color: var(--neutral-700);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--neutral-100);
  color: var(--neutral-900);
}

/* Button Sizes */
.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-sm);
  min-height: 36px;
}

.btn-lg {
  padding: var(--space-4) var(--space-6);
  font-size: var(--font-size-lg);
  min-height: 52px;
}

.btn-icon {
  padding: var(--space-2);
  min-width: var(--touch-target-min);
}

/* ========================================
   7. FORMS
   ======================================== */

.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--neutral-800);
  margin-bottom: var(--space-2);
}

.form-label-required::after {
  content: " *";
  color: var(--error-500);
}

.form-control {
  display: block;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--neutral-900);
  background-color: var(--neutral-0);
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  min-height: var(--touch-target-min);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.form-control:disabled {
  background-color: var(--neutral-100);
  color: var(--neutral-500);
  cursor: not-allowed;
}

.form-control.is-invalid {
  border-color: var(--error-500);
}

.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(244, 67, 54, 0.1);
}

.form-control.is-valid {
  border-color: var(--success-500);
}

.form-control.is-valid:focus {
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

/* Select */
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23424242' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-8);
}

[dir="rtl"] select.form-control {
  background-position: left var(--space-3) center;
  padding-left: var(--space-8);
  padding-right: var(--space-4);
}

/* Textarea */
textarea.form-control {
  resize: vertical;
  min-height: 120px;
}

/* Checkbox and Radio */
.form-check {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  min-height: var(--touch-target-min);
}

.form-check-input {
  width: 20px;
  height: 20px;
  margin: 0;
  cursor: pointer;
  flex-shrink: 0;
}

.form-check-label {
  cursor: pointer;
  user-select: none;
  margin: 0;
}

/* Form Feedback */
.form-feedback {
  display: block;
  margin-top: var(--space-2);
  font-size: var(--font-size-sm);
}

.form-feedback.invalid {
  color: var(--error-700);
}

.form-feedback.valid {
  color: var(--success-700);
}

.form-text {
  display: block;
  margin-top: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--neutral-600);
}

/* ========================================
   8. TABLES
   ======================================== */

.table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: var(--space-6);
}

.table-custom {
  width: 100%;
  border-collapse: collapse;
  background: var(--neutral-0);
  font-size: var(--font-size-sm);
}

.table-custom thead {
  background: var(--neutral-50);
  border-bottom: 2px solid var(--neutral-200);
}

.table-custom th {
  padding: var(--space-4);
  text-align: left;
  font-weight: var(--font-weight-semibold);
  color: var(--neutral-800);
  white-space: nowrap;
}

[dir="rtl"] .table-custom th {
  text-align: right;
}

.table-custom td {
  padding: var(--space-4);
  border-top: 1px solid var(--neutral-200);
  color: var(--neutral-700);
}

.table-custom tbody tr {
  transition: background-color var(--transition-fast);
}

.table-custom tbody tr:hover {
  background: var(--neutral-50);
}

.table-custom-striped tbody tr:nth-child(even) {
  background: var(--neutral-50);
}

.table-custom-striped tbody tr:nth-child(even):hover {
  background: var(--neutral-100);
}

/* Responsive table */
@media (max-width: 767px) {
  .table-responsive-mobile {
    display: block;
  }
  
  .table-responsive-mobile thead {
    display: none;
  }
  
  .table-responsive-mobile tbody,
  .table-responsive-mobile tr,
  .table-responsive-mobile td {
    display: block;
  }
  
  .table-responsive-mobile tr {
    margin-bottom: var(--space-4);
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-md);
    padding: var(--space-3);
  }
  
  .table-responsive-mobile td {
    border: none;
    padding: var(--space-2) 0;
    text-align: right;
  }
  
  .table-responsive-mobile td::before {
    content: attr(data-label);
    float: left;
    font-weight: var(--font-weight-semibold);
    color: var(--neutral-800);
  }
}

/* ========================================
   9. BADGES & STATUS INDICATORS
   ======================================== */

.badge-custom {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  line-height: 1;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-primary {
  background: var(--primary-100);
  color: var(--primary-900);
}

.badge-success {
  background: var(--success-100);
  color: var(--success-900);
}

.badge-warning {
  background: var(--warning-100);
  color: var(--warning-900);
}

.badge-danger {
  background: var(--error-100);
  color: var(--error-900);
}

.badge-info {
  background: var(--info-100);
  color: var(--info-900);
}

.badge-neutral {
  background: var(--neutral-200);
  color: var(--neutral-800);
}

/* Status Dot */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  margin-right: var(--space-2);
}

[dir="rtl"] .status-dot {
  margin-right: 0;
  margin-left: var(--space-2);
}

.status-dot-success {
  background: var(--success-500);
}

.status-dot-warning {
  background: var(--warning-500);
}

.status-dot-danger {
  background: var(--error-500);
}

.status-dot-info {
  background: var(--info-500);
}

/* ========================================
   10. ALERTS & NOTIFICATIONS
   ======================================== */

.alert-custom {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  border-radius: var(--radius-md);
  border-left: 4px solid;
}

[dir="rtl"] .alert-custom {
  border-left: none;
  border-right: 4px solid;
}

.alert-icon {
  flex-shrink: 0;
  font-size: var(--font-size-xl);
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-1);
}

.alert-message {
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
}

.alert-dismiss {
  background: none;
  border: none;
  padding: var(--space-1);
  cursor: pointer;
  color: currentColor;
  opacity: 0.7;
  transition: opacity var(--transition-fast);
  flex-shrink: 0;
}

.alert-dismiss:hover {
  opacity: 1;
}

/* Alert Variants */
.alert-success {
  background: var(--success-50);
  border-color: var(--success-500);
  color: var(--success-900);
}

.alert-warning {
  background: var(--warning-50);
  border-color: var(--warning-500);
  color: var(--warning-900);
}

.alert-danger {
  background: var(--error-50);
  border-color: var(--error-500);
  color: var(--error-900);
}

.alert-info {
  background: var(--info-50);
  border-color: var(--info-500);
  color: var(--info-900);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-tooltip);
  max-width: 420px;
}

[dir="rtl"] .toast-container {
  right: auto;
  left: var(--space-6);
}

.toast {
  background: var(--neutral-0);
  box-shadow: var(--shadow-xl);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-3);
  animation: slideIn var(--transition-base);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ========================================
   11. MODALS & DIALOGS
   ======================================== */

.modal-backdrop-custom {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: var(--z-modal-backdrop);
  animation: fadeIn var(--transition-base);
}

.modal-dialog-custom {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--neutral-0);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl);
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  z-index: var(--z-modal);
  animation: scaleIn var(--transition-base);
}

/* Don't override Bootstrap modals - let Bootstrap handle them */
.modal {
  /* Bootstrap styles will apply here */
}

.modal-dialog {
  /* Bootstrap styles will apply here */
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6);
  border-bottom: 1px solid var(--neutral-200);
}

.modal-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  padding: var(--space-2);
  cursor: pointer;
  color: var(--neutral-600);
  transition: color var(--transition-fast);
  min-height: var(--touch-target-min);
  min-width: var(--touch-target-min);
}

.modal-close:hover {
  color: var(--neutral-900);
}

.modal-body {
  padding: var(--space-6);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-6);
  border-top: 1px solid var(--neutral-200);
}

/* ========================================
   12. LOADING STATES
   ======================================== */

.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--neutral-200);
  border-top-color: var(--primary-600);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.spinner-lg {
  width: 32px;
  height: 32px;
  border-width: 4px;
}

.loading-overlay {
  position: absolute;
  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: var(--z-modal);
}

/* ========================================
   13. UTILITY CLASSES
   ======================================== */

/* Spacing */
.mt-0 { margin-top: var(--space-0) !important; }
.mt-1 { margin-top: var(--space-1) !important; }
.mt-2 { margin-top: var(--space-2) !important; }
.mt-3 { margin-top: var(--space-3) !important; }
.mt-4 { margin-top: var(--space-4) !important; }
.mt-5 { margin-top: var(--space-5) !important; }
.mt-6 { margin-top: var(--space-6) !important; }
.mt-8 { margin-top: var(--space-8) !important; }

.mb-0 { margin-bottom: var(--space-0) !important; }
.mb-1 { margin-bottom: var(--space-1) !important; }
.mb-2 { margin-bottom: var(--space-2) !important; }
.mb-3 { margin-bottom: var(--space-3) !important; }
.mb-4 { margin-bottom: var(--space-4) !important; }
.mb-5 { margin-bottom: var(--space-5) !important; }
.mb-6 { margin-bottom: var(--space-6) !important; }
.mb-8 { margin-bottom: var(--space-8) !important; }

.p-0 { padding: var(--space-0) !important; }
.p-1 { padding: var(--space-1) !important; }
.p-2 { padding: var(--space-2) !important; }
.p-3 { padding: var(--space-3) !important; }
.p-4 { padding: var(--space-4) !important; }
.p-5 { padding: var(--space-5) !important; }
.p-6 { padding: var(--space-6) !important; }

/* Display */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }

/* Flexbox */
.flex-row { flex-direction: row !important; }
.flex-column { flex-direction: column !important; }
.align-items-center { align-items: center !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.gap-2 { gap: var(--space-2) !important; }
.gap-3 { gap: var(--space-3) !important; }
.gap-4 { gap: var(--space-4) !important; }

/* Text Alignment */
.text-left { text-align: left !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }

/* Visibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Focus visible utility */
.focus-visible:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

/* ========================================
   14. RESPONSIVE BREAKPOINTS
   ======================================== */

@media (max-width: 640px) {
  :root {
    --font-size-4xl: 2rem;
    --font-size-3xl: 1.5rem;
  }
  
  h1 { font-size: var(--font-size-3xl); }
  h2 { font-size: var(--font-size-2xl); }
  
  .card-custom {
    padding: var(--space-4);
  }
  
  .btn-custom {
    width: 100%;
  }
  
  .modal-dialog {
    max-width: 95vw;
  }
}

/* ========================================
   15. DARK MODE SUPPORT (Optional)
   ======================================== */

@media (prefers-color-scheme: dark) {
  /* Can be enabled later if needed */
}

/* ========================================
   16. PRINT STYLES
   ======================================== */

@media print {
  body {
    background: white;
  }
  
  .navbar-custom,
  .btn-custom,
  .alert-dismiss,
  .no-print {
    display: none !important;
  }
  
  .card-custom {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* ========================================
   17. BOOTSTRAP MODAL FIXES
   ======================================== */

/* Ensure Bootstrap modals display correctly and centered */
.modal.fade .modal-dialog {
  position: relative !important;
  transform: translate(0, 0) !important;
  top: auto !important;
  left: auto !important;
  max-width: 500px;
  margin: 1.75rem auto;
}

.modal.show .modal-dialog {
  transform: none !important;
}

.modal-dialog-centered {
  display: flex !important;
  align-items: center !important;
  min-height: calc(100% - 3.5rem) !important;
}

/* Responsive modal sizes */
@media (max-width: 576px) {
  .modal-dialog {
    max-width: 95vw !important;
    margin: 0.5rem !important;
  }
  
  .modal-dialog-centered {
    min-height: calc(100% - 1rem) !important;
  }
}

/* ========================================
   DROPDOWN FIX - Ensure dropdowns appear above content
   ======================================== */

/* Bootstrap dropdown menu z-index fix - MAXIMUM PRIORITY */
.dropdown-menu {
  z-index: 9999 !important;
}

/* Show dropdown menu when active */
.dropdown-menu.show {
  z-index: 9999 !important;
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

/* Make navbar dropdown menus scrollable with max height */
.navbar .dropdown-menu {
  max-height: 70vh !important;
  overflow-y: auto !important;
}

/* Compact dropdown items */
.navbar .dropdown-menu .dropdown-item {
  padding: 0.4rem 1rem !important;
  font-size: 0.9rem !important;
}

/* Compact dropdown headers */
.navbar .dropdown-menu .dropdown-header {
  padding: 0.5rem 1rem 0.3rem !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  margin-top: 0.25rem !important;
}

/* First header has no top margin */
.navbar .dropdown-menu .dropdown-header:first-child {
  margin-top: 0 !important;
}

/* Compact dividers */
.navbar .dropdown-menu .dropdown-divider {
  margin: 0.35rem 0 !important;
}

/* Custom scrollbar for dropdown */
.navbar .dropdown-menu::-webkit-scrollbar {
  width: 6px !important;
}

.navbar .dropdown-menu::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05) !important;
  border-radius: 3px !important;
}

.navbar .dropdown-menu::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2) !important;
  border-radius: 3px !important;
}

.navbar .dropdown-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3) !important;
}

/* Navbar dropdowns need relative positioning to work properly */
.navbar .dropdown,
.navbar .btn-group,
.navbar .dropup,
.navbar .dropend,
.navbar .dropstart {
  position: relative !important;
}

/* Force navbar dropdown menus to appear below the toggle */
.navbar .dropdown-menu {
  position: absolute !important;
  top: 100% !important;
  left: 0 !important;
  margin: 0 !important;
  transform: none !important;
}

/* Table dropdowns need static positioning to escape table boundaries */
.table .dropdown,
.table .btn-group {
  position: static !important;
}

/* Table dropdown menus use fixed positioning */
.table .dropdown-menu {
  position: fixed !important;
}

/* Fix for table-responsive overflow clipping dropdowns.
   Dropdown menus inside tables use position:fixed (see rules above), so they
   already escape ancestor overflow clipping - we don't need to force the
   whole wrapper to overflow:visible (which breaks horizontal scrolling and
   causes wide tables to be cut off by parent cards with overflow:hidden).
   Allow horizontal scroll, keep vertical visible so row dropdowns aren't clipped. */
.table-responsive {
  overflow-x: auto !important;
  overflow-y: visible !important;
  position: relative;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 #f1f5f9;
}
.table-responsive::-webkit-scrollbar {
  height: 8px;
}
.table-responsive::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 10px;
}
.table-responsive::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}
.table-responsive::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Table dropdown parent cells need static positioning */
.table td .dropdown,
.table th .dropdown {
  position: static !important;
}

/* Fix dropdown menu alignment in tables */
.table .dropdown-menu[data-bs-popper] {
  left: auto !important;
  right: 0 !important;
}

/* Ensure card bodies don't clip dropdowns */
.card-body {
  overflow: visible !important;
  position: relative;
}

/* Fix for dropdowns in cards */
.card .dropdown-menu {
  z-index: 9999 !important;
  position: fixed !important;
}

/* Ensure table rows don't clip dropdowns */
.table tbody tr,
.table thead tr {
  position: relative;
  overflow: visible !important;
}

/* Ensure table cells don't clip content */
.table td,
.table th {
  overflow: visible !important;
  position: relative;
}

/* Fix for card containers that might clip dropdowns */
.card {
  overflow: visible !important;
  position: relative;
}

/* Ensure page content containers don't clip dropdowns */
.container,
.container-fluid {
  overflow: visible !important;
  position: relative;
}

/* Row containers should not clip dropdowns */
.row {
  overflow: visible !important;
  position: relative;
}

/* Additional aggressive fixes for table dropdowns */
.table {
  overflow: visible !important;
}

.table tbody,
.table thead,
.table tfoot {
  overflow: visible !important;
}

/* Ensure no parent can clip the dropdown - ONLY FOR TABLES! */
.table .dropdown-menu.show {
  z-index: 9999 !important;
  position: fixed !important;
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

/* Navbar dropdowns should NOT use fixed positioning */
body .navbar .dropdown-menu.show {
  position: absolute !important;
  transform: none !important;
  will-change: auto;
}

/* ========================================
   PROFESSIONAL BUSINESS VIEW ENHANCEMENTS
   ======================================== */

/* Card hover effects */
.hover-shadow {
  transition: all 0.3s ease-in-out;
}

.hover-shadow:hover {
  transform: translateY(-5px);
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.15) !important;
}

/* Gradient header */
.bg-gradient-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Info item spacing */
.info-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid #f0f0f0;
}

.info-item:last-child {
  border-bottom: none;
}

/* Professional transitions */
.transition {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Badge enhancements */
.badge {
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* Card shadows */
.card.shadow-sm {
  box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.08);
}

.card.shadow-lg {
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

/* Professional table styling */
.table thead th {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.875rem;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #dee2e6;
}

/* Financial card styling */
.bg-success-subtle {
  background-color: #d1e7dd !important;
}

.bg-primary-subtle {
  background-color: #cfe2ff !important;
}

