/* SISF Portal - Material Design CSS */
/* Following Google's Material Design Guidelines with limited color palette */

/* ============================================================
   ROOT VARIABLES & DESIGN TOKENS
============================================================ */
:root {
  /* Primary Colors - Material Blue */
  --md-primary: #1976d2;
  --md-primary-variant: #1565c0;
  --md-primary-light: #e3f2fd;
  --md-on-primary: #ffffff;
  
  /* Secondary Colors - Material Teal */
  --md-secondary: #0097a7;
  --md-secondary-variant: #00838f;
  --md-secondary-light: #e0f2f1;
  --md-on-secondary: #ffffff;
  
  /* Surface & Background */
  --md-surface: #ffffff;
  --md-surface-variant: #f5f5f5;
  --md-background: #fafafa;
  --md-on-surface: #212121;
  --md-on-background: #212121;
  
  /* Grays - Material Design Gray Scale */
  --md-gray-50: #fafafa;
  --md-gray-100: #f5f5f5;
  --md-gray-200: #eeeeee;
  --md-gray-300: #e0e0e0;
  --md-gray-400: #bdbdbd;
  --md-gray-500: #9e9e9e;
  --md-gray-600: #757575;
  --md-gray-700: #616161;
  --md-gray-800: #424242;
  --md-gray-900: #212121;
  
  /* Status Colors */
  --md-success: #4caf50;
  --md-success-light: #e8f5e8;
  --md-warning: #ff9800;
  --md-warning-light: #fff3e0;
  --md-error: #f44336;
  --md-error-light: #ffebee;
  --md-info: #2196f3;
  --md-info-light: #e3f2fd;
  
  /* Shadows - Material Design Elevation */
  --md-shadow-1: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
  --md-shadow-2: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
  --md-shadow-3: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
  --md-shadow-4: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
  --md-shadow-5: 0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22);
  
  /* Typography Scale */
  --md-font-family: 'Roboto', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --md-font-size-caption: 0.75rem;
  --md-font-size-body2: 0.875rem;
  --md-font-size-body1: 1rem;
  --md-font-size-subtitle2: 0.875rem;
  --md-font-size-subtitle1: 1rem;
  --md-font-size-h6: 1.25rem;
  --md-font-size-h5: 1.5rem;
  --md-font-size-h4: 2.125rem;
  --md-font-size-h3: 3rem;
  --md-font-size-h2: 3.75rem;
  --md-font-size-h1: 6rem;
  
  /* Line Heights */
  --md-line-height-caption: 1.33;
  --md-line-height-body: 1.5;
  --md-line-height-subtitle: 1.4;
  --md-line-height-heading: 1.2;
  
  /* Spacing Scale (8dp grid) */
  --md-space-1: 0.25rem; /* 4px */
  --md-space-2: 0.5rem;  /* 8px */
  --md-space-3: 0.75rem; /* 12px */
  --md-space-4: 1rem;    /* 16px */
  --md-space-5: 1.25rem; /* 20px */
  --md-space-6: 1.5rem;  /* 24px */
  --md-space-8: 2rem;    /* 32px */
  --md-space-10: 2.5rem; /* 40px */
  --md-space-12: 3rem;   /* 48px */
  --md-space-16: 4rem;   /* 64px */
  
  /* Border Radius */
  --md-radius-sm: 4px;
  --md-radius-md: 8px;
  --md-radius-lg: 12px;
  --md-radius-xl: 16px;
  --md-radius-round: 50%;
  
  /* Transitions */
  --md-transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --md-transition-standard: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --md-transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme Variables */
[data-bs-theme="dark"] {
  --md-surface: #121212;
  --md-surface-variant: #1e1e1e;
  --md-background: #0a0a0a;
  --md-on-surface: #ffffff;
  --md-on-background: #ffffff;
  --md-primary-light: #1565c0;
  --md-secondary-light: #00838f;
  --md-gray-50: #1e1e1e;
  --md-gray-100: #2a2a2a;
  --md-gray-200: #363636;
  --md-gray-300: #424242;
  --md-gray-400: #616161;
  --md-gray-500: #757575;
  /* Enhanced for accessibility */
  --md-label-contrast: #fff;
  --md-muted-contrast: #b0b0b0;
  --md-section-bg: #181818;
  --md-section-border: #232323;
}

/* ============================================================
   BASE STYLES & TYPOGRAPHY
============================================================ */
* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--md-font-family);
  font-size: var(--md-font-size-body1);
  line-height: var(--md-line-height-body);
  color: var(--md-on-background);
  background-color: var(--md-background);
  margin: 0;
  padding: 0;
  transition: background-color var(--md-transition-standard), color var(--md-transition-standard);
}

/* Typography Classes */
.text-title-1 {
  font-size: var(--md-font-size-h4);
  font-weight: 400;
  line-height: var(--md-line-height-heading);
  letter-spacing: 0.25px;
}

.text-title-2 {
  font-size: var(--md-font-size-h5);
  font-weight: 400;
  line-height: var(--md-line-height-heading);
  letter-spacing: 0;
}

.text-title-3 {
  font-size: var(--md-font-size-h6);
  font-weight: 500;
  line-height: var(--md-line-height-heading);
  letter-spacing: 0.15px;
}

