:root {
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-glow: rgba(59, 130, 246, 0.5);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg-main: #f3f4f6;
  --bg-card: #ffffff;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.3);
  --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --sidebar-width: 260px;
  --radius: 0.75rem;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
  background-color: var(--bg-main);
  color: var(--text-main);
}

/* Brand */
.brand-logo {
  height: 34px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  display: inline-block;
}

.brand-logo--login {
  height: 86px;
  max-width: 260px;
}

body.no-scroll {
  overflow: hidden !important;
  position: fixed;
  width: 100%;
  height: 100vh;
  top: 0;
  left: 0;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Page transitions */

.glass-card,
.mobile-card-view {
  animation: fadeIn 0.2s ease-out;
}

/* Glassmorphism Styles */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
}

.glass-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.glass-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Sidebar Responsive Fixes */
#sidebar-wrapper {
  min-height: 100svh;
  /* Small viewport height */
  height: 100dvh;
  /* Dynamic viewport height */
  width: var(--sidebar-width);
  margin-left: calc(-1 * var(--sidebar-width));
  transition: margin 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: fixed;
  z-index: 1060;
  top: 0;
  bottom: 0;
  overflow-y: auto;
  /* Enable internal scroll */
  -webkit-overflow-scrolling: touch;
  /* Smooth scroll on iOS */
  background-color: white;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
}

#sidebar-wrapper .list-group {
  padding-bottom: calc(85px + env(safe-area-inset-bottom));
  /* Account for Safari toolbar and safe area */
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1055;
  backdrop-filter: blur(2px);
}

#wrapper.toggled .sidebar-overlay {
  display: block;
}

#wrapper.toggled #sidebar-wrapper {
  margin-left: 0;
}

@media (min-width: 992px) {
  .sidebar-overlay {
    display: none !important;
  }

  #sidebar-wrapper {
    margin-left: 0;
    position: sticky;
  }

  #wrapper.toggled #sidebar-wrapper {
    margin-left: calc(-1 * var(--sidebar-width));
  }
}

/* Responsive Table vs Cards (iPhone/iPad focus) */
.mobile-card-view {
  display: flex !important;
  flex-direction: column;
  gap: 1rem;
}

.desktop-table-view {
  display: none !important;
}

@media (max-width: 576px) {
  .mobile-card-view {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }
}

@media (min-width: 768px) {
  .mobile-card-view {
    display: none !important;
  }

  .desktop-table-view {
    display: table !important;
    width: 100%;
  }
}

/* UI Components */
.badge-status {
  padding: 0.4em 0.8em;
  border-radius: 2rem;
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.active-link {
  background-color: #eff6ff !important;
  border-left: 4px solid var(--primary) !important;
  color: var(--primary) !important;
  font-weight: 600;
}

.stat-card {
  padding: 1.5rem;
  border-radius: var(--radius);
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Soft Backgrounds & Borders */
.bg-primary-soft { background-color: rgba(13, 110, 253, 0.1); }
.bg-success-soft { background-color: rgba(25, 135, 84, 0.1); }
.bg-warning-soft { background-color: rgba(255, 193, 7, 0.1); }
.bg-danger-soft { background-color: rgba(220, 53, 69, 0.1); }
.bg-info-soft { background-color: rgba(13, 202, 240, 0.1); }
.bg-secondary-soft { background-color: rgba(108, 117, 125, 0.1); }

.border-primary-soft { border: 1px solid rgba(13, 110, 253, 0.2) !important; }
.border-success-soft { border: 1px solid rgba(25, 135, 84, 0.2) !important; }
.border-warning-soft { border: 1px solid rgba(255, 193, 7, 0.2) !important; }
.border-danger-soft { border: 1px solid rgba(220, 53, 69, 0.2) !important; }
.border-info-soft { border: 1px solid rgba(13, 202, 240, 0.2) !important; }
.border-secondary-soft { border: 1px solid rgba(108, 117, 125, 0.2) !important; }

/* Micro-animations */
.hover-translate-sm { transition: transform 0.2s ease, box-shadow 0.2s ease; }
.hover-translate-sm:hover {
    transform: translateY(-2px);
    box-shadow: 0 .5rem 1rem rgba(0,0,0,.05) !important;
    background-color: #fff !important;
    z-index: 10;
    position: relative;
}

.hover-translate-x { transition: transform 0.2s ease, background-color 0.2s ease; }
.hover-translate-x:hover { transform: translateX(5px); background-color: rgba(13, 110, 253, 0.05); }

/* Typography Utilities */
.poppins { font-family: 'Poppins', sans-serif !important; }
