/* ============================================================
   MediSync - Main Stylesheet
   Clean, professional medical UI
   ============================================================ */

:root {
  /* Brand Colors */
  --primary:        #0ea5e9;
  --primary-dark:   #0284c7;
  --primary-light:  #e0f2fe;
  --secondary:      #6366f1;
  --accent:         #06b6d4;

  /* Semantic Colors */
  --success:        #10b981;
  --success-light:  #d1fae5;
  --warning:        #f59e0b;
  --warning-light:  #fef3c7;
  --danger:         #ef4444;
  --danger-light:   #fee2e2;
  --info:           #3b82f6;
  --info-light:     #dbeafe;

  /* Neutrals */
  --white:          #ffffff;
  --gray-50:        #f8fafc;
  --gray-100:       #f1f5f9;
  --gray-200:       #e2e8f0;
  --gray-300:       #cbd5e1;
  --gray-400:       #94a3b8;
  --gray-500:       #64748b;
  --gray-600:       #475569;
  --gray-700:       #334155;
  --gray-800:       #1e293b;
  --gray-900:       #0f172a;

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

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow:     0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg:  0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
  --shadow-xl:  0 20px 25px -5px rgba(0,0,0,.1), 0 10px 10px -5px rgba(0,0,0,.04);

  /* Transitions */
  --transition: all .2s ease;
  --transition-slow: all .35s cubic-bezier(.4,0,.2,1);
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body { font-family: 'Plus Jakarta Sans', sans-serif; background: var(--gray-50); color: var(--gray-800); line-height: 1.6; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-width); height: 100vh;
  background: var(--gray-900);
  display: flex; flex-direction: column;
  z-index: 1000; overflow: hidden;
  transition: var(--transition-slow);
}

.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,.07);
}

.sidebar-logo { display: flex; align-items: center; gap: 12px; }
.logo-icon {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 18px; flex-shrink: 0;
}
.logo-name { display: block; font-size: 1.05rem; font-weight: 700; color: white; line-height: 1.2; }
.logo-tagline { display: block; font-size: .68rem; color: var(--gray-400); text-transform: uppercase; letter-spacing: .06em; }

.sidebar-toggle { color: var(--gray-400); font-size: 16px; padding: 6px; border-radius: var(--radius-sm); transition: var(--transition); }
.sidebar-toggle:hover { color: white; background: rgba(255,255,255,.08); }

.sidebar-user {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid rgba(255,255,255,.07);
}
.user-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: .85rem; flex-shrink: 0;
}
.user-name { display: block; font-size: .85rem; font-weight: 600; color: white; line-height: 1.2; }
.user-role { display: inline-block; font-size: .65rem; padding: 2px 8px; border-radius: 20px; text-transform: uppercase; letter-spacing: .05em; margin-top: 3px; }
.badge-role-admin { background: rgba(239,68,68,.2); color: #fca5a5; }
.badge-role-doctor { background: rgba(14,165,233,.2); color: #7dd3fc; }
.badge-role-nurse { background: rgba(16,185,129,.2); color: #6ee7b7; }
.badge-role-receptionist { background: rgba(99,102,241,.2); color: #a5b4fc; }
.badge-role-pharmacist { background: rgba(245,158,11,.2); color: #fcd34d; }
.badge-role-lab_technician { background: rgba(6,182,212,.2); color: #67e8f9; }
.badge-role-accountant { background: rgba(168,85,247,.2); color: #d8b4fe; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

.nav-section { margin-bottom: 4px; }
.nav-label { display: block; font-size: .62rem; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .1em; padding: 10px 18px 4px; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 18px; color: var(--gray-400); font-size: .875rem; font-weight: 500;
  border-radius: 0; transition: var(--transition); border-left: 3px solid transparent;
  position: relative;
}
.nav-item:hover { color: white; background: rgba(255,255,255,.05); }
.nav-item.active { color: white; background: rgba(14,165,233,.12); border-left-color: var(--primary); }
.nav-item i { width: 18px; text-align: center; font-size: .95rem; flex-shrink: 0; }

/* ============================================================
   MAIN WRAPPER & TOPBAR
   ============================================================ */
.main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex; flex-direction: column;
  transition: var(--transition-slow);
}

.topbar {
  position: sticky; top: 0; z-index: 900;
  height: var(--topbar-height);
  background: white;
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; gap: 16px;
  box-shadow: var(--shadow-sm);
}

.topbar-left { display: flex; align-items: center; gap: 16px; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.breadcrumb-area { display: flex; align-items: center; gap: 6px; font-size: .85rem; }
.breadcrumb-item { color: var(--gray-400); }
.breadcrumb-item.active { color: var(--gray-700); font-weight: 600; }
.breadcrumb-item:not(.active):hover { color: var(--primary); }
.breadcrumb-sep { color: var(--gray-300); }

.topbar-search {
  position: relative; display: flex; align-items: center;
  background: var(--gray-100); border-radius: var(--radius);
  padding: 0 14px; gap: 10px; flex: 1; max-width: 380px;
}
.topbar-search i { color: var(--gray-400); font-size: .85rem; }
.topbar-search input {
  background: none; border: none; outline: none;
  font-size: .875rem; color: var(--gray-700); width: 100%; padding: 10px 0;
}

.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: white; border-radius: var(--radius); box-shadow: var(--shadow-xl);
  border: 1px solid var(--gray-200); max-height: 360px; overflow-y: auto;
  display: none; z-index: 1100;
}
.search-results.visible { display: block; }
.search-result-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; font-size: .85rem; color: var(--gray-700);
  transition: var(--transition);
}
.search-result-item:hover { background: var(--gray-50); }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* ============================================================
   PAGE CONTENT
   ============================================================ */
.page-content { flex: 1; padding: 24px; }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-header-left h1 { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); line-height: 1.2; }
.page-header-left p { font-size: .875rem; color: var(--gray-500); margin-top: 4px; }
.page-header-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: white; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); border: 1px solid var(--gray-200);
  overflow: hidden;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--gray-100);
}
.card-title { font-size: 1rem; font-weight: 700; color: var(--gray-800); }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--gray-100); background: var(--gray-50); }