.text-subtitle-1 {
  font-size: var(--md-font-size-subtitle1);
  font-weight: 400;
  line-height: var(--md-line-height-subtitle);
  letter-spacing: 0.15px;
}

.text-subtitle-2 {
  font-size: var(--md-font-size-subtitle2);
  font-weight: 500;
  line-height: var(--md-line-height-subtitle);
  letter-spacing: 0.1px;
}

.text-body {
  font-size: var(--md-font-size-body1);
  font-weight: 400;
  line-height: var(--md-line-height-body);
  letter-spacing: 0.5px;
}

.text-body-2 {
  font-size: var(--md-font-size-body2);
  font-weight: 400;
  line-height: var(--md-line-height-body);
  letter-spacing: 0.25px;
}

.text-caption {
  font-size: var(--md-font-size-caption);
  font-weight: 400;
  line-height: var(--md-line-height-caption);
  letter-spacing: 0.4px;
}

/* ============================================================
   LAYOUT & CONTAINER
============================================================ */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content {
  padding: var(--md-space-6);
  flex: 1;
  background-color: var(--md-background);
}

.container-fluid {
  max-width: 1400px;
  margin: 0 auto;
}

/* ============================================================
   NAVIGATION
============================================================ */
.navbar {
  background-color: var(--md-surface);
  border-bottom: 1px solid var(--md-gray-200);
  box-shadow: var(--md-shadow-1);
  padding: var(--md-space-4) 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}

[data-bs-theme="dark"] .navbar {
  border-bottom-color: var(--md-gray-300);
}

.navbar-brand {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--md-on-surface);
  text-decoration: none;
  transition: color var(--md-transition-fast);
}

.navbar-brand:hover {
  color: var(--md-primary);
}

.nav-link {
  color: var(--md-on-surface);
  font-weight: 400;
  padding: var(--md-space-2) var(--md-space-4);
  border-radius: var(--md-radius-md);
  transition: all var(--md-transition-fast);
  position: relative;
  display: flex;
  align-items: center;
}

.nav-link:hover {
  color: var(--md-primary);
  background-color: var(--md-primary-light);
}

.nav-link.active {
  color: var(--md-primary);
  background-color: var(--md-primary-light);
  font-weight: 500;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: var(--md-space-4);
  right: var(--md-space-4);
  height: 2px;
  background-color: var(--md-primary);
  border-radius: 1px;
}

.dropdown-menu {
  border: none;
  box-shadow: var(--md-shadow-2);
  border-radius: var(--md-radius-md);
  padding: var(--md-space-2);
  background-color: var(--md-surface);
  margin-top: var(--md-space-1);
}

.dropdown-item {
  padding: var(--md-space-3) var(--md-space-4);
  border-radius: var(--md-radius-sm);
  color: var(--md-on-surface);
  transition: all var(--md-transition-fast);
  display: flex;
  align-items: center;
}

.dropdown-item:hover {
  background-color: var(--md-gray-100);
  color: var(--md-primary);
}

.dropdown-divider {
  margin: var(--md-space-2) 0;
  border-color: var(--md-gray-200);
}

/* Avatar Component */
.avatar-sm {
  width: 32px;
  height: 32px;
  background-color: var(--md-primary);
  color: var(--md-on-primary);
  border-radius: var(--md-radius-round);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 500;
}

.avatar-lg {
  width: 64px;
  height: 64px;
  font-size: 1.5rem;
}

/* ============================================================
   BREADCRUMBS
============================================================ */
.breadcrumb {
  background-color: transparent;
  padding: var(--md-space-4) 0;
  margin: 0;
}

.breadcrumb-item {
  font-size: var(--md-font-size-body2);
}

.breadcrumb-item a {
  color: var(--md-gray-600);
  text-decoration: none;
  transition: color var(--md-transition-fast);
}

.breadcrumb-item a:hover {
  color: var(--md-primary);
}

.breadcrumb-item.active {
  color: var(--md-on-surface);
  font-weight: 500;
}

/* ============================================================
   CARDS
============================================================ */
.card {
  background-color: var(--md-surface);
  border: none;
  border-radius: var(--md-radius-lg);
  box-shadow: var(--md-shadow-1);
  transition: box-shadow var(--md-transition-standard);
}

.card-elevated {
  box-shadow: var(--md-shadow-2);
}

.card:hover {
  box-shadow: var(--md-shadow-3);
}

.card-header {
  background-color: transparent;
  border-bottom: 1px solid var(--md-gray-200);
  padding: var(--md-space-6);
  border-radius: var(--md-radius-lg) var(--md-radius-lg) 0 0;
}

[data-bs-theme="dark"] .card-header {
  border-bottom-color: var(--md-gray-300);
}

/* --- DARK MODE ENHANCEMENTS FOR ACCESSIBILITY --- */
[data-bs-theme="dark"] .form-label,
[data-bs-theme="dark"] label.form-label,
[data-bs-theme="dark"] .form-label.text-muted,
[data-bs-theme="dark"] label.form-label.text-muted {
  color: var(--md-label-contrast) !important;
}

[data-bs-theme="dark"] .text-muted,
[data-bs-theme="dark"] .text-caption.text-muted,
[data-bs-theme="dark"] .form-label.text-muted,
[data-bs-theme="dark"] .text-body-2.text-muted {
  color: var(--md-muted-contrast) !important;
}

