/* ============================================================
   Enterprise Office Supplies System - Main Stylesheet
   Font: Sarabun | Theme: Navy Blue / White / Gray
   ============================================================ */

:root {
  --navy:     #1a2b4a;
  --navy-dark:#0f1a2e;
  --navy-mid: #2d4a7a;
  --accent:   #2563eb;
  --sidebar-w: 260px;
  --topbar-h:  60px;
  --border:   #e5e7eb;
  --bg:       #f4f6fa;
  --text:     #1f2937;
  --muted:    #6b7280;
  --orange:   #f97316;
}

/* ============================================================ Base */
* { box-sizing: border-box; }
body {
  font-family: 'Sarabun', 'Noto Sans Thai', sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  margin: 0;
}

/* ============================================================ Sidebar */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 1040;
  transition: transform .3s ease;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.sidebar-logo {
  width: 40px; height: 40px;
  background: rgba(255,255,255,.1);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-user {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.sidebar-avatar {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}

.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.sidebar-section {
  padding: 12px 16px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.35);
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font-size: 14px;
  border-radius: 0;
  transition: all .15s;
  cursor: pointer;
}
.sidebar-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-link.active { background: var(--accent); color: #fff; }
.sidebar-link i { width: 18px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  padding: 8px 0;
  border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}

/* ============================================================ Main */
.main-wrapper {
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin .3s ease;
}

/* ============================================================ Topbar */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

/* ============================================================ Content */
.page-content {
  padding: 24px;
  flex: 1;
}
.page-header {
  margin-bottom: 20px;
}
.page-header h4 {
  font-weight: 700;
  font-size: 1.25rem;
  margin-bottom: 4px;
}

/* ============================================================ KPI Card */
.kpi-card { transition: transform .2s; }
.kpi-card:hover { transform: translateY(-2px); }

/* ============================================================ Notification Dropdown */
.notif-dropdown { border: 1px solid var(--border); border-radius: 12px; }

/* ============================================================ Tables */
.table th { font-weight: 600; font-size: 13px; }
.table td { font-size: 14px; }

/* ============================================================ Badges - custom orange */
.bg-orange { background-color: var(--orange) !important; color: #fff; }
.text-orange { color: var(--orange) !important; }
.btn-outline-orange { color: var(--orange); border-color: var(--orange); }
.btn-outline-orange:hover { background: var(--orange); color: #fff; }

/* ============================================================ Cards */
.card { border-radius: 12px; }
.card-header { border-radius: 12px 12px 0 0 !important; }

/* ============================================================ Sidebar Overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1039;
}
.sidebar-overlay.show { display: block; }

/* ============================================================ Toast */
.toast { border-radius: 10px; font-family: 'Sarabun', sans-serif; }

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

/* ============================================================ Responsive */
@media (max-width: 1199.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
}

@media (max-width: 767.98px) {
  .page-content { padding: 16px; }
  .table th, .table td { white-space: nowrap; }
}

/* ============================================================ Dark Mode */
[data-bs-theme="dark"] {
  --bg: #111827;
  --text: #f9fafb;
  --border: #374151;
}
[data-bs-theme="dark"] .topbar { background: #1f2937; border-color: #374151; }
[data-bs-theme="dark"] .card { background: #1f2937; border-color: #374151 !important; }
[data-bs-theme="dark"] .table { --bs-table-bg: #1f2937; --bs-table-hover-bg: #374151; }

/* ============================================================ Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