/* Stat Cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }

.stat-card {
  background: white; border-radius: var(--radius-lg);
  padding: 20px; border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm); display: flex; gap: 16px; align-items: center;
  transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-icon {
  width: 52px; height: 52px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; flex-shrink: 0;
}
.stat-icon.blue   { background: var(--primary-light); color: var(--primary); }
.stat-icon.green  { background: var(--success-light); color: var(--success); }
.stat-icon.yellow { background: var(--warning-light); color: var(--warning); }
.stat-icon.red    { background: var(--danger-light); color: var(--danger); }
.stat-icon.purple { background: #ede9fe; color: var(--secondary); }
.stat-icon.cyan   { background: #cffafe; color: var(--accent); }

.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--gray-900); line-height: 1; }
.stat-label { font-size: .8rem; color: var(--gray-500); margin-top: 4px; }
.stat-change { font-size: .75rem; margin-top: 6px; }
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 600; line-height: 1;
  transition: var(--transition); white-space: nowrap; cursor: pointer; border: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn i { font-size: .85rem; }

.btn-primary   { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-200); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-success   { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-danger    { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-warning   { background: var(--warning); color: white; }
.btn-outline   { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-ghost     { background: transparent; color: var(--gray-600); }
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-800); }

.btn-sm { padding: 6px 14px; font-size: .8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-icon { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); transition: var(--transition); color: var(--gray-500); font-size: .95rem; }
.btn-icon:hover { background: var(--gray-100); color: var(--gray-700); }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: .85rem; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%; padding: 9px 14px; font-size: .875rem; font-family: inherit;
  border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm);
  background: white; color: var(--gray-800); transition: var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.form-control:disabled { background: var(--gray-100); color: var(--gray-400); }
.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-valid { border-color: var(--success); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }

.form-row { display: grid; gap: 16px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row.cols-4 { grid-template-columns: repeat(4, 1fr); }

.form-hint { font-size: .75rem; color: var(--gray-400); margin-top: 4px; }
.form-error { font-size: .75rem; color: var(--danger); margin-top: 4px; }

.input-group { position: relative; display: flex; }
.input-group .form-control { border-radius: 0; flex: 1; }
.input-group .input-group-text { display: flex; align-items: center; padding: 0 12px; background: var(--gray-100); border: 1.5px solid var(--gray-200); font-size: .85rem; color: var(--gray-500); }
.input-group .input-group-text:first-child { border-right: none; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .input-group-text:last-child { border-left: none; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-group .form-control:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .form-control:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* ============================================================
   TABLES
   ============================================================ */
.table-container { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th { padding: 12px 16px; font-weight: 600; color: var(--gray-600); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; background: var(--gray-50); border-bottom: 1px solid var(--gray-200); text-align: left; white-space: nowrap; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--gray-50); }
.table-striped tbody tr:nth-child(even) { background: var(--gray-50); }

