/* ============================================================
   Bootstrap 5 Design System — Admin Kit Shared Styles
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --primary:       #7749F8;
  --primary-dark:  #5227CC;
  --primary-light: #EBE5FC;
  --success:       #28A745;
  --danger:        #DC3545;
  --warning:       #FFC107;
  --info:          #17A2B8;
  --gray-100: #f8f9fa;
  --gray-200: #e9ecef;
  --gray-300: #dee2e6;
  --gray-400: #ced4da;
  --gray-500: #adb5bd;
  --gray-600: #6c757d;
  --gray-700: #495057;
  --gray-800: #343a40;
  --fg1: #152536;
  --fg3: #68717a;
  --sidebar-w: 240px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: var(--gray-100); color: var(--fg3); min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0; height: 100vh;
  width: var(--sidebar-w); background: #fff;
  border-right: 1px solid var(--gray-300);
  display: flex; flex-direction: column; z-index: 100;
}
.sidebar-brand {
  padding: 18px 20px 14px; border-bottom: 1px solid var(--gray-300);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-brand .b-icon {
  width: 32px; height: 32px; background: var(--primary); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 16px; flex-shrink: 0;
}
.sidebar-brand .b-name  { font-size: 15px; font-weight: 700; color: var(--fg1); line-height: 1.1; }
.sidebar-brand .b-sub   { font-size: 9px; color: var(--gray-500); font-weight: 500; text-transform: uppercase; letter-spacing: 0.4px; }
.sidebar-nav  { flex: 1; overflow-y: auto; padding: 10px; }
.nav-section  { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--gray-500); padding: 12px 12px 4px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--gray-700);
  text-decoration: none; transition: background 0.13s, color 0.13s; white-space: nowrap;
}
.nav-link:hover { background: var(--gray-100); color: var(--fg1); }
.nav-link.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-link i { font-size: 16px; width: 20px; flex-shrink: 0; }
.nav-badge { margin-left: auto; background: var(--primary); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 50rem; }

/* ── Main area ───────────────────────────────────────── */
.main  { margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }

/* ── Topbar ──────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 90; height: 56px; background: #fff;
  border-bottom: 1px solid var(--gray-300);
  display: flex; align-items: center; gap: 14px; padding: 0 24px;
}
.topbar-title { font-size: 17px; font-weight: 700; color: var(--fg1); }
.topbar-search {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  background: var(--gray-100); border: 1px solid var(--gray-300);
  border-radius: 8px; padding: 6px 14px; width: 220px;
}
.topbar-search input { border: none; background: transparent; font-family: 'Inter',sans-serif; font-size: 13px; color: var(--fg1); outline: none; width: 100%; }
.topbar-search i { color: var(--gray-500); font-size: 13px; flex-shrink: 0; }
.topbar-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 13px; cursor: pointer; flex-shrink: 0; }

/* ── Page content ────────────────────────────────────── */
.content { padding: 24px; flex: 1; }
.page-header { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 800; color: var(--fg1); }

