/*
 * Global Fluent-inspired design tokens & layout helpers
 * ----------------------------------------------------
 * These styles complement Bootstrap 5 with a light, Fluent UI look:
 * softer shadows, rounded corners, and subtle interactions.
 * 
 * Phoenix Theme Integration:
 * Inspired by Bootstrap Phoenix theme for modern enterprise UI
 * Reference: https://prium.github.io/phoenix/
 */

:root {
  /* Phoenix-inspired color palette */
  --accent-fill-rest: #2c7be5; /* Phoenix primary blue */
  --accent-fill-hover: #1a68cc;
  --accent-fill-active: #1557b3;
  --accent-fill-light: rgba(44, 123, 229, 0.1);
  
  /* Phoenix semantic colors */
  --phoenix-success: #00c7d6;
  --phoenix-warning: #ffb822;
  --phoenix-danger: #ff5a63;
  --phoenix-info: #2c7be5;
  
  /* Phoenix background colors */
  --phoenix-bg-light: #f9fafd;
  --phoenix-bg-card: #ffffff;
  --phoenix-bg-dark: #0b1727;
  
  /* Legacy compatibility */
  --neutral-layer-1: #f9fafd;
  --neutral-layer-2: #ffffff;
  --neutral-layer-3: #f5f6fa;
  --neutral-stroke: rgba(0, 0, 0, 0.06);
  
  /* Phoenix shadows */
  --shadow-soft: 0 0 40px rgba(0, 0, 0, 0.06);
  --shadow-medium: 0 0 60px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.1);
  --shadow-phoenix: 0 0 40px rgba(0, 0, 0, 0.06);
  
  /* Transitions */
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
}

body {
  font-family: 'Open Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--phoenix-bg-light);
  color: #0b1727;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app-shell {
  background: transparent;
}

.app-main {
  /* Leave room for navbar & footer while keeping pages tall */
  min-height: 60vh;
}

.app-footer {
  font-size: 0.85rem;
  color: #6c757d;
}

/* Generic layout helpers */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.page-header-title {
  margin: 0;
}

.page-header-subtitle {
  margin: 0;
  font-size: 0.95rem;
  color: #6c757d;
}

/* Cards */
.card {
  border-radius: 0.75rem;
  border: none;
  box-shadow: var(--shadow-phoenix);
  transition: var(--transition-smooth);
  background: var(--phoenix-bg-card);
}

.card-fluent {
  border-radius: 0.75rem;
  border: none;
  box-shadow: var(--shadow-phoenix);
  background: var(--phoenix-bg-card);
  transition: var(--transition-smooth);
}

.card-fluent:hover {
  box-shadow: var(--shadow-medium);
  transform: translateY(-2px);
}

.card-stat {
  border-radius: 0.75rem;
  box-shadow: var(--shadow-phoenix);
  border: none;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
  background: var(--phoenix-bg-card);
}

.card-stat::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, var(--accent-fill-rest) 0%, var(--accent-fill-hover) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.card-stat:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-4px);
}

.card-stat:hover::before {
  opacity: 1;
}

.card-stat .display-6 {
  font-weight: 600;
  transition: transform 0.3s ease;
}

.card-stat:hover .display-6 {
  transform: scale(1.05);
}

.card-stat .text-muted {
  font-size: 0.9rem;
}