[data-bs-theme="dark"] .card-body,
[data-bs-theme="dark"] .card.mb-4,
[data-bs-theme="dark"] .card-elevated,
[data-bs-theme="dark"] .card {
  background-color: var(--md-section-bg) !important;
  border: 1px solid var(--md-section-border) !important;
  box-shadow: 0 2px 8px 0 rgba(0,0,0,0.5);
  color: #fff !important; /* Ensure high-contrast text in cards */
}

/* Ensure all card content and utility containers have high-contrast text in dark mode */
[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .card-body,
[data-bs-theme="dark"] .mb-4,
[data-bs-theme="dark"] .col-md-6,
[data-bs-theme="dark"] .col-12 {
  color: #fff !important;
}

/* Override .bg-light and .bg-white for dark mode to prevent bright backgrounds */
[data-bs-theme="dark"] .bg-light,
[data-bs-theme="dark"] .bg-white {
  background-color: var(--md-section-bg) !important;
  color: #fff !important;
}


[data-bs-theme="dark"] .mb-4,
[data-bs-theme="dark"] .col-md-6,
[data-bs-theme="dark"] .col-12 {
  background-color: transparent;
  /* Let card-body handle the background */
}

/* Section headings inside cards */
[data-bs-theme="dark"] h5,
[data-bs-theme="dark"] h6,
[data-bs-theme="dark"] .text-title-2,
[data-bs-theme="dark"] .text-title-3 {
  color: #fff !important;
}

/* Add subtle separation for content blocks */
[data-bs-theme="dark"] .card-body > .mb-4:not(:last-child) {
  border-bottom: 1px solid var(--md-section-border);
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
}

/* Ensure all .badge and .bg-* have good contrast */
[data-bs-theme="dark"] .badge,
[data-bs-theme="dark"] .bg-primary,
[data-bs-theme="dark"] .bg-secondary,
[data-bs-theme="dark"] .bg-success,
[data-bs-theme="dark"] .bg-warning,
[data-bs-theme="dark"] .bg-danger,
[data-bs-theme="dark"] .bg-info {
  color: #fff !important;
}


.card-body {
  padding: var(--md-space-6);
}

.card-footer {
  background-color: var(--md-gray-50);
  border-top: 1px solid var(--md-gray-200);
  padding: var(--md-space-4) var(--md-space-6);
  border-radius: 0 0 var(--md-radius-lg) var(--md-radius-lg);
}

[data-bs-theme="dark"] .card-footer {
  background-color: var(--md-gray-100);
  border-top-color: var(--md-gray-300);
}

/* Status Cards */
.status-card {
  border-left: 4px solid var(--md-primary);
  transition: all var(--md-transition-standard);
}

.status-card:hover {
  transform: translateY(-2px);
}

.status-card.status-success {
  border-left-color: var(--md-success);
}

.status-card.status-warning {
  border-left-color: var(--md-warning);
}

.status-card.status-danger {
  border-left-color: var(--md-error);
}

/* ============================================================
   BUTTONS
============================================================ */
.btn {
  font-weight: 500;
  border-radius: var(--md-radius-md);
  padding: var(--md-space-3) var(--md-space-6);
  border: none;
  transition: all var(--md-transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--md-space-2);
  min-height: 40px;
  text-decoration: none;
  cursor: pointer;
}

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

.btn-primary {
  background-color: var(--md-primary);
  color: var(--md-on-primary);
}

.btn-primary:hover {
  background-color: var(--md-primary-variant);
  transform: translateY(-1px);
  box-shadow: var(--md-shadow-2);
}

.btn-secondary {
  background-color: var(--md-secondary);
  color: var(--md-on-secondary);
}

.btn-secondary:hover {
  background-color: var(--md-secondary-variant);
  transform: translateY(-1px);
  box-shadow: var(--md-shadow-2);
}

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

.btn-outline-primary:hover {
  background-color: var(--md-primary);
  color: var(--md-on-primary);
}

.btn-outline-secondary {
  background-color: transparent;
  color: var(--md-gray-600);
  border: 1px solid var(--md-gray-300);
}

.btn-outline-secondary:hover {
  background-color: var(--md-gray-100);
  border-color: var(--md-gray-400);
}

.btn-success {
  background-color: var(--md-success);
  color: white;
}

.btn-warning {
  background-color: var(--md-warning);
  color: white;
}

.btn-danger {
  background-color: var(--md-error);
  color: white;
}

.btn-sm {
  padding: var(--md-space-2) var(--md-space-4);
  font-size: var(--md-font-size-body2);
  min-height: 32px;
}

.btn-lg {
  padding: var(--md-space-4) var(--md-space-8);
  font-size: var(--md-font-size-subtitle1);
  min-height: 48px;
}

.btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ============================================================
   FORMS
============================================================ */
.form-label {
  font-weight: 500;
  color: var(--md-on-surface);
  margin-bottom: var(--md-space-2);
  font-size: var(--md-font-size-body2);
}

.form-control {
  border: 1px solid var(--md-gray-300);
  border-radius: var(--md-radius-sm);
  padding: var(--md-space-3) var(--md-space-4);
  font-size: var(--md-font-size-body1);
  background-color: var(--md-surface);
  color: var(--md-on-surface);
  transition: all var(--md-transition-fast);
}

.form-control:focus {
  border-color: var(--md-primary);
  box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.12);
  outline: none;
}

