/* ============================================================
   Daffodils School ERP — Main Stylesheet
   Design System: Glassmorphism + Enterprise Dark/Light Mode
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================================
   CSS CUSTOM PROPERTIES (Design Tokens)
   ============================================================ */
:root {
  /* Brand */
  --primary:        #D81B60;
  --primary-dark:   #ad1457;
  --primary-light:  #f48fb1;
  --primary-bg:     #fce4ec;

  /* Semantic */
  --success:        #28A745;
  --success-light:  #d4edda;
  --warning:        #FFC107;
  --warning-light:  #fff3cd;
  --danger:         #DC3545;
  --danger-light:   #f8d7da;
  --info:           #0dcaf0;
  --info-light:     #cff4fc;

  /* Neutrals - Light Mode */
  --bg-body:        #F8F9FA;
  --bg-card:        #ffffff;
  --bg-sidebar:     #1a1a2e;
  --bg-input:       #ffffff;
  --text-primary:   #1a1a2e;
  --text-secondary: #6c757d;
  --text-muted:     #adb5bd;
  --text-sidebar:   #ced4da;
  --border:         #e9ecef;
  --border-light:   #f1f3f4;
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.08);
  --shadow:         0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg:      0 8px 32px rgba(0,0,0,0.12);

  /* Layout */
  --sidebar-width:  260px;
  --topnav-height:  64px;
  --radius-sm:      6px;
  --radius:         10px;
  --radius-lg:      16px;
  --radius-xl:      24px;

  /* Transitions */
  --transition:     all 0.25s cubic-bezier(0.4,0,0.2,1);
}

/* Dark Mode */
[data-theme="dark"] {
  --bg-body:        #0f0f1a;
  --bg-card:        #1a1a2e;
  --bg-sidebar:     #0d0d1a;
  --bg-input:       #252540;
  --text-primary:   #f1f3f4;
  --text-secondary: #adb5bd;
  --text-muted:     #6c757d;
  --border:         #2d2d4e;
  --border-light:   #1e1e38;
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.3);
  --shadow:         0 4px 16px rgba(0,0,0,0.3);
  --shadow-lg:      0 8px 32px rgba(0,0,0,0.4);
  --primary-bg:     rgba(216,27,96,0.15);
}

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

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  transition: var(--transition);
  overflow-x: hidden;
}

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

img { max-width: 100%; height: auto; }

/* ============================================================
   LAYOUT
   ============================================================ */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: var(--transition);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  background: var(--primary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: white;
  font-weight: 800;
  flex-shrink: 0;
}

.sidebar-brand-text {
  overflow: hidden;
}

.sidebar-brand-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  line-height: 1.2;
}

.sidebar-brand-sub {
  font-size: 10px;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.sidebar-nav {
  padding: 12px 0;
  flex: 1;
}

.nav-section-title {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.3);
  padding: 12px 20px 4px;
  margin-top: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: rgba(255,255,255,0.65);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  text-decoration: none;
  border-radius: 0;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255,255,255,0.07);
}

.nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(216,27,96,0.25), rgba(216,27,96,0.05));
  border-left: 3px solid var(--primary);
}

.nav-item .nav-icon {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  font-size: 14px;
}

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

.nav-item.has-sub .nav-arrow {
  margin-left: auto;
  font-size: 10px;
  transition: var(--transition);
}

.nav-item.has-sub.open .nav-arrow { transform: rotate(90deg); }

.nav-sub {
  display: none;
  background: rgba(0,0,0,0.15);
}
.nav-sub.show { display: block; }

.nav-sub .nav-item {
  padding: 7px 20px 7px 44px;
  font-size: 12px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user-info { flex: 1; overflow: hidden; }
.sidebar-user-name { font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 10px; color: rgba(255,255,255,0.45); text-transform: uppercase; letter-spacing: 0.5px; }

/* ============================================================
   TOP NAVIGATION
   ============================================================ */
.topnav {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topnav-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 999;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.topnav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}

.topnav-search {
  flex: 1;
  max-width: 400px;
}

.topnav-search-input {
  width: 100%;
  background: var(--bg-body);
  border: 1px solid var(--border);
  border-radius: 40px;
  padding: 8px 16px 8px 38px;
  font-size: 13px;
  color: var(--text-primary);
  transition: var(--transition);
  outline: none;
}

.topnav-search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

.topnav-search-wrap {
  position: relative;
}

.topnav-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
}

.topnav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.topnav-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  font-size: 16px;
}

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