/* ============================================================
   BADGES & PILLS
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
.badge-primary   { background: var(--primary-light); color: var(--primary-dark); }
.badge-success   { background: var(--success-light); color: #065f46; }
.badge-warning   { background: var(--warning-light); color: #92400e; }
.badge-danger    { background: var(--danger-light); color: #991b1b; }
.badge-info      { background: var(--info-light); color: #1e40af; }
.badge-secondary { background: var(--gray-100); color: var(--gray-600); }
.badge-purple    { background: #ede9fe; color: #5b21b6; }
.badge-cyan      { background: #cffafe; color: #155e75; }

/* ============================================================
   FLASH / ALERTS
   ============================================================ */
.flash-message {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; margin: 0 24px 16px; border-radius: var(--radius);
  font-size: .875rem; font-weight: 500; animation: slideDown .3s ease;
  position: relative;
}
.flash-success { background: var(--success-light); color: #065f46; border: 1px solid #a7f3d0; }
.flash-danger  { background: var(--danger-light); color: #991b1b; border: 1px solid #fca5a5; }
.flash-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fcd34d; }
.flash-info    { background: var(--info-light); color: #1e40af; border: 1px solid #93c5fd; }
.flash-close { margin-left: auto; color: inherit; opacity: .5; font-size: .85rem; }
.flash-close:hover { opacity: 1; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 2000; display: none; align-items: center; justify-content: center;
  padding: 16px; backdrop-filter: blur(4px);
}
.modal-backdrop.active { display: flex; animation: fadeIn .2s ease; }
.modal {
  background: white; border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl); max-height: 90vh; overflow-y: auto;
  width: 100%; animation: slideUp .25s ease;
}
.modal-sm { max-width: 480px; }
.modal-md { max-width: 680px; }
.modal-lg { max-width: 880px; }
.modal-xl { max-width: 1100px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--gray-200); }
.modal-title { font-size: 1.05rem; font-weight: 700; color: var(--gray-900); }
.modal-close { color: var(--gray-400); font-size: 1.1rem; padding: 6px; border-radius: var(--radius-sm); transition: var(--transition); }
.modal-close:hover { background: var(--gray-100); color: var(--gray-700); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: 10px; }

/* ============================================================
   TABS
   ============================================================ */
.tabs { display: flex; border-bottom: 2px solid var(--gray-200); gap: 0; margin-bottom: 24px; overflow-x: auto; }
.tab-btn { padding: 10px 20px; font-size: .875rem; font-weight: 600; color: var(--gray-500); border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; transition: var(--transition); }
.tab-btn:hover { color: var(--gray-700); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============================================================
   FILTERS / SEARCH BAR
   ============================================================ */
.filters-bar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.filter-search { position: relative; flex: 1; min-width: 200px; }
.filter-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--gray-400); font-size: .85rem; }
.filter-search input { padding-left: 36px; width: 100%; }
.filter-select { min-width: 150px; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pagination-info { font-size: .8rem; color: var(--gray-500); margin-right: auto; }
.page-link { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: var(--radius-sm); font-size: .85rem; color: var(--gray-600); border: 1px solid var(--gray-200); transition: var(--transition); }
.page-link:hover { background: var(--gray-100); }
.page-link.active { background: var(--primary); color: white; border-color: var(--primary); font-weight: 700; }
.page-link.disabled { opacity: .4; cursor: not-allowed; }

/* ============================================================
   NOTIFICATIONS
   ============================================================ */
.notif-wrapper { position: relative; }
.notif-badge { position: absolute; top: 2px; right: 2px; background: var(--danger); color: white; font-size: .6rem; font-weight: 700; min-width: 16px; height: 16px; border-radius: 10px; display: flex; align-items: center; justify-content: center; padding: 0 3px; }
.notif-dropdown { position: absolute; right: 0; top: calc(100% + 8px); width: 340px; background: white; border-radius: var(--radius-lg); box-shadow: var(--shadow-xl); border: 1px solid var(--gray-200); display: none; z-index: 1100; overflow: hidden; }
.notif-dropdown.open { display: block; animation: slideDown .2s ease; }
.notif-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--gray-100); font-weight: 700; font-size: .9rem; }
.notif-clear { font-size: .8rem; color: var(--primary); font-weight: 500; }
.notif-list { max-height: 340px; overflow-y: auto; }
.notif-item { display: flex; gap: 12px; padding: 12px 16px; transition: var(--transition); border-bottom: 1px solid var(--gray-100); }
.notif-item:hover { background: var(--gray-50); }
.notif-icon { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: .8rem; }
.notif-info    .notif-icon { background: var(--info-light); color: var(--info); }
.notif-warning .notif-icon { background: var(--warning-light); color: var(--warning); }
.notif-danger  .notif-icon { background: var(--danger-light); color: var(--danger); }
.notif-success .notif-icon { background: var(--success-light); color: var(--success); }
.notif-content strong { display: block; font-size: .82rem; font-weight: 700; color: var(--gray-800); }
.notif-content p { font-size: .78rem; color: var(--gray-500); }
.notif-content time { font-size: .72rem; color: var(--gray-400); }
.notif-empty { padding: 32px 16px; text-align: center; color: var(--gray-400); font-size: .85rem; }