.form-control-lg {
  padding: var(--md-space-4) var(--md-space-5);
  font-size: var(--md-font-size-subtitle1);
  border-radius: var(--md-radius-md);
}

.form-control.is-valid {
  border-color: var(--md-success);
}

.form-control.is-invalid {
  border-color: var(--md-error);
}

.invalid-feedback {
  color: var(--md-error);
  font-size: var(--md-font-size-caption);
  margin-top: var(--md-space-1);
}

.valid-feedback {
  color: var(--md-success);
  font-size: var(--md-font-size-caption);
  margin-top: var(--md-space-1);
}

/* Select Dropdown */
.form-select {
  border: 1px solid var(--md-gray-300);
  border-radius: var(--md-radius-sm);
  padding: var(--md-space-3) var(--md-space-4);
  background-color: var(--md-surface);
  color: var(--md-on-surface);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m1 6 7 7 7-7'/%3e%3c/svg%3e");
}

.form-select:focus {
  border-color: var(--md-primary);
  box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.12);
  outline: none;
}

/* Search Input Enhancement */
.search-input {
  position: relative;
}

.search-input .form-control {
  padding-left: var(--md-space-10);
}

.search-input::before {
  content: '\f002';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  left: var(--md-space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--md-gray-500);
  z-index: 2;
}

/* ============================================================
   TABLES
============================================================ */
.table-responsive {
  border-radius: var(--md-radius-lg);
  box-shadow: var(--md-shadow-1);
  background-color: var(--md-surface);
}

.table {
  margin-bottom: 0;
  color: var(--md-on-surface);
}