/* Tables */
.table thead th {
  white-space: nowrap;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.table td,
.table th {
  vertical-align: middle;
  word-break: break-word; /* prevent long tokens from overflowing */
}

.table-hover tbody tr:hover {
  background-color: rgba(15, 108, 189, 0.03);
}

.badge {
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 999px;
}

/* Ensure long text in cards and detail views wraps inside the container */
.card-body p {
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

/* Attachment icons */
.attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.attachment-main {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0; /* allow filename to wrap */
}

.attachment-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: #ffffff;
  flex-shrink: 0;
}

.attachment-icon-pdf { background: #d32f2f; }
.attachment-icon-doc { background: #1565c0; }
.attachment-icon-xls { background: #2e7d32; }
.attachment-icon-ppt { background: #e86c27; }
.attachment-icon-img { background: #6a1b9a; }
.attachment-icon-oth { background: #607d8b; }

.attachment-filename {
  word-break: break-word;
}

/* Form spacing & Fluent-inspired controls */
form .mb-3 label,
form .form-label {
  font-weight: 500;
  color: #495057;
  margin-bottom: 0.5rem;
}

.form-floating > .form-control,
.form-floating > .form-select {
  border-radius: 0.75rem;
}

.form-control,
.form-select {
  border-radius: 0.5rem;
  border-color: rgba(0, 0, 0, 0.12);
  transition: var(--transition-smooth);
  padding: 0.625rem 0.75rem;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--accent-fill-rest);
  box-shadow: 0 0 0 3px rgba(15, 108, 189, 0.15);
  background-color: #fff;
}

.form-control::placeholder {
  color: #adb5bd;
}

/* Auth helpers (used by login/register pages) */
.auth-card {
  max-width: 480px;
  margin: 40px auto;
}

.auth-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  font-weight: 600;
}

/* Watermark for approval status */
.approval-watermark {
  position: relative;
  overflow: hidden;
}

.approval-watermark::before {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-45deg);
  font-size: 5rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  color: rgba(15, 108, 189, 0.06);
  text-transform: uppercase;
  pointer-events: none;
  z-index: 0;
}

.approval-watermark-approved::before {
  content: "APPROVED";
  color: rgba(46, 125, 50, 0.08);
}

.approval-watermark-pending::before {
  content: "APPROVING";
  color: rgba(245, 158, 11, 0.08);
}

.approval-watermark > * {
  position: relative;
  z-index: 1;
}

/* ----------------------------------------------
 * Responsive filter grid (Modern Glassmorphism)
 * ---------------------------------------------- */
.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  align-items: end;
  background: rgba(255, 255, 255, 0.7);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  padding: 1.5rem;
  border-radius: 1rem;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 8px 32px rgba(15, 108, 189, 0.08);
}

/* Desktop: 4 columns max per row */
@media (min-width: 1200px) { /* xl and up */
  .filters-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Large tablets: 3 columns */
@media (min-width: 992px) and (max-width: 1199.98px) {
  .filters-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Tablets: 2 columns */
@media (min-width: 768px) and (max-width: 991.98px) {
  .filters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Mobile: 1 column */
@media (max-width: 767.98px) {
  .filters-grid {
    grid-template-columns: 1fr;
  }
}

.filters-grid .form-select,
.filters-grid .form-control {
  width: 100%;
  min-width: 0;
}

.filters-grid label.form-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: #495057;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.5rem;
}

.filters-grid .form-actions {
  display: flex;
  flex-direction: column;
  grid-column: span 1;
}

@media (min-width: 1200px) {
  .filters-grid .form-actions {
    grid-column: span 1;
  }
}

.filters-grid .form-actions .form-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: #495057;
  margin-bottom: 0.5rem;
}

.filters-grid .form-actions .btn-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filters-grid .form-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Button aesthetics (Fluent accent) */
.btn {
  border-radius: 0.6rem;
  transition: var(--transition-smooth);
  font-weight: 500;
  letter-spacing: 0.01em;
}

.btn-primary {
  background-color: var(--accent-fill-rest);
  border-color: var(--accent-fill-rest);
  box-shadow: 0 2px 8px rgba(15, 108, 189, 0.2);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--accent-fill-hover);
  border-color: var(--accent-fill-hover);
  box-shadow: 0 4px 12px rgba(15, 108, 189, 0.3);
  transform: translateY(-1px);
  color: #ffffff;
}

.btn-primary:active {
  background-color: var(--accent-fill-active);
  border-color: var(--accent-fill-active);
  transform: translateY(0);
  color: #ffffff;
}

.btn-outline-primary {
  border-color: var(--accent-fill-rest);
  color: var(--accent-fill-rest);
  background: transparent;
}

.btn-outline-primary:hover {
  background-color: var(--accent-fill-rest);
  border-color: var(--accent-fill-rest);
  box-shadow: 0 4px 12px rgba(15, 108, 189, 0.25);
  transform: translateY(-1px);
  color: #ffffff;
}

.btn-outline-info {
  border-color: #0891b2;
  color: #0891b2;
  background: transparent;
}

.btn-outline-info:hover {
  background-color: #0891b2;
  border-color: #0891b2;
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-outline-success {
  border-color: #16a34a;
  color: #16a34a;
  background: transparent;
}

.btn-outline-success:hover {
  background-color: #16a34a;
  border-color: #16a34a;
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-outline-danger {
  border-color: #dc2626;
  color: #dc2626;
  background: transparent;
}

.btn-outline-danger:hover {
  background-color: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-outline-warning {
  border-color: #d97706;
  color: #d97706;
  background: transparent;
}

.btn-outline-warning:hover {
  background-color: #d97706;
  border-color: #d97706;
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  border: none;
  color: #ffffff;
}

.btn-success:hover {
  background: linear-gradient(135deg, #15803d 0%, #166534 100%);
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  border: none;
  color: #ffffff;
}

.btn-danger:hover {
  background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
}

/* Card spacing refinement */
.card .card-body { padding: 1.25rem; }
@media (min-width: 992px) { .card .card-body { padding: 1.5rem; } }

/* Hover lift effect for cards */
.hover-lift {
  transition: var(--transition-smooth);
}

.hover-lift:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
}

/* Enhanced table styling */
.table {
  border-collapse: separate;
  border-spacing: 0;
}

.table thead th {
  border-bottom: 2px solid var(--neutral-stroke);
  font-weight: 600;
  color: #495057;
}

/* Tab content styling */
.tab-content-dark {
  background: #ffffff;
  border: 1px solid #dee2e6;
  border-top: none;
  border-radius: 0 0 0.5rem 0.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* Nav tabs styling - improved visibility */
.nav-tabs {
  border: 1px solid #dee2e6;
  border-bottom: none;
  background: #f8f9fa;
  border-radius: 0.5rem 0.5rem 0 0;
  padding: 0.5rem 0.75rem 0;
  margin-bottom: 0;
}

.nav-tabs .nav-link {
  border: 1px solid transparent;
  border-radius: 0.375rem 0.375rem 0 0;
  padding: 0.5rem 1rem;
  color: #5e6e82;
  font-weight: 500;
  transition: all 0.2s ease;
  margin-bottom: -1px;
}

.nav-tabs .nav-link:hover {
  color: #2c7be5;
  background: rgba(44, 123, 229, 0.05);
  border-color: #dee2e6;
}

.nav-tabs .nav-link.active {
  color: #2c7be5;
  background: #ffffff;
  border-color: #dee2e6;
  border-bottom-color: #ffffff;
  font-weight: 600;
}

/* Request description - word wrap for long content */
.request-description {
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  max-width: 100%;
  line-height: 1.6;
}

.table tbody tr {
  transition: background-color 0.2s ease;
}

.table tbody tr:hover {
  background-color: rgba(15, 108, 189, 0.05);
}

/* Improved badge styling */
.badge {
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0.375em 0.75em;
}

/* Enhanced page header */
.page-header {
  margin-bottom: 2rem;
}

.page-header-title {
  font-weight: 600;
  color: #212529;
  letter-spacing: -0.02em;
}

.page-header-subtitle {
  color: #6c757d;
  font-weight: 400;
}

/* Improved alert styling */
.alert {
  border: none;
  border-radius: 0.75rem;
  box-shadow: var(--shadow-soft);
}

/* Enhanced modal styling */
.modal-content {
  border: none;
  border-radius: 1rem;
  box-shadow: var(--shadow-medium);
}

.modal-header {
  border-bottom: 1px solid var(--neutral-stroke);
  padding: 1.25rem 1.5rem;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  border-top: 1px solid var(--neutral-stroke);
  padding: 1rem 1.5rem;
}

/* Improved tab styling */
.nav-tabs {
  border-bottom: 2px solid var(--neutral-stroke);
}

.nav-tabs .nav-link {
  border: none;
  border-bottom: 2px solid transparent;
  color: #6c757d;
  font-weight: 500;
  padding: 0.75rem 1.25rem;
  transition: all 0.2s ease;
  margin-bottom: -2px;
}

.nav-tabs .nav-link:hover {
  color: var(--accent-fill-rest);
  border-color: transparent;
}

.nav-tabs .nav-link.active {
  color: var(--accent-fill-rest);
  background-color: transparent;
  border-bottom-color: var(--accent-fill-rest);
}

/* Enhanced list group styling */
.list-group-item {
  border: 1px solid var(--neutral-stroke);
  transition: all 0.2s ease;
}

.list-group-item:hover {
  background-color: rgba(15, 108, 189, 0.03);
}

/* Improved dropdown styling */
.dropdown-menu {
  border: none;
  border-radius: 0.75rem;
  box-shadow: var(--shadow-medium);
  padding: 0.5rem;
}

.dropdown-item {
  border-radius: 0.5rem;
  padding: 0.625rem 1rem;
  transition: all 0.2s ease;
  font-weight: 400;
}

.dropdown-item:hover {
  background-color: rgba(15, 108, 189, 0.08);
  transform: translateX(2px);
}

/* Enhanced footer */
.app-footer {
  background: var(--neutral-layer-3);
  border-top: 1px solid var(--neutral-stroke);
  padding: 1.25rem 0;
  margin-top: auto;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Improved focus states for accessibility */
*:focus-visible {
  outline: 2px solid var(--accent-fill-rest);
  outline-offset: 2px;
}

/* Accessibility: Skip to content link (visible on focus) */
.skip-link {
  position: absolute;
  left: -999px;
  top: -999px;
  z-index: 10000;
  background: #ffffff;
  color: #0b1727;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* Enhanced attachment icons */
.attachment-icon {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.attachment-item {
  transition: all 0.2s ease;
}

.attachment-item:hover {
  background-color: rgba(15, 108, 189, 0.03);
  transform: translateX(2px);
}

/* Improved filter grid */
.filters-grid {
  background: rgba(255, 255, 255, 0.7);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  padding: 1.5rem;
  border-radius: 1rem;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 8px 32px rgba(15, 108, 189, 0.08);
}

/* ----------------------------------------------
 * Settings Page - Equal Height Tiles
 * ---------------------------------------------- */
.settings-grid .card-fluent {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.settings-grid .card-fluent .card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.settings-grid .card-fluent .card-body p {
  flex: 1;
}

.settings-grid .card-fluent .btn {
  align-self: flex-start;
  margin-top: auto;
}

/* ----------------------------------------------
 * Dashboard Tiles - Modern Glassmorphism
 * ---------------------------------------------- */
.dashboard-tiles .card-stat {
  background: rgba(255, 255, 255, 0.75);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 8px 32px rgba(15, 108, 189, 0.1);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.dashboard-tiles .card-stat:hover {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 16px 48px rgba(15, 108, 189, 0.15);
  transform: translateY(-6px) scale(1.02);
}

.dashboard-tiles .card-stat::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-fill-rest), #00d4ff, var(--accent-fill-rest));
  background-size: 200% 100%;
  animation: gradient-shift 3s ease infinite;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.dashboard-tiles .card-stat:hover::before {
  opacity: 1;
}

@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ----------------------------------------------
 * Modern Card Enhancements
 * ---------------------------------------------- */
.card-fluent {
  background: rgba(255, 255, 255, 0.8);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 8px 32px rgba(15, 108, 189, 0.08);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-fluent:hover {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 16px 48px rgba(15, 108, 189, 0.12);
  transform: translateY(-4px);
}

/* ----------------------------------------------
 * Section Cards (Page Headers)
 * ---------------------------------------------- */
.section-card {
  background: rgba(255, 255, 255, 0.7);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 1rem;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 4px 24px rgba(15, 108, 189, 0.06);
}

.section-card .title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #212529;
  margin-bottom: 0.25rem;
}

.section-card .subtitle {
  font-size: 0.95rem;
  color: #6c757d;
}

/* ----------------------------------------------
 * Enhanced Form Controls with Glassmorphism
 * ---------------------------------------------- */
.filters-grid .form-control,
.filters-grid .form-select {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 0.6rem;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.filters-grid .form-control:focus,
.filters-grid .form-select:focus {
  background: #ffffff;
  border-color: var(--accent-fill-rest);
  box-shadow: 0 0 0 4px rgba(15, 108, 189, 0.12);
}

.filters-grid .form-control::placeholder {
  color: #9ca3af;
}

/* Floating labels inside filters-grid */
.filters-grid .form-floating {
  width: 100%;
}

.filters-grid .form-floating > .form-control,
.filters-grid .form-floating > .form-select {
  border-radius: 0.6rem;
}

.filters-grid .form-floating > label {
  font-size: 0.85rem;
  color: #6c757d;
}

/* Actions column alignment with floating labels */
.filters-grid .form-actions {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.filters-grid .form-actions .btn-bar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  min-height: calc(3.5rem + 2px); /* match form-floating height */
}

/* ----------------------------------------------
 * Enhanced Buttons
 * ---------------------------------------------- */
.btn-primary {
  background: linear-gradient(135deg, var(--accent-fill-rest) 0%, #0d5ea8 100%);
  border: none;
  box-shadow: 0 4px 16px rgba(15, 108, 189, 0.3);
  transition: all 0.3s ease;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0d5ea8 0%, #0b4d8d 100%);
  box-shadow: 0 6px 24px rgba(15, 108, 189, 0.4);
  transform: translateY(-2px);
}

.btn-outline-secondary {
  background: rgba(255, 255, 255, 0.8);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 0, 0, 0.15);
  color: #495057;
  transition: all 0.3s ease;
}

.btn-outline-secondary:hover {
  background: #495057;
  border-color: #495057;
  color: #ffffff;
  transform: translateY(-2px);
}

.btn-outline-secondary:focus {
  background: rgba(255, 255, 255, 0.9);
  color: #495057;
}

/* Light buttons (white background) */
.btn-light {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: #495057;
  transition: all 0.3s ease;
}

.btn-light:hover {
  background: #495057;
  border-color: #495057;
  color: #ffffff;
}

.btn-light:focus {
  background: rgba(255, 255, 255, 0.95);
  color: #495057;
}

/* Enhanced responsive design */
@media (max-width: 768px) {
  .page-header {
    margin-bottom: 1.5rem;
  }

  .card-stat .display-6 {
    font-size: 2rem;
  }
}

/* ----------------------------------------------
 * Modern Navbar Enhancement
 * ---------------------------------------------- */
.navbar {
  background: rgba(255, 255, 255, 0.85) !important;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
}

.navbar-brand {
  font-weight: 600;
  background: linear-gradient(135deg, var(--accent-fill-rest), #00d4ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-link {
  font-weight: 500;
  transition: all 0.2s ease;
  border-radius: 0.5rem;
  padding: 0.5rem 0.875rem !important;
}

.nav-link:hover {
  background: rgba(15, 108, 189, 0.08);
}

/* ----------------------------------------------
 * Modern Table Enhancement
 * ---------------------------------------------- */
.table {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 0.75rem;
  overflow: hidden;
}

.table thead th {
  background: linear-gradient(180deg, rgba(15, 108, 189, 0.06) 0%, rgba(15, 108, 189, 0.02) 100%);
  border-bottom: 2px solid rgba(15, 108, 189, 0.15);
  font-weight: 600;
  color: #495057;
  padding: 1rem 0.875rem;
}

.table tbody tr {
  transition: all 0.2s ease;
}

.table tbody tr:hover {
  background: rgba(15, 108, 189, 0.04);
}

.table tbody td {
  padding: 0.875rem;
  vertical-align: middle;
}

/* ----------------------------------------------
 * Modern Badge Enhancement
 * ---------------------------------------------- */
.badge {
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.4em 0.8em;
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.badge.bg-success {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%) !important;
  color: #ffffff !important;
}

.badge.bg-danger {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
  color: #ffffff !important;
}

.badge.bg-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
  color: #ffffff !important;
}

.badge.bg-info {
  background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%) !important;
  color: #ffffff !important;
}

.badge.bg-secondary {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%) !important;
  color: #ffffff !important;
}

.badge.bg-primary {
  background: linear-gradient(135deg, var(--accent-fill-rest) 0%, #0d5ea8 100%) !important;
  color: #ffffff !important;
}

/* Status-specific badge styles */
.badge-status-approved {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%) !important;
  color: #ffffff !important;
}

.badge-status-rejected {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
  color: #ffffff !important;
}

.badge-status-pending {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
  color: #ffffff !important;
}

  /* New: distinct color for COMPLETED to avoid confusion with REJECTED */
  .badge-status-completed {
    background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%) !important; /* teal/blue */
    color: #ffffff !important;
  }

/* ----------------------------------------------
 * Modern Alert Enhancement
 * ---------------------------------------------- */
.alert {
  border: none;
  border-radius: 0.75rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.alert-success {
  background: rgba(34, 197, 94, 0.12);
  color: #166534;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #991b1b;
}

.alert-warning {
  background: rgba(245, 158, 11, 0.12);
  color: #92400e;
}

.alert-info {
  background: rgba(6, 182, 212, 0.12);
  color: #155e75;
}

/* ----------------------------------------------
 * Modern Modal Enhancement
 * ---------------------------------------------- */
.modal-content {
  border: none;
  border-radius: 1rem;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
  background: rgba(255, 255, 255, 0.95);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.modal-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  padding: 1.25rem 1.5rem;
}

.modal-title {
  font-weight: 600;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding: 1rem 1.5rem;
}

/* ----------------------------------------------
 * Icon Inline Enhancement
 * ---------------------------------------------- */
.icon-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  margin-right: 0.375rem;
  font-size: 0.875rem;
}

/* ----------------------------------------------
 * Empty State Enhancement
 * ---------------------------------------------- */
.text-center.text-muted.py-5 {
  padding: 3rem 1rem !important;
}

.text-center.text-muted.py-5::before {
  content: '';
  display: block;
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  background: linear-gradient(135deg, rgba(15, 108, 189, 0.1), rgba(15, 108, 189, 0.05));
  border-radius: 50%;
}

/* ----------------------------------------------
 * Scrollbar Enhancement
 * ---------------------------------------------- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.04);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba(15, 108, 189, 0.3);
  border-radius: 4px;
  transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 108, 189, 0.5);
}

/* ----------------------------------------------
 * Loading Animation
 * ---------------------------------------------- */
@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.loading-pulse {
  animation: pulse-soft 1.5s ease-in-out infinite;
}

/* ----------------------------------------------
 * Responsive Adjustments for Dashboard Tiles
 * ---------------------------------------------- */
@media (min-width: 1400px) {
  .dashboard-tiles .col-xl {
    flex: 0 0 20%;
    max-width: 20%;
  }
}

@media (min-width: 1200px) and (max-width: 1399.98px) {
  .dashboard-tiles .col-xl {
    flex: 0 0 20%;
    max-width: 20%;
  }
}

@media (min-width: 992px) and (max-width: 1199.98px) {
  .dashboard-tiles > div {
    flex: 0 0 33.333%;
    max-width: 33.333%;
  }
}

@media (min-width: 768px) and (max-width: 991.98px) {
  .dashboard-tiles > div {
    flex: 0 0 50%;
    max-width: 50%;
  }
}

@media (max-width: 767.98px) {
  .dashboard-tiles > div {
    flex: 0 0 50%;
    max-width: 50%;
  }

  .dashboard-tiles .display-6 {
    font-size: 1.75rem;
  }
}

/* ============================================
   Utility Classes (extracted from inline styles)
   ============================================ */

/* Navbar brand logo image */
.navbar-brand-logo-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 8px;
  background: transparent;
}

/* Navbar brand logo placeholder */
.navbar-brand-logo-placeholder {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #0F6CBD 0%, #1E90FF 100%);
}

/* Dropdown menus min-width */
.dropdown-menu-theme {
  min-width: 160px;
}

.dropdown-menu-lang {
  min-width: 150px;
}

.dropdown-menu-user {
  min-width: 200px;
}

/* User avatar in navbar */
.navbar-avatar {
  object-fit: cover;
}

/* User avatar placeholder */
.navbar-avatar-placeholder {
  width: 32px;
  height: 32px;
  font-weight: 600;
}

/* AnyDoc card accent border */
.card-anydoc-accent {
  border-left: 4px solid var(--accent-fill-rest) !important;
}

/* AnyDoc icon color */
.text-accent {
  color: var(--accent-fill-rest);
}
