/* ==========================================================================
   HỆ THỐNG QUẢN LÝ BÁN TRÚ HỌC ĐƯỜNG - TRƯỜNG PTDTBT TH & THCS HỮU LÂN
   Design System & Administrative UI Stylesheet
   Typography: Be Vietnam Pro | Icons: Inline SVG Only (No Emoji)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&display=swap');

:root {
  /* Primary & Brand Color Palette (Học Đường & Quản Trị) */
  --primary: #4338ca;
  --primary-hover: #3730a3;
  --primary-light: #eef2ff;
  --primary-glow: rgba(67, 56, 202, 0.15);
  --primary-dark: #312e81;

  /* Accent & Success (Bếp Ăn & Dinh Dưỡng An Toàn) */
  --accent: #059669;
  --accent-hover: #047857;
  --accent-light: #ecfdf5;
  --accent-glow: rgba(5, 150, 105, 0.15);

  /* Warning & Alert */
  --warning: #d97706;
  --warning-hover: #b45309;
  --warning-light: #fffbeb;

  /* Danger & Destruction */
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-light: #fef2f2;

  /* Info & Sky */
  --info: #0284c7;
  --info-hover: #0369a1;
  --info-light: #f0f9ff;

  /* Backgrounds */
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-sidebar: #0f172a;
  --bg-sidebar-hover: #1e293b;
  --bg-sidebar-active: #312e81;

  /* Typography Colors */
  --text-main: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-white: #ffffff;

  /* Borders & Dividers */
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;
  --border-dark: rgba(255, 255, 255, 0.1);

  /* Border Radii */
  --radius-xs: 0.25rem;
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.25rem;
  --radius-full: 9999px;

  /* Modern Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --shadow-dropdown: 0 12px 28px 0 rgba(0, 0, 0, 0.12), 0 2px 4px 0 rgba(0, 0, 0, 0.06);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body.modal-open {
  overflow: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition-fast);
}

a:hover {
  color: var(--primary-hover);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ==========================================================================
   App Layout Framework
   ========================================================================== */
.app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
}

.main-wrapper {
  flex: 1;
  margin-left: 270px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  transition: var(--transition-smooth);
}

.content-area {
  flex: 1;
  padding: 1.75rem 2rem 3rem;
  max-width: 1560px;
  width: 100%;
}