.table thead th {
  background-color: var(--md-gray-50);
  color: var(--md-on-surface);
  font-weight: 500;
  font-size: var(--md-font-size-body2);
  border-bottom: 2px solid var(--md-gray-200);
  padding: var(--md-space-4) var(--md-space-5);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

[data-bs-theme="dark"] .table thead th {
  background-color: var(--md-gray-100);
  border-bottom-color: var(--md-gray-300);
}

.table tbody td {
  padding: var(--md-space-4) var(--md-space-5);
  border-bottom: 1px solid var(--md-gray-200);
  vertical-align: middle;
}

[data-bs-theme="dark"] .table tbody td {
  border-bottom-color: var(--md-gray-300);
}

.table tbody tr {
  transition: background-color var(--md-transition-fast);
}

.table tbody tr:hover {
  background-color: var(--md-gray-50);
}

[data-bs-theme="dark"] .table tbody tr:hover {
  background-color: var(--md-gray-100);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* Sortable Headers */
.sortable {
  cursor: pointer;
  user-select: none;
  transition: background-color var(--md-transition-fast);
}

.sortable:hover {
  background-color: var(--md-gray-100);
}

.sortable i {
  opacity: 0.5;
  transition: opacity var(--md-transition-fast);
}

.sortable:hover i,
.sortable.sort-asc i,
.sortable.sort-desc i {
  opacity: 1;
}

/* ============================================================
   BADGES & STATUS INDICATORS
============================================================ */
.badge {
  padding: var(--md-space-1) var(--md-space-3);
  border-radius: var(--md-radius-xl);
  font-size: var(--md-font-size-caption);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.bg-secondary {
  background-color: var(--md-secondary) !important;
}

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

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

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

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

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

.text-secondary {
  color: var(--md-secondary) !important;
}

.text-success {
  color: var(--md-success) !important;
}

.text-warning {
  color: var(--md-warning) !important;
}

.text-danger {
  color: var(--md-error) !important;
}

.text-info {
  color: var(--md-info) !important;
}

.text-muted {
  color: var(--md-gray-600) !important;
}

/* ============================================================
   ALERTS
============================================================ */
.alert {
  border: none;
  border-radius: var(--md-radius-md);
  padding: var(--md-space-4) var(--md-space-5);
  margin-bottom: var(--md-space-5);
  display: flex;
  align-items: center;
  gap: var(--md-space-3);
}

.alert-success {
  background-color: var(--md-success-light);
  color: var(--md-success);
  border-left: 4px solid var(--md-success);
}

.alert-danger {
  background-color: var(--md-error-light);
  color: var(--md-error);
  border-left: 4px solid var(--md-error);
}

.alert-warning {
  background-color: var(--md-warning-light);
  color: var(--md-warning);
  border-left: 4px solid var(--md-warning);
}

.alert-info {
  background-color: var(--md-info-light);
  color: var(--md-info);
  border-left: 4px solid var(--md-info);
}

.alert-dismissible .btn-close {
  padding: 0;
  background: none;
  border: none;
  opacity: 0.7;
  transition: opacity var(--md-transition-fast);
}

.alert-dismissible .btn-close:hover {
  opacity: 1;
}

/* ============================================================
   MODALS
============================================================ */
.modal-content {
  border: none;
  border-radius: var(--md-radius-lg);
  box-shadow: var(--md-shadow-5);
  background-color: var(--md-surface);
}

.modal-header {
  border-bottom: 1px solid var(--md-gray-200);
  padding: var(--md-space-6);
}

[data-bs-theme="dark"] .modal-header {
  border-bottom-color: var(--md-gray-300);
}

.modal-title {
  font-weight: 500;
  color: var(--md-on-surface);
}

.modal-body {
  padding: var(--md-space-6);
}

.modal-footer {
  border-top: 1px solid var(--md-gray-200);
  padding: var(--md-space-4) var(--md-space-6);
  gap: var(--md-space-3);
}

[data-bs-theme="dark"] .modal-footer {
  border-top-color: var(--md-gray-300);
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  opacity: 0.7;
  transition: opacity var(--md-transition-fast);
}

.btn-close:hover {
  opacity: 1;
}

/* ============================================================
   PROGRESS BARS
============================================================ */
.progress {
  height: 8px;
  background-color: var(--md-gray-200);
  border-radius: var(--md-radius-sm);
  overflow: hidden;
}

.progress-sm {
  height: 4px;
}

.progress-bar {
  background-color: var(--md-primary);
  transition: width var(--md-transition-standard);
}

.bg-success .progress-bar {
  background-color: var(--md-success);
}

.bg-warning .progress-bar {
  background-color: var(--md-warning);
}

.bg-danger .progress-bar {
  background-color: var(--md-error);
}

/* ============================================================
   LOADING STATES
============================================================ */
.spinner-apple {
  width: 16px;
  height: 16px;
  border: 2px solid var(--md-gray-300);
  border-top: 2px solid var(--md-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: inline-block;
}

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

/* ============================================================
   FILE UPLOAD
============================================================ */
.file-upload-area {
  border: 2px dashed var(--md-gray-300);
  border-radius: var(--md-radius-lg);
  padding: var(--md-space-8);
  text-align: center;
  background-color: var(--md-gray-50);
  transition: all var(--md-transition-fast);
  cursor: pointer;
}

.file-upload-area:hover,
.file-upload-area.dragover {
  border-color: var(--md-primary);
  background-color: var(--md-primary-light);
}

.file-upload-area input[type="file"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.upload-text {
  color: var(--md-gray-600);
  font-size: var(--md-font-size-body1);
  margin-top: var(--md-space-3);
}

/* ============================================================
   LOGIN PAGE SPECIFIC
============================================================ */
body.login-page {
  background: linear-gradient(135deg, var(--md-primary) 0%, var(--md-secondary) 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  max-width: 400px;
  width: 100%;
  margin: var(--md-space-6);
}

.login-header {
  text-align: center;
  margin-bottom: var(--md-space-8);
}

.login-logo {
  width: 80px;
  height: 80px;
  background: var(--md-primary-light);
  border-radius: var(--md-radius-round);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--md-space-5);
}

/* ============================================================
   FOOTER
============================================================ */
footer {
  background-color: var(--md-surface);
  border-top: 1px solid var(--md-gray-200);
  padding: var(--md-space-4) 0;
  margin-top: auto;
}

[data-bs-theme="dark"] footer {
  border-top-color: var(--md-gray-300);
}

.footer-content {
  color: var(--md-gray-600);
  font-size: var(--md-font-size-body2);
}

/* Fix for startup index view footer positioning */
.startups-index-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.startups-index-page main {
  flex: 1;
}

.startups-index-page footer {
  position: sticky;
  bottom: 0;
  margin-top: auto;
}

/* ============================================================
   RESPONSIVE DESIGN
============================================================ */
@media (max-width: 768px) {
  .main-content {
    padding: var(--md-space-4);
  }
  
  .card-body {
    padding: var(--md-space-4);
  }
  
  .card-header {
    padding: var(--md-space-4);
  }
  
  .table thead th,
  .table tbody td {
    padding: var(--md-space-3);
  }
  
  .text-title-1 {
    font-size: var(--md-font-size-h5);
  }
  
  .text-title-2 {
    font-size: var(--md-font-size-h6);
  }
  
  .btn {
    padding: var(--md-space-3) var(--md-space-4);
  }
}

@media (max-width: 576px) {
  .main-content {
    padding: var(--md-space-3);
  }
  
  .navbar {
    padding: var(--md-space-3) 0;
  }
  
  .card-body {
    padding: var(--md-space-3);
  }
  
  .modal-body {
    padding: var(--md-space-4);
  }
  
  .table-responsive {
    font-size: var(--md-font-size-body2);
  }
}

/* ============================================================
   UTILITIES
============================================================ */
.gap-1 { gap: var(--md-space-1) !important; }
.gap-2 { gap: var(--md-space-2) !important; }
.gap-3 { gap: var(--md-space-3) !important; }
.gap-4 { gap: var(--md-space-4) !important; }
.gap-5 { gap: var(--md-space-5) !important; }
.gap-6 { gap: var(--md-space-6) !important; }

.mb-5 { margin-bottom: var(--md-space-5) !important; }
.mb-6 { margin-bottom: var(--md-space-6) !important; }
.mt-5 { margin-top: var(--md-space-5) !important; }
.mt-6 { margin-top: var(--md-space-6) !important; }

.p-5 { padding: var(--md-space-5) !important; }
.p-6 { padding: var(--md-space-6) !important; }

.rounded-lg { border-radius: var(--md-radius-lg) !important; }
.rounded-xl { border-radius: var(--md-radius-xl) !important; }

.shadow-sm { box-shadow: var(--md-shadow-1) !important; }
.shadow { box-shadow: var(--md-shadow-2) !important; }
.shadow-lg { box-shadow: var(--md-shadow-3) !important; }

/* ============================================================
   FOCUS MANAGEMENT
============================================================ */
.keyboard-navigation *:focus {
  outline: 2px solid var(--md-primary);
  outline-offset: 2px;
}

/* Skip to main content link for accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--md-primary);
  color: var(--md-on-primary);
  padding: 8px;
  text-decoration: none;
  z-index: 9999;
  border-radius: var(--md-radius-sm);
}

.skip-link:focus {
  top: 6px;
}

/* ============================================================
   PRINT STYLES
============================================================ */
@media print {
  body {
    background: white !important;
    color: black !important;
  }
  
  .navbar,
  .btn,
  .footer,
  .breadcrumb {
    display: none !important;
  }
  
  .card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }
  
  .table {
    font-size: 12px !important;
  }
}

/* ============================================================
   ANIMATIONS & TRANSITIONS
============================================================ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.3s ease-out;
}

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

.slide-down {
  animation: slideDown 0.2s ease-out;
}

/* ============================================================
   MATERIAL DESIGN TIMELINE
============================================================ */
.timeline-md {
  position: relative;
  padding: 24px 0;
}

.timeline-md::before {
  content: '';
  position: absolute;
  left: 24px;
  top: 32px;
  bottom: 32px;
  width: 2px;
  background: var(--md-gray-300);
  border-radius: 1px;
}

.timeline-item-md {
  position: relative;
  display: flex;
  align-items: flex-start;
  margin-bottom: 32px;
  padding-left: 64px;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.timeline-item-md.completed {
  opacity: 1;
}

.timeline-item-md.active {
  opacity: 1;
}

.timeline-item-md.active .timeline-icon-md {
  transform: scale(1.1);
  box-shadow: var(--md-shadow-3);
}

.timeline-icon-md {
  position: absolute;
  left: 0;
  top: 4px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
  transition: all 0.2s ease;
  z-index: 2;
}

.timeline-icon-md i {
  font-size: 20px;
}

.timeline-content-md {
  flex: 1;
  padding: 8px 0;
}

.timeline-title-md {
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
  color: var(--md-on-surface);
  margin-bottom: 4px;
}

.timeline-subtitle-md {
  font-size: 14px;
  line-height: 20px;
  color: var(--md-gray-600);
}

.timeline-subtitle-md .badge {
  font-size: 12px;
  padding: 4px 8px;
}

/* Dark theme timeline */
[data-bs-theme="dark"] .timeline-md::before {
  background: var(--md-gray-600);
}

[data-bs-theme="dark"] .timeline-title-md {
  color: var(--md-gray-100);
}

[data-bs-theme="dark"] .timeline-subtitle-md {
  color: var(--md-gray-400);
}

/* --- DARK MODE ENHANCEMENTS FOR TIMELINE ACCESSIBILITY --- */
[data-bs-theme="dark"] .timeline-md,
[data-bs-theme="dark"] .timeline-item-md,
[data-bs-theme="dark"] .timeline-content-md {
  background-color: var(--md-section-bg) !important;
  color: #fff !important;
}

[data-bs-theme="dark"] .timeline-icon-md {
  background: var(--md-gray-700) !important;
  color: #fff !important;
  box-shadow: 0 2px 8px 0 rgba(0,0,0,0.5);
}

[data-bs-theme="dark"] .timeline-title-md,
[data-bs-theme="dark"] .timeline-content-md {
  color: #fff !important;
}

/* Smooth scroll behavior */
html {
  scroll-behavior: smooth;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .timeline-icon-md {
    transition: none;
  }
  
  .timeline-item-md {
    transition: none;
  }
}

/* ============================================================
   BUSINESS DETAILS ENHANCEMENTS
============================================================ */

/* Line height for better readability */
.line-height-relaxed {
  line-height: 1.6 !important;
}

/* Accordion custom styling */
.accordion-button:not(.collapsed) {
  background-color: var(--md-primary-light) !important;
  color: var(--md-primary) !important;
  box-shadow: none !important;
}

.accordion-button:focus {
  box-shadow: none !important;
  border-color: transparent !important;
}

.accordion-button::after {
  filter: none !important;
}

.accordion-button:not(.collapsed)::after {
  filter: brightness(0) saturate(100%) invert(22%) sepia(77%) saturate(1686%) hue-rotate(201deg) brightness(92%) contrast(91%);
}

/* Business section item styling */
.business-detail-item {
  transition: all 0.2s ease;
  border-radius: 8px;
  border: 1px solid transparent;
}

.business-detail-item:hover {
  border-color: var(--md-gray-300);
  box-shadow: var(--md-shadow-1);
  transform: translateY(-1px);
}

/* Enhanced card styling for business section */
.card-elevated {
  box-shadow: var(--md-shadow-2) !important;
  border: 1px solid var(--md-gray-200);
}

.card-elevated:hover {
  box-shadow: var(--md-shadow-3) !important;
  transform: translateY(-1px);
  transition: all 0.2s ease;
}

/* Improved text contrast for readability */
.text-muted {
  color: var(--md-gray-600) !important;
}

/* Better spacing for business content */
.business-content {
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.business-content:last-child {
  margin-bottom: 0;
}

/* ============================================================
   REVENUE MODEL ENHANCEMENTS - PROFESSIONAL COLOR SCHEME
============================================================ */

/* Revenue stream container */
.revenue-streams-container {
  margin: 0;
}

/* Individual revenue stream items */
.revenue-stream-item {
  position: relative;
}

/* Hover effects for revenue items */
.hover-shadow-sm {
  transition: all 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.hover-shadow-sm:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15), 0 2px 6px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

/* Transition utilities */
.transition-all {
  transition: all 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* Professional Color Overrides for Revenue Model */

/* Light Mode Color Scheme */
.revenue-stream-item .bg-gradient.bg-warning.bg-opacity-10 {
  background: linear-gradient(135deg, #f8f9fa 0%, #e3f2fd 100%) !important;
  border: 1px solid #e1f5fe !important;
}

.revenue-stream-item .bg-gradient.bg-warning.bg-opacity-15 {
  background: linear-gradient(135deg, #e8f5e8 0%, #f1f8e9 100%) !important;
  border: 1px solid #c8e6c9 !important;
}

.revenue-stream-item .bg-gradient.bg-warning.bg-opacity-8 {
  background: linear-gradient(135deg, #fff3e0 0%, #fffde7 100%) !important;
  border: 1px solid #ffecb3 !important;
}

.revenue-stream-item .bg-gradient.bg-warning.bg-opacity-12 {
  background: linear-gradient(135deg, #ffffff 0%, #f1f1f1 100%) !important;
  border: 1px solid #ffffff !important;
}

/* Dark Mode Color Scheme */
[data-bs-theme="dark"] .revenue-stream-item .bg-gradient.bg-warning.bg-opacity-10 {
  background: linear-gradient(135deg, #263238 0%, #37474f 100%) !important;
  border: 1px solid #455a64 !important;
}

[data-bs-theme="dark"] .revenue-stream-item .bg-gradient.bg-warning.bg-opacity-15 {
  background: linear-gradient(135deg, #1b5e20 0%, #2e7d32 100%) !important;
  border: 1px solid #388e3c !important;
}

[data-bs-theme="dark"] .revenue-stream-item .bg-gradient.bg-warning.bg-opacity-8 {
  background: linear-gradient(135deg, #3e2723 0%, #5d4037 100%) !important;
  border: 1px solid #6d4c41 !important;
}

[data-bs-theme="dark"] .revenue-stream-item .bg-gradient.bg-warning.bg-opacity-12 {
  background: linear-gradient(135deg, #1e1924 0%, #1f1923 100%) !important;
  border: 1px solid #1a181a !important;
}

/* Revenue number badge styling with varied colors */
.revenue-stream-item:nth-child(1) .revenue-number .badge {
  background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%) !important;
  color: white !important;
  border: none !important;
}

.revenue-stream-item:nth-child(2) .revenue-number .badge {
  background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%) !important;
  color: white !important;
  border: none !important;
}

.revenue-stream-item:nth-child(3) .revenue-number .badge {
  background: linear-gradient(135deg, #ff9800 0%, #f57400 100%) !important;
  color: white !important;
  border: none !important;
}

.revenue-stream-item:nth-child(4) .revenue-number .badge {
  background: linear-gradient(135deg, #e91e63 0%, #c2185b 100%) !important;
  color: white !important;
  border: none !important;
}

.revenue-stream-item:nth-child(5) .revenue-number .badge {
  background: linear-gradient(135deg, #9c27b0 0%, #7b1fa2 100%) !important;
  color: white !important;
  border: none !important;
}

/* Override Bootstrap's bg-warning class specifically */
.revenue-stream-item:nth-child(1) .badge.bg-warning {
  background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%) !important;
  color: white !important;
}

.revenue-stream-item:nth-child(2) .badge.bg-warning {
  background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%) !important;
  color: white !important;
}

.revenue-stream-item:nth-child(3) .badge.bg-warning {
  background: linear-gradient(135deg, #ff9800 0%, #f57400 100%) !important;
  color: white !important;
}

.revenue-stream-item:nth-child(4) .badge.bg-warning {
  background: linear-gradient(135deg, #e91e63 0%, #c2185b 100%) !important;
  color: white !important;
}

.revenue-stream-item:nth-child(5) .badge.bg-warning {
  background: linear-gradient(135deg, #9c27b0 0%, #7b1fa2 100%) !important;
  color: white !important;
}

.revenue-number .badge {
  font-size: 0.875rem;
  font-weight: 600;
  min-width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.12);
}

/* Enhanced typography for revenue content */
.revenue-stream-item .text-title-3 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.revenue-stream-item .text-body-1 {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--bs-dark-emphasis) !important;
}

.revenue-stream-item .text-body-2 {
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--bs-secondary-color) !important;
}

/* Professional icon colors for different revenue streams */
.revenue-stream-item:nth-child(1) .material-icons {
  color: #2196f3 !important; /* Blue */
}

.revenue-stream-item:nth-child(2) .material-icons {
  color: #4caf50 !important; /* Green */
}

.revenue-stream-item:nth-child(3) .material-icons {
  color: #ff9800 !important; /* Orange (more subtle) */
}

.revenue-stream-item:nth-child(4) .material-icons {
  color: #e91e63 !important; /* Pink */
}

.revenue-stream-item:nth-child(5) .material-icons {
  color: #9c27b0 !important; /* Purple */
}

/* Improved spacing and alignment */
.revenue-stream-item .material-icons {
  margin-top: 2px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}

/* Professional text color overrides */
.revenue-stream-item .text-dark-emphasis {
  color: var(--bs-dark-emphasis) !important;
}

[data-bs-theme="dark"] .revenue-stream-item .text-dark-emphasis {
  color: var(--bs-light-emphasis) !important;
}

/* Enhanced category title colors */
.revenue-stream-item .text-warning-emphasis {
  color: #1976d2 !important; /* Professional blue instead of orange */
}

[data-bs-theme="dark"] .revenue-stream-item .text-warning-emphasis {
  color: #64b5f6 !important; /* Lighter blue for dark mode */
}

/* Responsive adjustments for revenue model */
@media (max-width: 768px) {
  .revenue-stream-item {
    margin-bottom: 1rem;
  }
  
  .revenue-stream-item .p-4 {
    padding: 1rem !important;
  }
  
  .revenue-number .badge {
    min-width: 2rem;
    height: 2rem;
    font-size: 0.75rem;
  }
}

/* Enhanced line-height for revenue content */
.revenue-stream-item .line-height-relaxed {
  line-height: 1.7 !important;
}

/* Focus states for accessibility */
.revenue-stream-item:focus-within {
  outline: 2px solid var(--bs-primary);
  outline-offset: 2px;
}

/* Remove the harsh warning borders entirely */
.revenue-stream-item .border-warning {
  border-color: transparent !important;
}

/* ============================================================
   STAGE BADGES - Evaluation Page
============================================================ */

/* Base stage badge styling */
.stage-badge {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 0.5rem 0.75rem;
  border-radius: 1rem;
  text-transform: capitalize;
  white-space: nowrap;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 80px;
}

/* Individual stage styling with proper contrast */
.stage-imported {
  background-color: var(--md-gray-100);
  color: var(--md-gray-800);
  border-color: var(--md-gray-300);
}

.stage-eligible {
  background-color: var(--md-success-light);
  color: var(--md-success);
  border-color: var(--md-success);
}

.stage-ineligible {
  background-color: var(--md-error-light);
  color: var(--md-error);
  border-color: var(--md-error);
}

.stage-reviewer_assigned,
.stage-reviewer-assigned {
  background-color: var(--md-warning-light);
  color: #e65100; /* Darker orange for better contrast */
  border-color: var(--md-warning);
}

.stage-reviewer_approved,
.stage-reviewer-approved {
  background-color: var(--md-success-light);
  color: var(--md-success);
  border-color: var(--md-success);
}

.stage-reviewer_rejected,
.stage-reviewer-rejected {
  background-color: var(--md-error-light);
  color: var(--md-error);
  border-color: var(--md-error);
}

.stage-committee_assigned,
.stage-committee-assigned {
  background-color: var(--md-info-light);
  color: var(--md-info);
  border-color: var(--md-info);
}

.stage-approved {
  background-color: var(--md-success-light);
  color: var(--md-success);
  border-color: var(--md-success);
}

.stage-rejected {
  background-color: var(--md-error-light);
  color: var(--md-error);
  border-color: var(--md-error);
}

/* Dark theme adjustments */
[data-bs-theme="dark"] .stage-imported {
  background-color: var(--md-gray-800);
  color: var(--md-gray-200);
  border-color: var(--md-gray-600);
}

[data-bs-theme="dark"] .stage-eligible {
  background-color: rgba(76, 175, 80, 0.2);
  color: #81c784;
  border-color: #4caf50;
}

[data-bs-theme="dark"] .stage-ineligible {
  background-color: rgba(244, 67, 54, 0.2);
  color: #e57373;
  border-color: #f44336;
}

[data-bs-theme="dark"] .stage-reviewer_assigned,
[data-bs-theme="dark"] .stage-reviewer-assigned {
  background-color: rgba(255, 152, 0, 0.2);
  color: #ffb74d;
  border-color: #ff9800;
}

[data-bs-theme="dark"] .stage-reviewer_approved,
[data-bs-theme="dark"] .stage-reviewer-approved {
  background-color: rgba(76, 175, 80, 0.2);
  color: #81c784;
  border-color: #4caf50;
}

[data-bs-theme="dark"] .stage-reviewer_rejected,
[data-bs-theme="dark"] .stage-reviewer-rejected {
  background-color: rgba(244, 67, 54, 0.2);
  color: #e57373;
  border-color: #f44336;
}

[data-bs-theme="dark"] .stage-committee_assigned,
[data-bs-theme="dark"] .stage-committee-assigned {
  background-color: rgba(33, 150, 243, 0.2);
  color: #64b5f6;
  border-color: #2196f3;
}

[data-bs-theme="dark"] .stage-approved {
  background-color: rgba(76, 175, 80, 0.2);
  color: #81c784;
  border-color: #4caf50;
}

[data-bs-theme="dark"] .stage-rejected {
  background-color: rgba(244, 67, 54, 0.2);
  color: #e57373;
  border-color: #f44336;
}

/* Hover effects for stage badges */
.stage-badge:hover {
  transform: translateY(-1px);
  box-shadow: var(--md-shadow-2);
  transition: all 0.2s ease;
}

/* Accessibility improvements */
.stage-badge:focus {
  outline: 2px solid var(--md-primary);
  outline-offset: 2px;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .stage-badge {
    font-size: 0.7rem;
    padding: 0.375rem 0.625rem;
    min-width: 70px;
  }
}