.topnav-notif-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  background: var(--danger);
  color: white;
  font-size: 9px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-card);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-width);
  padding-top: var(--topnav-height);
  min-height: 100vh;
  transition: var(--transition);
}

.page-content {
  padding: 24px;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb-sep { color: var(--text-muted); }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

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

.card-header {
  padding: 20px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.card-body { padding: 20px 24px; }

.card-footer {
  padding: 12px 24px 16px;
  border-top: 1px solid var(--border);
  background: var(--border-light);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Stat Cards */
.stat-card {
  padding: 20px 24px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--stat-color, var(--primary));
}

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

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 12px;
  background: var(--stat-bg, var(--primary-bg));
  color: var(--stat-color, var(--primary));
}

.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-change {
  font-size: 11px;
  font-weight: 600;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ============================================================
   GLASSMORPHISM
   ============================================================ */
.glass {
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.4);
}

[data-theme="dark"] .glass {
  background: rgba(26,26,46,0.8);
  border-color: rgba(255,255,255,0.08);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  border-radius: var(--radius);
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}

.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-dark); color: white; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(216,27,96,0.35); }

.btn-secondary {
  background: var(--bg-body);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); color: var(--text-primary); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #1e7e34; color: white; transform: translateY(-1px); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #c82333; color: white; transform: translateY(-1px); }

