/* ==================================================
   E-MIR Platform - Main Stylesheet
   Base styles, Layout, Brand variables, and Framework overrides
   ================================================== */

@charset "UTF-8";

/* ========== Font Imports ========== */
@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');

/* ========== CSS Variables (Brand Colors) ========== */
:root {
  /* E-MIR Brand Colors */
  --primary-color: #00556f;        /* Deep Teal */
  --primary-light: #008ba3;        /* Bright Teal */
  --primary-dark: #003d52;         /* Dark Teal */
  
  /* Secondary Colors */
  --secondary-color: #0099cc;      /* Sky Blue */
  --secondary-light: #33b3e6;      /* Light Blue */
  --secondary-dark: #0078b3;       /* Navy Blue */
  
  /* Status Colors */
  --success-color: #28a745;
  --warning-color: #ffc107;
  --danger-color: #dc3545;
  --info-color: #17a2b8;
  
  /* Neutral Colors */
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --text-light: #999999;
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f5;
  --bg-tertiary: #efefef;
  --border-color: #e0e0e0;
  
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

/*
  Bridge legacy brand variables to MudBlazor palette.
  This keeps existing CSS working while allowing MudThemeProvider dark mode
  to apply across the entire page.
*/
body.mud-theme-light,
.mud-theme-light,
body.mud-theme-dark,
.mud-theme-dark {
  --text-primary: var(--mud-palette-text-primary, #1a1a1a);
  --text-secondary: var(--mud-palette-text-secondary, #666666);
  --bg-primary: var(--mud-palette-surface, #ffffff);
  --bg-secondary: var(--mud-palette-background, #f5f5f5);
  --bg-tertiary: var(--mud-palette-surface, #efefef);
  --border-color: var(--mud-palette-lines-default, #e0e0e0);
}

/* Bridge Bootstrap variables to Mud palette so legacy pages/components theme consistently */
body,
:root {
  --bs-body-bg: var(--mud-palette-background, #f5f5f5);
  --bs-body-color: var(--mud-palette-text-primary, #1a1a1a);
  --bs-secondary-color: var(--mud-palette-text-secondary, #666666);
  --bs-border-color: var(--mud-palette-lines-default, #e0e0e0);
  --bs-link-color: var(--mud-palette-primary, #00556f);
  --bs-link-hover-color: var(--mud-palette-primary, #003d52);
  --bs-card-bg: var(--mud-palette-surface, #ffffff);
  --bs-card-color: var(--mud-palette-text-primary, #1a1a1a);
}

/* ========== Global Resets ========== */
* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--mud-palette-text-primary, var(--text-primary));
  background-color: var(--mud-palette-background, var(--bg-secondary));
}

/* MudBlazor layout should own viewport sizing and offsets */
.mud-layout {
  min-height: 100vh;
  background-color: var(--mud-palette-background, var(--bg-secondary));
  color: var(--mud-palette-text-primary, var(--text-primary));
}

.app-main {
  --app-content-padding-x: 16px;
  --app-content-padding-y: 16px;
  background-color: var(--mud-palette-background, var(--bg-secondary));
  padding: var(--app-content-padding-y) var(--app-content-padding-x);
  padding-top: calc(var(--mud-appbar-height, 64px) + var(--app-content-padding-y));
}

@media (min-width: 1200px) {
  .app-main {
    --app-content-padding-x: 20px;
    --app-content-padding-y: 20px;
  }
}

@media (max-width: 600px) {
  .app-main {
    --app-content-padding-x: 12px;
    --app-content-padding-y: 12px;
  }
}

/* AppBar title: prevent clipping, allow ellipsis on narrow viewports */
.appbar-elevated .mud-toolbar {
  min-height: 64px;
}

.appbar-title {
  margin-left: 8px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* App brand (logo + product title) in AppBar */
.app-brand-logo {
  width: 28px;
  height: 28px;
}

/* AppBar layout: left logo, centered agency, right actions */
.appbar-content {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 12px;
}

.appbar-left,
.appbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.appbar-left {
  min-width: 0;
}

.app-brand-title {
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-left: 0;
}

.appbar-center-title {
  flex: 1;
  text-align: center;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ===== Page header (Mud) ===== */
.page-header-shell {
  background: linear-gradient(
    180deg,
    rgba(0, 85, 111, 0.08) 0%,
    rgba(0, 85, 111, 0.02) 100%
  );
  border: 0;
  border-bottom: 1px solid var(--mud-palette-lines-default, #e0e0e0);
  border-radius: 0;
  padding: 14px var(--app-content-padding-x, 16px);
  margin: calc(-1 * var(--app-content-padding-y, 16px)) calc(-1 * var(--app-content-padding-x, 16px)) 16px;
  box-shadow: none;
}

.page-header-shell .page-title {
  font-weight: 700;
  letter-spacing: -0.01em;
}

.page-header-shell .page-subtitle {
  margin-top: 2px;
}

/* ===== Page header (Legacy Bootstrap pages) =====
   Many pages still use <div class="page-header mb-4"> ...
   Style those to match the Mud PageHeader strip (without affecting MudStack elements).
*/
.page-header:not(.mud-stack) {
  background: linear-gradient(
    180deg,
    rgba(0, 85, 111, 0.08) 0%,
    rgba(0, 85, 111, 0.02) 100%
  );
  border-bottom: 1px solid var(--mud-palette-lines-default, #e0e0e0);
  padding: 14px var(--app-content-padding-x, 16px);
  margin: calc(-1 * var(--app-content-padding-y, 16px)) calc(-1 * var(--app-content-padding-x, 16px)) 16px;
}

.page-header:not(.mud-stack).mb-4 {
  margin-bottom: 16px !important;
}

.page-header:not(.mud-stack) .page-title {
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

.page-header:not(.mud-stack) .page-subtitle {
  margin-top: 2px;
  margin-bottom: 0;
  color: var(--mud-palette-text-secondary, #666666);
}

h1:focus {
  outline: none;
}

/* ========== Layout Components ========== */
.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ========== Sidebar Navigation ========== */
.sidebar {
  width: 280px;
  background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary-color) 100%);
  color: white;
  padding: 0;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  position: relative;
  z-index: 100;
  overflow-x: hidden; /* Prevent horizontal scroll */
  height: 100vh;
  overscroll-behavior: contain;
}

.sidebar-header {
  padding: 1.5rem 1rem;
  border-bottom: 1px solid rgba(0, 153, 204, 0.2);
  background: linear-gradient(135deg, rgba(0, 85, 111, 0.1) 0%, rgba(0, 153, 204, 0.05) 100%);
}

/* Logo Styles */
.platform-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.25rem;
  color: white;
  text-decoration: none;
  transition: all 0.2s;
}

.platform-logo:hover {
  opacity: 0.9;
}

.logo-icon-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3)) drop-shadow(0 0 8px rgba(0, 153, 204, 0.6));
  background: rgba(0, 153, 204, 0.2);
  padding: 4px;
  border-radius: 8px;
  transition: all 0.2s;
}

.platform-logo:hover .logo-icon-img {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3)) drop-shadow(0 0 12px rgba(0, 153, 204, 0.9));
  background: rgba(0, 153, 204, 0.3);
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.logo-text-main {
  font-size: 1.3rem;
  color: #ffffff;
  font-weight: 800;
  letter-spacing: 1.5px;
}

.logo-text-sub {
  font-size: 0.6rem;
  color: #7dd3fc;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* Navigation */
.sidebar-nav {
  flex: 1;
  padding: 1.5rem 0;
  overflow-y: auto;
  overflow-x: hidden; /* Prevent horizontal scroll */
  overscroll-behavior: contain;
}

.sidebar-search {
  position: sticky;
  top: 0;
  z-index: 5;
  background: linear-gradient(180deg, var(--primary-dark) 0%, rgba(0, 85, 111, 0.9) 100%);
  padding-top: 0.25rem;
  padding-bottom: 0.75rem;
}

.sidebar-search-input {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
}

.sidebar-search-input::placeholder {
  color: rgba(255, 255, 255, 0.65);
}

.sidebar-search-input:focus {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 0 0.15rem rgba(13, 110, 253, 0.25);
  color: #fff;
}

.nav-section {
  padding: 1rem 0;
  margin-top: 0.5rem; /* slightly more separation between sections */
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.nav-section summary {
  list-style: none;
  cursor: pointer;
}

.nav-section summary::-webkit-details-marker {
  display: none;
}

.nav-section-title::after {
  content: "▾";
  margin-left: auto;
  font-size: 0.75rem;
  opacity: 0.6;
  transition: transform 0.2s ease;
}

.nav-section:not([open]) > .nav-section-title::after {
  transform: rotate(-90deg);
}

.nav-section-body {
  padding-left: 0;
}

/* Improved section title styling for clear visual hierarchy */
.nav-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;              /* slightly larger for emphasis */
  font-weight: 800;              /* stronger weight */
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.88); /* higher contrast than links */
  padding: 0.4rem 1rem;          /* comfortable hit area */
  margin: 0 0 0.5rem 0.5rem;     /* leave small left inset to align with links */
  letter-spacing: 0.08em;
  border-radius: 6px;            /* subtle pill feel */
  background: linear-gradient(90deg, rgba(255,255,255,0.02), rgba(0,0,0,0));
  position: relative;
}

/* Accent bar on the left of section title for quick scanning */
.nav-section-title::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 1.25rem;
  background: var(--secondary-light);
  border-radius: 2px;
  margin-right: 0.5rem;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

/* Section-specific accent colors */
.nav-section-title.monitoring::before {
  background: linear-gradient(135deg, #3b82f6, #2563eb); /* Blue */
}

.nav-section-title.operations::before {
  background: linear-gradient(135deg, #10b981, #059669); /* Green */
}

.nav-section-title.workflow-automation::before {
  background: linear-gradient(135deg, #f59e0b, #d97706); /* Orange */
}

.nav-section-title.administration::before {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed); /* Purple */
}

.nav-section-title.data-config::before {
  background: linear-gradient(135deg, #06b6d4, #0891b2); /* Cyan */
}

.nav-section-title.billing::before {
  background: linear-gradient(135deg, #ec4899, #db2777); /* Pink */
}

.nav-section-title.platform-admin::before {
  background: linear-gradient(135deg, #eab308, #ca8a04); /* Yellow */
}

/* Make the icon inside the section title slightly larger and aligned */
.nav-section-title i {
  font-size: 1.05rem;
  opacity: 0.95;
  width: 18px;
  text-align: center;
  margin-left: -0.25rem; /* nudge because of accent bar */
}

/* Subsection subtitle for nested grouping within Platform Admin */
.nav-section-subtitle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
  padding: 0.5rem 1rem;
  margin: 1rem 0 0.5rem 1rem;
  letter-spacing: 0.08em;
  border-left: 3px solid rgba(251, 191, 36, 0.3);
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.08), transparent);
  border-radius: 4px;
}

.nav-section-subtitle i {
  font-size: 0.95rem;
  opacity: 0.9;
  color: #fbbf24;
}

/* ===== PLATFORM ADMIN SECTION ENHANCEMENTS ===== */
/* Modern design with clear visual separation and hierarchy */
.nav-section.border-top {
  border-top: 2px solid rgba(255, 255, 255, 0.15) !important;
  margin-top: 1rem;
  padding-top: 1.25rem !important;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.1) 0%, transparent 100%);
}

/* Platform Admin title with premium styling */
.nav-section-title.platform-admin {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #fbbf24 !important; /* Warmer yellow for better contrast */
  padding: 0.6rem 1rem;
  margin: 0 0 0.75rem 0.5rem;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(245, 158, 11, 0.08));
  border-radius: 8px;
  border-left: 4px solid #fbbf24;
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.2);
}

/* Icon styling for platform admin - override section title defaults */
.nav-section-title.platform-admin i {
  font-size: 1.1rem;
  color: #fbbf24;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Override the ::before accent bar for platform admin to match the yellow theme */
.nav-section-title.platform-admin::before {
  display: none; /* Hide the default accent bar since we have our own border-left */
}

/* Subsection container tweaks to clearly nest child items */
.nav-subsection {
  background: rgba(0, 0, 0, 0.04);
  border-left: 2px solid rgba(255, 255, 255, 0.06);
  margin: 0.25rem 0 0.5rem 0.5rem;
  padding: 0.25rem 0 0.25rem 0.5rem;
  border-radius: 6px;
  overflow: hidden; /* Prevent content overflow */
}

.nav-subsection .nav-link-sidebar {
  padding-left: 1.5rem; /* keep nested links indented */
  font-size: 0.88rem;
}

/* Child menu (links) should be visually subordinate */
.nav-link-sidebar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  transition: all 0.25s ease;
  border-left: 3px solid transparent;
  overflow: hidden; /* Prevent text overflow */
  white-space: nowrap; /* Prevent text wrapping */
  position: relative;
  width: 100%; /* Ensure full width */
  box-sizing: border-box; /* Include padding in width */
}

.nav-link-sidebar span {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.nav-link-sidebar:hover {
  background: rgba(255, 255, 255, 0.06);
  color: white;
  transform: translateX(0); /* Remove transform to prevent overflow */
  padding-left: calc(1.25rem + 2px); /* Slight visual shift instead */
}

.nav-link-sidebar i {
  font-size: 0.95rem;
  opacity: 0.9;
  flex-shrink: 0; /* Prevent icon from shrinking */
}

/* Active link stronger visual cue without overpowering the section title */
.nav-link-sidebar.active {
  background: rgba(255, 255, 255, 0.12);
  color: white;
  border-left-color: var(--secondary-light);
  padding-left: calc(1.25rem - 3px);
}

/* ===== MudBlazor Layout Enhancements ===== */
.mud-drawer-app .mud-drawer-content {
  scrollbar-width: none;
}

.mud-drawer-app .mud-drawer-content::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.drawer-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
}

.drawer-logo img {
  width: 36px;
  height: 36px;
}


.appbar-elevated .mud-toolbar {
  padding-left: 1rem;
  padding-right: 1rem;
}

.mud-drawer-app .mud-drawer-content {
  padding-top: 0.25rem;
}

/* ===== Light-theme Drawer polish (enterprise) ===== */
.mud-drawer-app {
  background-color: #e7f7ff;
  background-image: linear-gradient(180deg, #d8f1fb 0%, #eef9ff 65%, #e7f7ff 100%);
  border-right: 1px solid var(--mud-palette-lines-default, #e0e0e0);
}

.mud-drawer-app .mud-navmenu {
  padding: 0.25rem 0.25rem 0.75rem;
}

/* Prevent Bootstrap from underlining navigation links (esp. :hover/:visited) */
.mud-drawer-app a,
.mud-drawer-app a:hover,
.mud-drawer-app a:visited,
.mud-drawer-app a:focus {
  text-decoration: none !important;
}

.mud-nav-link {
  border-radius: 10px;
  color: var(--mud-palette-text-primary, #1a1a1a);
}

.mud-nav-link:hover {
  background-color: rgba(0, 85, 111, 0.06);
}

.mud-nav-link.active {
  background-color: rgba(0, 85, 111, 0.10);
  border-left: 3px solid var(--mud-palette-primary, #00556f);
}

.mud-nav-link.active .mud-nav-link-text,
.mud-nav-link.active .mud-nav-link-icon {
  color: var(--mud-palette-primary, #00556f);
}

.mud-nav-link {
  font-weight: 500;
  font-size: 0.9rem;
}

.mud-nav-link .mud-nav-link-text {
  letter-spacing: 0.2px;
}

.mud-nav-group > .mud-nav-link {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
}

.mud-nav-group .mud-nav-group-items {
  margin-left: 0.25rem;
}

.mud-nav-link.active {
  border-radius: 10px;
}

@media (max-width: 960px) {
  .drawer-title-main {
    font-size: 0.95rem;
  }
}
}

/* Badge positioning to prevent overflow */
.nav-badge {
  margin-left: auto;
  background: var(--danger-color);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0; /* Prevent badge from shrinking */
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  margin-top: auto;
  color: white !important;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: white !important;
  background: transparent !important;
  padding: 0 !important;
  border: none !important;
  cursor: default;
}

.user-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  color: white;
}

.user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #ffffff !important;
  line-height: 1.2;
}

.user-role {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7) !important;
  line-height: 1.2;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  color: #ffffff !important;
  flex-shrink: 0;
}

/* ========== Main Content Area ========== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--mud-palette-background, var(--bg-secondary));
  height: 100vh;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Modern header with refined styling */
.content-header {
  background: var(--mud-palette-surface, var(--bg-primary));
  padding: 1.25rem 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  border-bottom: 1px solid var(--border-color);
  transition: all 0.3s ease;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
}

.header-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 1rem;
}

/* Title styling with better typography */
.header-toolbar h1 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.header-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.agency-branding {
  display: flex;
  align-items: center;
  padding: 0.25rem 1.25rem;
  margin-right: 0.75rem;
  border-right: 2px solid rgba(0, 0, 0, 0.08);
}

.agency-logo-header {
  max-height: 42px;
  max-width: 200px;
  object-fit: contain;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.1));
}

/* Improved button styling */
.header-btn {
  background: white !important;
  border: 1.5px solid var(--border-color) !important;
  color: var(--text-secondary) !important;
  padding: 0.5rem 0.75rem !important;
  border-radius: 6px !important;
  transition: all 0.2s ease !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  font-weight: 500;
}

.header-btn:hover {
  background: var(--bg-secondary) !important;
  border-color: var(--text-secondary) !important;
  color: var(--text-primary) !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.header-btn i {
  font-size: 1.1rem;
}

.header-btn .badge {
  margin-left: 0.25rem;
  font-size: 0.7rem;
  padding: 0.2rem 0.4rem;
}

.content-body {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  background-color: var(--bg-secondary);
}

.content {
  padding-top: 1.1rem;
}

/* ========== Page Headers ========== */
.page-header {
  margin-bottom: 2rem;
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.page-subtitle {
  font-size: 1rem;
  margin: 0;
  color: var(--text-secondary);
}

/* ========== Cards ========== */
.card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.3s;
  margin-bottom: 1.5rem;
}

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

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-body {
  padding: 1.5rem;
}

.card-footer {
  padding: 1.25rem 1.5rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
}

/* ========== Statistics Cards ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-info {
  flex: 1;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.stat-subtitle {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: white;
}

/* ========== Buttons (Bootstrap Override) ========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
  line-height: 1.5;
}

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

.btn-primary:hover {
  background: var(--primary-light);
  border-color: var(--primary-light);
}

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

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

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

.btn-outline-secondary:hover {
  background: var(--bg-secondary);
  border-color: var(--text-secondary);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
}

a, .btn-link {
  color: #0071c1;
}

/* ========== Badges ========== */
.badge {
  display: inline-block;
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
}

.bg-primary {
  background: var(--primary-color);
  color: white;
}

.bg-secondary {
  background: #6c757d;
  color: white;
}

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

.bg-warning {
  background: var(--warning-color);
  color: var(--text-primary);
}

.bg-danger {
  background: var(--danger-color);
  color: white;
}

.bg-info {
  background: var(--info-color);
  color: white;
}

.text-white {
  color: white;
}

.text-dark {
  color: var(--text-primary);
}

/* ========== Alerts ========== */
.alert {
  padding: 1rem 1.25rem;
  border-radius: 4px;
  margin-bottom: 1.5rem;
  border: 1px solid transparent;
}

.alert-info {
  background: #d1ecf1;
  border-color: #bee5eb;
  color: #0c5460;
}

.alert-danger {
  background: #f8d7da;
  border-color: #f5c6cb;
  color: #721c24;
}

.alert-success {
  background: #d4edda;
  border-color: #c3e6cb;
  color: #155724;
}

.alert-warning {
  background: #fff3cd;
  border-color: #ffeeba;
  color: #856404;
}

/* ========== Tables ========== */
.table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  overflow: hidden;
}

.table th {
  background: var(--bg-secondary);
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.875rem;
}

.table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.table tbody tr:hover {
  background: var(--bg-secondary);
}

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

/* ========== Form Validation (Blazor) ========== */
.valid.modified:not([type=checkbox]) {
  outline: 1px solid #26b050;
}

.invalid {
  outline: 1px solid red;
}

.validation-message {
  color: red;
}

/* ========== Blazor Error UI ========== */
#blazor-error-ui {
  background: lightyellow;
  bottom: 0;
  box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
  display: none;
  left: 0;
  padding: 0.6rem 1.25rem 0.7rem 1.25rem;
  position: fixed;
  width: 100%;
  z-index: 1000;
}

#blazor-error-ui .dismiss {
  cursor: pointer;
  position: absolute;
  right: 0.75rem;
  top: 0.5rem;
}

.blazor-error-boundary {
  background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMzNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
  padding: 1rem 1rem 1rem 3.7rem;
  color: white;
}

.blazor-error-boundary::after {
  content: "An error has occurred."
}

/* ========== Utility Classes ========== */
.d-flex {
  display: flex;
}

.align-items-center {
  align-items: center;
}

.justify-content-between {
  justify-content: space-between;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-3 {
  gap: 1rem;
}

.mb-0 {
  margin-bottom: 0;
}

.mb-2 {
  margin-bottom: 0.5rem;
}

.mb-3 {
  margin-bottom: 1rem;
}

.mb-4 {
  margin-bottom: 1.5rem;
}

.mt-3 {
  margin-top: 1rem;
}

.me-2 {
  margin-right: 0.5rem;
}

.ms-auto {
  margin-left: auto;
}

.text-center {
  text-align: center;
}

.text-muted {
  color: var(--text-secondary);
}

.p-5 {
  padding: 3rem;
}

/* ========== Responsive Design ========== */
@media (max-width: 768px) {
  .sidebar {
    width: 250px;
  }

  .page-title {
    font-size: 1.5rem;
  }

  .content-body {
    padding: 1rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 576px) {
  .app-container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    max-height: 200px;
  }

  .sidebar-nav {
    max-height: 100px;
  }

  .main-content {
    flex: 1;
  }

  .content-header {
    padding: 1rem;
  }

  .content-body {
    padding: 1rem;
  }

  .header-toolbar {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
}