/* ── Stat cards ──────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: 12px; border: 1px solid var(--gray-300); padding: 20px 22px; }
.stat-icon  { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; margin-bottom: 12px; }
.stat-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--gray-600); margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--fg1); line-height: 1; margin-bottom: 6px; }
.stat-change { font-size: 12px; font-weight: 600; }
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ── Cards ───────────────────────────────────────────── */
.card { background: #fff; border-radius: 12px; border: 1px solid var(--gray-300); overflow: hidden; }
.card-header { padding: 14px 20px; border-bottom: 1px solid var(--gray-300); display: flex; align-items: center; gap: 12px; }
.card-header h2 { font-size: 15px; font-weight: 700; color: var(--fg1); }
.card-body { padding: 20px; }

/* ── Tables ──────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--gray-600); background: var(--gray-100); padding: 10px 16px; border-bottom: 1px solid var(--gray-300); text-align: left; white-space: nowrap; }
.data-table td { padding: 12px 16px; font-size: 13px; color: var(--gray-700); border-bottom: 1px solid #f0f2f4; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: #fafbff; }

/* ── Badges ──────────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 50rem; font-size: 11px; font-weight: 700; white-space: nowrap; }
.badge-success  { background: #d4edda; color: #155724; }
.badge-warning  { background: #fff3cd; color: #856404; }
.badge-danger   { background: #f8d7da; color: #721c24; }
.badge-primary  { background: var(--primary-light); color: var(--primary); }
.badge-info     { background: #d1ecf1; color: #0c5460; }
.badge-muted    { background: var(--gray-200); color: var(--gray-700); }

/* ── Buttons ─────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; border: none; border-radius: 6px; font-family: 'Inter',sans-serif; font-weight: 700; cursor: pointer; transition: background 0.13s, border-color 0.13s; white-space: nowrap; }
.btn-primary  { background: var(--primary); color: #fff; padding: 9px 18px; font-size: 14px; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--gray-200); color: var(--fg1); padding: 9px 18px; font-size: 14px; }
.btn-secondary:hover { background: var(--gray-300); }
.btn-danger   { background: var(--danger); color: #fff; padding: 9px 18px; font-size: 14px; }
.btn-outline  { background: transparent; color: var(--gray-700); border: 1px solid var(--gray-300); padding: 8px 16px; font-size: 13px; }
.btn-outline:hover { background: var(--gray-100); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { padding: 7px; border-radius: 7px; }

/* ── Forms ───────────────────────────────────────────── */
.form-label { font-size: 13px; font-weight: 600; color: var(--fg1); display: block; margin-bottom: 5px; }
.form-control { display: block; width: 100%; padding: 9px 13px; border: 1px solid var(--gray-300); border-radius: 6px; font-family: 'Inter',sans-serif; font-size: 14px; color: var(--fg1); outline: none; transition: border-color 0.13s, box-shadow 0.13s; background: #fff; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(119,73,248,0.15); }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23adb5bd' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 12px center; background-size: 12px; padding-right: 36px; }
.form-hint { font-size: 12px; color: var(--gray-500); margin-top: 4px; }

/* ── Progress bar ────────────────────────────────────── */
.progress { background: var(--gray-200); border-radius: 50rem; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 50rem; }

/* ── Avatar ──────────────────────────────────────────── */
.avatar { border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; flex-shrink: 0; }

/* ── Notification item ───────────────────────────────── */
.notif-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f0f2f4; }
.notif-item:last-child { border-bottom: none; }
.notif-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.notif-title { font-size: 13px; font-weight: 600; color: var(--fg1); }
.notif-time  { font-size: 11px; color: var(--gray-500); margin-top: 2px; }

/* ── Divider ─────────────────────────────────────────── */
.divider { height: 1px; background: var(--gray-300); margin: 16px 0; border: none; }

/* ── Utility ─────────────────────────────────────────── */
.text-muted  { color: var(--gray-600) !important; }
.text-small  { font-size: 12px; }
.fw-bold     { font-weight: 700; }
.d-flex      { display: flex; }
.align-center { align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.ml-auto { margin-left: auto; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

/* ── Modal ───────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  z-index: 500; display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  transform: translateY(20px); transition: transform 0.2s;
  max-height: 90vh; overflow-y: auto; margin: 20px;
}
.modal-backdrop.open .modal { transform: translateY(0); }
.modal-header { padding: 20px 24px 0; display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 17px; font-weight: 700; color: var(--fg1); }
.modal-close { background: none; border: none; cursor: pointer; width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: var(--gray-500); font-size: 18px; }
.modal-close:hover { background: var(--gray-100); color: var(--fg1); }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 0 24px 20px; display: flex; gap: 8px; justify-content: flex-end; }

/* ── Dropdown ────────────────────────────────────────── */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 180px;
  background: #fff; border: 1px solid var(--gray-300); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.10); z-index: 200; padding: 6px;
  opacity: 0; pointer-events: none; transform: translateY(-6px); transition: opacity 0.15s, transform 0.15s;
}
.dropdown-menu.open { opacity: 1; pointer-events: all; transform: translateY(0); }
.dropdown-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--gray-700);
  cursor: pointer; border: none; background: none; width: 100%; text-align: left; font-family: 'Inter',sans-serif;
}
.dropdown-item:hover { background: var(--gray-100); color: var(--fg1); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: #fff5f5; }
.dropdown-divider { height: 1px; background: var(--gray-200); margin: 4px 0; }

/* ── Toast ───────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 600;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
  background: #fff; border: 1px solid var(--gray-300); border-radius: 10px;
  padding: 14px 16px; min-width: 300px; max-width: 380px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  display: flex; align-items: flex-start; gap: 12px; pointer-events: all;
  transform: translateX(120%); transition: transform 0.3s cubic-bezier(0.34,1.3,0.64,1);
}
.toast.show { transform: translateX(0); }
.toast.hide { transform: translateX(120%); }
.toast-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.toast-title { font-size: 13px; font-weight: 700; color: var(--fg1); margin-bottom: 2px; }
.toast-msg   { font-size: 12px; color: var(--gray-600); line-height: 1.4; }
.toast-close { margin-left: auto; background: none; border: none; cursor: pointer; color: var(--gray-500); font-size: 16px; padding: 0; flex-shrink: 0; }
.toast-progress { height: 3px; border-radius: 0 0 10px 10px; position: absolute; bottom: 0; left: 0; transition: width linear; }

/* ── Mobile hamburger ────────────────────────────────── */
.hamburger { display: none; background: none; border: none; cursor: pointer; padding: 6px; border-radius: 6px; color: var(--fg1); font-size: 20px; }
.hamburger:hover { background: var(--gray-100); }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 99; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%); transition: transform 0.25s;
    z-index: 200;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-overlay.active { display: block; }
  .main { margin-left: 0; }
  .hamburger { display: flex; align-items: center; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .stat-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
  .content { padding: 16px; }
  .topbar-search { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .modal { margin: 12px; }
}