.btn-warning { background: var(--warning); color: #333; }
.btn-warning:hover { background: #e0a800; color: #333; transform: translateY(-1px); }

.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { background: #0aabcf; color: #fff; transform: translateY(-1px); }

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

.btn-sm { padding: 5px 12px; font-size: 11px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn-icon { width: 34px; height: 34px; padding: 0; justify-content: center; }
.btn-icon.btn-sm { width: 28px; height: 28px; }

/* ============================================================
   FORMS
   ============================================================ */
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.form-control, .form-select {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 13px;
  font-size: 13px;
  color: var(--text-primary);
  transition: var(--transition);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

.form-control::placeholder { color: var(--text-muted); }

.form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3e%3cpath fill='%236c757d' d='M6 8L1 3h10z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-group { margin-bottom: 16px; }

.form-text { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.form-error { font-size: 11px; color: var(--danger); margin-top: 4px; }

.input-group {
  display: flex;
  align-items: stretch;
}

.input-group-text {
  padding: 9px 13px;
  background: var(--bg-body);
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  white-space: nowrap;
}

.input-group .form-control {
  border-radius: 0;
  flex: 1;
}

.input-group > :first-child { border-radius: var(--radius) 0 0 var(--radius); }
.input-group > :last-child { border-radius: 0 var(--radius) var(--radius) 0; }

textarea.form-control { resize: vertical; min-height: 80px; }

/* Checkbox & Radio */
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check-input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}
.form-check-label { font-size: 13px; color: var(--text-primary); cursor: pointer; }

/* ============================================================
   DATA TABLES
   ============================================================ */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: var(--bg-body);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 10px 16px;
  white-space: nowrap;
  border-bottom: 2px solid var(--border);
  cursor: pointer;
  user-select: none;
}

thead th:hover { color: var(--primary); }

tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
}

tbody tr:hover { background: var(--border-light); }
tbody tr:last-child { border-bottom: none; }

td {
  padding: 12px 16px;
  color: var(--text-primary);
  vertical-align: middle;
}

.table-actions { display: flex; gap: 6px; }

/* ============================================================
   BADGES / STATUS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.badge-primary   { background: var(--primary-bg); color: var(--primary); }
.badge-success   { background: var(--success-light); color: var(--success); }
.badge-warning   { background: var(--warning-light); color: #856404; }
.badge-danger    { background: var(--danger-light); color: var(--danger); }
.badge-info      { background: var(--info-light); color: #055160; }
.badge-secondary { background: var(--border); color: var(--text-secondary); }

/* Status-specific */
.status-pending   { background: var(--warning-light); color: #856404; }
.status-approved  { background: var(--success-light); color: var(--success); }
.status-rejected  { background: var(--danger-light); color: var(--danger); }
.status-fulfilled { background: var(--info-light); color: #055160; }
.status-paid      { background: var(--success-light); color: var(--success); }
.status-cancelled { background: var(--border); color: var(--text-secondary); }

/* ============================================================
   ALERTS & TOASTS
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}

.alert-success { background: var(--success-light); color: #155724; border-left: 4px solid var(--success); }
.alert-danger   { background: var(--danger-light); color: #721c24; border-left: 4px solid var(--danger); }
.alert-warning  { background: var(--warning-light); color: #856404; border-left: 4px solid var(--warning); }
.alert-info     { background: var(--info-light); color: #0c5460; border-left: 4px solid var(--info); }

/* Toast */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px 20px;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--primary);
  min-width: 300px;
  max-width: 400px;
  animation: toastIn 0.35s cubic-bezier(0.34,1.56,0.64,1);
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.toast.success { border-color: var(--success); }
.toast.error   { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }
.toast.hiding  { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn  { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

/* ============================================================
   MODALS
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-backdrop.show { opacity: 1; visibility: visible; }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9) translateY(20px);
  transition: var(--transition);
}

.modal-backdrop.show .modal { transform: scale(1) translateY(0); }
.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1100px; }

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

.modal-title { font-size: 16px; font-weight: 700; color: var(--text-primary); }

.modal-body { padding: 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
}

.modal-close:hover { background: var(--danger-light); color: var(--danger); }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.page-item {
  display: flex;
}

.page-link {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.page-link:hover { border-color: var(--primary); color: var(--primary); }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); color: white; }
.page-item.disabled .page-link { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
   GRID UTILITIES
   ============================================================ */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-stat { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { flex-direction: column; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }

/* ============================================================
   TYPOGRAPHY UTILITIES
   ============================================================ */
.text-primary   { color: var(--primary) !important; }
.text-success   { color: var(--success) !important; }
.text-danger    { color: var(--danger) !important; }
.text-warning   { color: var(--warning) !important; }
.text-muted     { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.text-sm   { font-size: 12px; }
.text-xs   { font-size: 11px; }
.text-lg   { font-size: 16px; }
.text-xl   { font-size: 20px; }
.truncate  { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* ============================================================
   SPACING UTILITIES
   ============================================================ */
.mb-0 { margin-bottom: 0 !important; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.filter-group { flex: 1; min-width: 160px; }
.filter-group label { font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 5px; display: block; }

/* ============================================================
   LOADING STATES
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--border-light) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: skeleton 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   LOW STOCK ALERT BANNER
   ============================================================ */
.low-stock-banner {
  background: linear-gradient(135deg, #fff3cd, #ffeeba);
  border: 1px solid var(--warning);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  font-size: 13px;
  color: #856404;
}

/* ============================================================
   CHART CONTAINERS
   ============================================================ */
.chart-container { position: relative; height: 280px; }
.chart-container.sm { height: 200px; }
.chart-container.lg { height: 360px; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state-text { font-size: 13px; }

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  .sidebar, .topnav, .topnav-actions, .page-header .btn, .btn-print-hide { display: none !important; }
  .main-content { margin-left: 0 !important; padding-top: 0 !important; }
  .page-content { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd; }
}

/* ============================================================
   MOBILE RESPONSIVE
   ============================================================ */
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 1200;
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1100;
    display: none;
  }
  .sidebar-overlay.show { display: block; }

  .topnav { left: 0; }
  .topnav-toggle { display: flex; }
  .main-content { margin-left: 0; }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-stat { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
}

@media (max-width: 576px) {
  .page-content { padding: 16px; }
  .filter-bar { flex-direction: column; }
  .filter-group { min-width: 100%; }
  .topnav { padding: 0 16px; }
  .topnav-search { display: none; }
  .modal { max-width: 100%; }
}

/* ============================================================
   BILLING POS SPECIFIC
   ============================================================ */
.billing-item-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr 40px;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.billing-item-row:last-child { border-bottom: none; }

.billing-total-box {
  background: var(--bg-body);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
}

.billing-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 14px;
}

.billing-grand-total {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  border-top: 2px solid var(--border);
  padding-top: 10px;
  margin-top: 6px;
}

/* ============================================================
   WHATSAPP BUTTON
   ============================================================ */
.btn-whatsapp {
  background: #25D366;
  color: white;
}
.btn-whatsapp:hover { background: #1da851; color: white; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,211,102,0.35); }

/* ============================================================
   CUSTOM SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn    { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn   { from { transform: translateX(-12px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes pulse     { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes bounceIn  { 0% { transform: scale(0.8); opacity: 0; } 60% { transform: scale(1.05); opacity: 1; } 100% { transform: scale(1); } }

.animate-fade   { animation: fadeIn 0.4s ease; }
.animate-slide  { animation: slideIn 0.3s ease; }
.animate-bounce { animation: bounceIn 0.5s ease; }
