/* ===== SIDEBAR ===== */
.sidebar {
  width: 230px;
  height: 100vh;
  background: #111827;
  color: white;
  position: fixed;
  top: 0;
  left: 0;
  overflow-y: auto;
  z-index: 100;
}

.sidebar a {
  display: block;
  padding: 12px 20px;
  color: #d1d5db;
  text-decoration: none;
  transition:
    background 0.2s,
    color 0.2s;
  font-size: 0.9rem;
}

.sidebar a:hover,
.sidebar a.active {
  background: #1f2937;
  color: white;
}

.sidebar .collapse a {
  padding-left: 45px;
  font-size: 0.85rem;
}

.sidebar [data-bs-toggle="collapse"] i:last-child {
  transition: transform 0.3s;
}

.sidebar [data-bs-toggle="collapse"][aria-expanded="true"] i:last-child {
  transform: rotate(180deg);
}

.sidebar a i {
  margin-right: 8px;
}

.sidebar hr {
  border-color: #374151;
  margin: 0;
}

/* ===== SIDEBAR PROFILE ===== */
.profile-link {
  display: block;
  text-decoration: none;
  color: inherit;
  margin: 10px;
  padding: 15px 10px 10px !important;
  border-radius: 8px;
  text-align: center;
  transition: background 0.2s, transform 0.2s;
}

.profile-link:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  color: inherit !important;
  transform: translateY(-2px);
}

.sidebar-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.profile-avatar {
  font-size: 2.5rem;
  color: #9ca3af;
  margin-bottom: 5px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-avatar i {
  margin: 0 !important;
  padding: 0 !important;
}

.profile-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #f9fafb;
  word-break: break-word;
  margin-bottom: 2px;
}

.profile-role {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 2px;
}

/* ===== LOGO ===== */
.logo-container {
  text-align: center;
  padding: 20px 10px 5px;
}

.logo {
  width: 55px;
  height: auto;
}

/* ===== MAIN CONTENT ===== */
.main {
  margin-left: 230px;
  min-height: 100vh;
  background: #f8f9fa;
}

/* ===== STAT CARDS ===== */
.stat-card {
  transition: transform 0.2s;
}

.stat-card:hover {
  transform: translateY(-3px);
}

/* ===== TABLE ===== */
.table th {
  background: #f1f3f5;
  font-weight: 600;
}

/* ===== BADGES ===== */
.badge-pending {
  background-color: #ffc107;
  color: #212529;
}

.badge-approved {
  background-color: #198754;
  color: white;
}

.badge-rejected {
  background-color: #dc3545;
  color: white;
}

/* ===== LOGIN ===== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f4f6f9; /* Sleek Off-white / light grey matching screenshot */
}

.login-card {
  width: 400px;
  max-width: 92vw;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05) !important;
  border-radius: 16px !important;
}

/* ===== PRINT STYLES ===== */
@media print {
  .sidebar,
  .no-print {
    display: none !important;
  }

  .main {
    margin-left: 0 !important;
  }

  .print-area {
    width: 100%;
  }
}

/* ===== PROGRESS BAR ===== */
.progress-label {
  font-size: 0.85rem;
  font-weight: 500;
}

/* ===== DASHBOARD STAT CARDS ===== */
.dash-stat-card {
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  border-radius: 10px;
  overflow: hidden;
}

.dash-stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1) !important;
}

.dash-stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.dash-stat-label {
  font-size: 0.72rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 600;
  white-space: nowrap;
}

.dash-stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
}

/* ===== ALERT CARD ===== */
#alertCard .badge {
  font-size: 0.85rem;
  min-width: 36px;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

/* Hoverable Table Rows */
.table-hover tbody tr {
  transition: background-color 0.2s ease;
}
.table-hover tbody tr:hover {
  background-color: rgba(99, 102, 241, 0.04) !important;
}
.table td {
  vertical-align: middle;
}

/* Modern Input Focus */
.form-control:focus, .form-select:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 0.25rem rgba(99, 102, 241, 0.25);
}

/* Button & Link Hover Effects */
.btn {
  transition: all 0.2s ease-in-out;
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}
.btn:active {
  transform: translateY(0);
}

/* Action Button Gap in Tables */
.action-buttons {
  display: flex;
  gap: 6px;
  justify-content: center;
}

/* Empty State Styling */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #6b7280;
}
.empty-state-icon {
  font-size: 3rem;
  color: #d1d5db;
  margin-bottom: 15px;
}
.empty-state-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 5px;
}
.empty-state-text {
  font-size: 0.9rem;
  max-width: 300px;
  margin: 0 auto;
}

/* Floating Toast / Snackbar (If used manually) */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1055;
}

/* ============================================================
   RESPONSIVE DESIGN & MOBILE OPTIMIZATIONS
   ============================================================ */

/* Base container for fluid pages using d-flex sidebar */
body {
  overflow-x: hidden;
  position: relative;
}

.d-flex {
  width: 100%;
}

/* Sidebar overlay backdrop */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  z-index: 99;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.show {
  opacity: 1;
  visibility: visible;
}

/* Tablets and Mobile Devices (<= 768px) */
@media (max-width: 768px) {
  /* Sidebar off-canvas styling */
  .sidebar {
    position: fixed !important;
    top: 0;
    left: -240px; /* Hidden by default offscreen */
    width: 230px;
    height: 100vh;
    z-index: 1040 !important;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s ease;
    visibility: hidden;
    box-shadow: 4px 0 25px rgba(0,0,0,0.15);
  }

  .sidebar.show {
    transform: translateX(240px); /* Slide in */
    visibility: visible;
  }

  /* Main content layout adjust */
  .main {
    margin-left: 0 !important; /* Full width */
    padding: 1rem !important;
    width: 100%;
    min-width: 0; /* Prevents overflow */
  }

  /* Sticky top navigation wrapper */
  .d-flex {
    flex-direction: column !important;
  }

  /* Touch Targets optimization */
  .btn, .form-control, .form-select, .sidebar a {
    min-height: 44px; /* Apple/Google guidelines */
    display: inline-flex;
    align-items: center;
  }
  
  .sidebar a {
    padding: 14px 20px;
  }

  /* Form spacing adjustments */
  .form-control, .form-select {
    font-size: 16px !important; /* Prevents auto-zoom on iOS */
  }

  /* Card layouts stacking */
  .row-cols-2 > .col, .row-cols-md-3 > .col {
    width: 100% !important; /* Stack vertically on small phones */
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }

  /* Spacing */
  h3, .h3 {
    font-size: 1.35rem !important;
  }

  .mb-4 {
    margin-bottom: 1.25rem !important;
  }

  /* Responsive Scrollable Tables Override */
  .table-responsive {
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    margin-bottom: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table-responsive table {
    margin-bottom: 0 !important;
  }

  /* Modern responsive modal viewport settings */
  .modal-dialog {
    margin: 0.5rem;
    max-width: calc(100% - 1rem) !important;
  }

  .modal-content {
    border-radius: 12px;
  }

  .modal-body {
    max-height: 70vh;
    overflow-y: auto;
  }
}

/* Small Phones (<= 425px) */
@media (max-width: 425px) {
  .p-4 {
    padding: 0.75rem !important;
  }
  
  /* Stack tables button controls */
  .action-buttons {
    flex-direction: column;
    width: 100%;
    gap: 4px !important;
  }

  .action-buttons .btn {
    width: 100%;
    justify-content: center;
  }

  /* Adjust metric card numbers sizing */
  .dash-stat-value {
    font-size: 1.2rem !important;
  }
}