/* ==========================================================================
   Sidebar Navigation (Desktop fixed / Mobile Drawer)
   ========================================================================== */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 45;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.sidebar {
  width: 270px;
  background-color: var(--bg-sidebar);
  color: var(--text-white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.sidebar-header {
  padding: 1.25rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-dark);
  background-color: rgba(255, 255, 255, 0.02);
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.brand-logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #4f46e5 0%, #059669 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
  flex-shrink: 0;
}

.brand-text {
  min-width: 0;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.7rem;
  color: #34d399;
  font-weight: 600;
  letter-spacing: 0.02em;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.sidebar-close-btn {
  display: none;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #94a3b8;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.sidebar-close-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.sidebar-menu {
  flex: 1;
  padding: 1rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.sidebar-menu::-webkit-scrollbar {
  width: 5px;
}

.sidebar-menu::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
}

.menu-category {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  padding: 0.75rem 0.75rem 0.35rem;
  font-weight: 700;
}

.menu-category-admin {
  color: #a5b4fc !important;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 0.85rem;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  border: 1px solid transparent;
}

.menu-item .menu-icon {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  color: #64748b;
  transition: var(--transition-fast);
}

.menu-item .menu-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-item:hover {
  background-color: var(--bg-sidebar-hover);
  color: #ffffff;
}

.menu-item:hover .menu-icon {
  color: #cbd5e1;
}

.menu-item.active {
  background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
  color: #ffffff;
  font-weight: 600;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 12px rgba(67, 56, 202, 0.35);
}

.menu-item.active .menu-icon {
  color: #ffffff;
}

.menu-item-logout {
  color: #f87171 !important;
}

.menu-item-logout .menu-icon {
  color: #f87171 !important;
}

.menu-item-logout:hover {
  background-color: rgba(239, 68, 68, 0.12) !important;
  color: #fca5a5 !important;
}

.sidebar-footer {
  padding: 1rem 1.15rem;
  border-top: 1px solid var(--border-dark);
  background-color: rgba(0, 0, 0, 0.18);
}

.user-status-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-indicator-dot {
  width: 10px;
  height: 10px;
  background-color: #10b981;
  border-radius: var(--radius-full);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
  flex-shrink: 0;
}

.status-info {
  min-width: 0;
}

.user-status-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-status-role {
  font-size: 0.7rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   Top Navbar
   ========================================================================== */
.top-navbar {
  height: 72px;
  background-color: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: var(--shadow-xs);
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-width: 0;
}

.btn-sidebar-toggle {
  display: none;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.btn-sidebar-toggle:hover {
  background-color: #e2e8f0;
}

.navbar-page-title {
  min-width: 0;
}

.breadcrumb-prefix {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 2px;
}

.main-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-shrink: 0;
}

.today-date-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--bg-main);
  border: 1px solid var(--border-color);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.today-date-badge svg {
  color: var(--primary);
  flex-shrink: 0;
}

/* User Dropdown */
.user-dropdown-container {
  position: relative;
}

.user-profile-trigger {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.65rem 0.35rem 0.45rem;
  background-color: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition-fast);
  user-select: none;
}

.user-profile-trigger:hover,
.user-profile-trigger[aria-expanded="true"] {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
}

.user-avatar {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
  color: #ffffff;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 2px 6px rgba(67, 56, 202, 0.25);
  flex-shrink: 0;
}

.user-details-inline {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-fullname {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.user-role-tag {
  font-size: 0.68rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 1px;
}

.user-role-tag.admin { color: #4338ca; }
.user-role-tag.bgh { color: #0284c7; }
.user-role-tag.giao_vien { color: #059669; }
.user-role-tag.nhan_vien_ban_tru { color: #d97706; }

.chevron-icon {
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.user-profile-trigger[aria-expanded="true"] .chevron-icon {
  transform: rotate(180deg);
}

.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 230px;
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-dropdown);
  padding: 0.5rem;
  z-index: 100;
  display: none;
  animation: popIn 0.15s ease-out;
}

.user-dropdown-menu.show {
  display: block;
}

.dropdown-header {
  padding: 0.65rem 0.75rem 0.5rem;
  display: flex;
  flex-direction: column;
}

.dropdown-header strong {
  font-size: 0.88rem;
  color: var(--text-main);
}

.dropdown-header small {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.dropdown-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 0.35rem 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text-body);
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
}

.dropdown-item:hover {
  background-color: var(--bg-main);
  color: var(--text-main);
}

.dropdown-item svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.dropdown-item:hover svg {
  color: var(--primary);
}

.dropdown-item-danger {
  color: var(--danger) !important;
}

.dropdown-item-danger svg {
  color: var(--danger) !important;
}

.dropdown-item-danger:hover {
  background-color: var(--danger-light) !important;
}

/* ==========================================================================
   Alerts & Notifications
   ========================================================================== */
.alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  animation: slideDown 0.3s ease-out;
}

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

.alert-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.alert-icon {
  flex-shrink: 0;
}

.alert-success {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.alert-success .alert-icon { color: #059669; }

.alert-error {
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.alert-error .alert-icon { color: #dc2626; }

.alert-close {
  background: none;
  border: none;
  cursor: pointer;
  color: currentColor;
  opacity: 0.65;
  padding: 0.2rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s ease;
}

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

/* ==========================================================================
   Stats Cards Grid
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.35rem 1.25rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

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

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  transition: background-color 0.2s ease;
}

.stat-card.stat-primary::after { background: var(--primary); }
.stat-card.stat-accent::after { background: var(--accent); }
.stat-card.stat-warning::after { background: var(--warning); }
.stat-card.stat-info::after { background: var(--info); }
.stat-card.stat-danger::after { background: var(--danger); }

.stat-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

.stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.stat-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.45rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.stat-card:hover .stat-icon {
  transform: scale(1.05);
}

.icon-purple { background-color: #eef2ff; color: var(--primary); }
.icon-green { background-color: #ecfdf5; color: var(--accent); }
.icon-amber { background-color: #fffbeb; color: var(--warning); }
.icon-rose { background-color: #fef2f2; color: var(--danger); }
.icon-blue { background-color: #f0f9ff; color: var(--info); }

/* ==========================================================================
   Cards & Content Containers
   ========================================================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
  overflow: hidden;
  transition: var(--transition);
}

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

.card-header {
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background-color: #ffffff;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.card-title svg {
  color: var(--primary);
  flex-shrink: 0;
}

.card-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.card-body {
  padding: 1.5rem;
}

/* ==========================================================================
   Tables
   ========================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.custom-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  font-size: 0.88rem;
}

.custom-table th {
  background-color: #f8fafc;
  color: #475569;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.custom-table td {
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-body);
  vertical-align: middle;
}

.custom-table tbody tr {
  transition: background-color 0.15s ease;
}

.custom-table tbody tr:hover {
  background-color: #f8fafc;
}

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

/* ==========================================================================
   Badges & Tags (No Emoji)
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.badge-primary { background-color: var(--primary-light); color: var(--primary); }
.badge-success { background-color: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-warning { background-color: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.badge-danger { background-color: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.badge-info { background-color: #f0f9ff; color: #0369a1; border: 1px solid #bae6fd; }

.badge-purple { background-color: #eef2ff; color: #4338ca; border: 1px solid #c7d2fe; }
.badge-blue { background-color: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.badge-green { background-color: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.badge-amber { background-color: #fffbeb; color: #b45309; border: 1px solid #fde68a; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: var(--transition-fast);
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(67, 56, 202, 0.25);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(67, 56, 202, 0.35);
}

.btn-accent {
  background-color: var(--accent);
  color: #ffffff;
}

.btn-accent:hover {
  background-color: var(--accent-hover);
  color: #ffffff;
}

.btn-danger {
  background-color: var(--danger);
  color: #ffffff;
}

.btn-danger:hover {
  background-color: var(--danger-hover);
  color: #ffffff;
}

.btn-outline {
  background-color: #ffffff;
  border-color: var(--border-color);
  color: var(--text-body);
}

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

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  border-radius: var(--radius-lg);
}

.btn-icon {
  padding: 0.45rem;
  border-radius: var(--radius-md);
}

/* ==========================================================================
   Form Controls
   ========================================================================== */
.form-group {
  margin-bottom: 1.15rem;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  color: var(--text-main);
  transition: var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.15rem;
}

/* ==========================================================================
   CUSTOM POPUP MODAL SYSTEM (ALERT & CONFIRM)
   QUY TẮC BẮT BUỘC: CHỈ ĐÓNG BẰNG NÚT ĐÓNG, CLICK RA NGOÀI KHÔNG TỰ ĐÓNG
   ========================================================================== */
.custom-modal-backdrop,
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(5px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.custom-modal-backdrop.active,
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.custom-modal-container {
  width: 100%;
  max-width: 460px;
  pointer-events: auto;
}

.custom-modal-card {
  background: #ffffff;
  border-radius: var(--radius-2xl);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.6);
  overflow: hidden;
  animation: modalZoomIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: center center;
}

.modal-content {
  background: #ffffff;
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3);
  max-width: 640px;
  width: 100%;
  overflow: hidden;
  animation: modalZoomIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalZoomIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

/* Rung nhẹ khi người dùng click vào vùng backdrop (thông báo không thể đóng bằng cách click ngoài) */
@keyframes shakeModal {
  0%, 100% { transform: scale(1) translateX(0); }
  20%, 60% { transform: scale(1.02) translateX(-8px); }
  40%, 80% { transform: scale(1.02) translateX(8px); }
}

.shake-modal {
  animation: shakeModal 0.4s ease-in-out !important;
}

.custom-modal-header {
  padding: 1.5rem 1.5rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  position: relative;
}

.custom-modal-icon-wrapper {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.custom-modal-icon-wrapper.success {
  background-color: #ecfdf5;
  border: 1px solid #a7f3d0;
}

.custom-modal-icon-wrapper.error,
.custom-modal-icon-wrapper.danger {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
}

.custom-modal-icon-wrapper.warning {
  background-color: #fffbeb;
  border: 1px solid #fde68a;
}

.custom-modal-icon-wrapper.info {
  background-color: #eef2ff;
  border: 1px solid #c7d2fe;
}

.custom-modal-title-box {
  flex: 1;
  min-width: 0;
  padding-right: 1.5rem;
}

.custom-modal-title-box h3 {
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

.custom-modal-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
  margin-top: 3px;
}

.custom-modal-close-btn,
.modal-close {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.custom-modal-close-btn:hover,
.modal-close:hover {
  background-color: #fee2e2;
  color: #ef4444;
  border-color: #fca5a5;
}

.custom-modal-body {
  padding: 0.5rem 1.5rem 1.5rem;
  font-size: 0.92rem;
  color: var(--text-body);
  line-height: 1.6;
}

.custom-modal-footer {
  padding: 1rem 1.5rem;
  background-color: #f8fafc;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

.custom-modal-btn {
  min-width: 110px;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-body {
  padding: 1.5rem;
  max-height: 75vh;
  overflow-y: auto;
}

/* ==========================================================================
   Dashboard Specific Widgets & Components
   ========================================================================== */
.dashboard-grid-2col {
  display: grid;
  grid-template-columns: 2fr 1.2fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.dashboard-attendance-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.strip-item {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
  text-align: center;
  transition: var(--transition-fast);
}

.strip-item:hover {
  border-color: #cbd5e1;
  background-color: #f1f5f9;
}

.strip-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.strip-value {
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.2;
  margin-top: 0.25rem;
}

/* Meal Block Styling */
.meal-block {
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin-bottom: 1rem;
}

.meal-block-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 0.65rem;
  letter-spacing: 0.04em;
}

.meal-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
  color: var(--text-body);
}

.meal-row:last-child {
  margin-bottom: 0;
}

.meal-label-badge {
  color: var(--text-muted);
  font-weight: 600;
  min-width: 90px;
  flex-shrink: 0;
}

.chart-wrapper {
  position: relative;
  width: 100%;
  height: 280px;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
  body {
    background-color: #ffffff !important;
  }
  .sidebar,
  .top-navbar,
  .no-print,
  .alert,
  .custom-modal-backdrop,
  .sidebar-backdrop {
    display: none !important;
  }
  .main-wrapper {
    margin-left: 0 !important;
  }
  .content-area {
    padding: 0 !important;
  }
  .card {
    border: none !important;
    box-shadow: none !important;
  }
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1280px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close-btn {
    display: flex;
  }

  .main-wrapper {
    margin-left: 0;
  }

  .btn-sidebar-toggle {
    display: flex;
  }

  .dashboard-grid-2col {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 768px) {
  .top-navbar {
    padding: 0 1rem;
    height: 64px;
  }

  .content-area {
    padding: 1rem 1rem 2rem;
  }

  .main-title {
    font-size: 1.1rem;
  }

  .breadcrumb-prefix {
    display: none;
  }

  .today-date-badge {
    display: none;
  }

  .user-details-inline {
    display: none;
  }

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

  .dashboard-attendance-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .custom-modal-card {
    border-radius: var(--radius-xl);
  }

  .custom-modal-header {
    padding: 1.25rem 1.25rem 0.75rem;
  }

  .custom-modal-body {
    padding: 0.25rem 1.25rem 1.25rem;
  }

  .custom-modal-footer {
    padding: 0.85rem 1.25rem;
  }
}