/* ============================================================
   USER DROPDOWN
   ============================================================ */
.user-menu-wrapper { position: relative; }
.user-menu-btn { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: var(--radius); transition: var(--transition); font-size: .875rem; font-weight: 600; color: var(--gray-700); }
.user-menu-btn:hover { background: var(--gray-100); }
.avatar-sm { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--secondary)); display: flex; align-items: center; justify-content: center; color: white; font-weight: 700; font-size: .72rem; flex-shrink: 0; }
.user-dropdown { position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px; background: white; border-radius: var(--radius-lg); box-shadow: var(--shadow-xl); border: 1px solid var(--gray-200); padding: 8px; z-index: 1100; display: none; }
.user-dropdown.open { display: block; animation: slideDown .2s ease; }
.user-dropdown a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; font-size: .85rem; color: var(--gray-700); border-radius: var(--radius-sm); transition: var(--transition); }
.user-dropdown a:hover { background: var(--gray-100); }
.user-dropdown a.text-danger { color: var(--danger); }
.user-dropdown hr { border: none; border-top: 1px solid var(--gray-100); margin: 6px 0; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state { padding: 60px 20px; text-align: center; }
.empty-state i { font-size: 3rem; color: var(--gray-300); margin-bottom: 16px; }
.empty-state h3 { font-size: 1.1rem; color: var(--gray-600); margin-bottom: 8px; }
.empty-state p { font-size: .875rem; color: var(--gray-400); }

/* ============================================================
   LOADING SPINNER
   ============================================================ */
.spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--gray-200); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
.spinner-lg { width: 40px; height: 40px; border-width: 3px; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn    { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp   { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin      { to { transform: rotate(360deg); } }

/* ============================================================
   UTILITIES
   ============================================================ */
.text-primary  { color: var(--primary); }
.text-success  { color: var(--success); }
.text-danger   { color: var(--danger); }
.text-warning  { color: var(--warning); }
.text-muted    { color: var(--gray-400); }
.text-sm       { font-size: .8rem; }
.text-xs       { font-size: .72rem; }
.fw-bold       { font-weight: 700; }
.fw-semi       { font-weight: 600; }
.d-flex        { display: flex; }
.align-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8         { gap: 8px; }
.gap-12        { gap: 12px; }
.gap-16        { gap: 16px; }
.mt-8          { margin-top: 8px; }
.mt-16         { margin-top: 16px; }
.mt-24         { margin-top: 24px; }
.mb-16         { margin-bottom: 16px; }
.mb-24         { margin-bottom: 24px; }
.p-0           { padding: 0; }
.overflow-hidden { overflow: hidden; }
.w-100         { width: 100%; }
.text-center   { text-align: center; }
.text-right    { text-align: right; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.divider { border: none; border-top: 1px solid var(--gray-200); margin: 16px 0; }

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

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  :root { --sidebar-width: var(--sidebar-collapsed); }
  .logo-text, .user-info, .nav-item span, .nav-label { display: none; }
  .sidebar-header { justify-content: center; }
  .sidebar-user { justify-content: center; }
  .nav-item { justify-content: center; padding: 10px; }
  .main-wrapper { margin-left: var(--sidebar-collapsed); }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-width) !important; }
  .sidebar.mobile-open { transform: translateX(0); }
  .logo-text, .user-info, .nav-item span, .nav-label { display: block !important; }
  .sidebar-header { justify-content: space-between !important; }
  .sidebar-user { justify-content: flex-start !important; }
  .nav-item { justify-content: flex-start !important; padding: 9px 18px !important; }
  .main-wrapper { margin-left: 0 !important; }
  .form-row.cols-2, .form-row.cols-3, .form-row.cols-4 { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .topbar-search { display: none; }
  .page-content { padding: 16px; }
}
