/* ============================================================
   Document Tracking System — style.css
   Theme: Navy Blue & Slate — Clean Government UI
   ============================================================ */

/* ---- RESET & VARIABLES ----------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue-900: #0D1B2A;
  --blue-800: #1565C0;
  --blue-700: #1976D2;
  --blue-600: #1E88E5;
  --blue-100: #E3F2FD;
  --blue-50:  #F0F7FF;

  --slate-900: #1A1F2E;
  --slate-700: #37474F;
  --slate-500: #607D8B;
  --slate-300: #B0BEC5;
  --slate-100: #ECEFF1;
  --slate-50:  #F5F7FA;

  --green:  #2E7D32;
  --green-bg: #E8F5E9;
  --amber:  #E65100;
  --amber-bg: #FFF3E0;
  --red:    #C62828;
  --red-bg: #FFEBEE;

  --sidebar-w: 260px;
  --topbar-h:  64px;
  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 4px 24px rgba(13,27,42,0.08);
  --shadow-lg: 0 8px 40px rgba(13,27,42,0.14);
  --transition: 0.2s cubic-bezier(0.4,0,0.2,1);

  --font-body: 'IBM Plex Sans Thai', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--slate-50);
  color: var(--slate-900);
  min-height: 100vh;
  display: flex;
  font-size: 15px;
  line-height: 1.6;
}

/* ---- SIDEBAR --------------------------------------------- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--blue-900);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 200;
  transition: transform var(--transition);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--blue-600), var(--blue-800));
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #fff;
  flex-shrink: 0;
}

.brand-title { font-size: 18px; font-weight: 700; color: #fff; display: block; }
.brand-sub   { font-size: 11px; color: var(--slate-300); display: block; margin-top: 2px; }

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: var(--slate-300);
  text-decoration: none;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  transition: all var(--transition);
}

.nav-item i { width: 18px; text-align: center; font-size: 15px; }

.nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: #fff;
}

.nav-item.active {
  background: var(--blue-700);
  color: #fff;
  box-shadow: 0 2px 12px rgba(30,136,229,0.35);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px;
}

.user-name { font-weight: 600; color: #fff; font-size: 13px; }
.user-role { font-size: 11px; color: var(--slate-300); }

/* ---- MAIN LAYOUT ----------------------------------------- */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- TOPBAR ---------------------------------------------- */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--slate-100);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 8px rgba(0,0,0,0.04);
}

.hamburger {
  display: none;
  background: none; border: none;
  font-size: 20px; cursor: pointer;
  color: var(--slate-700);
  padding: 6px;
  border-radius: 6px;
}

.topbar-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--slate-900);
  flex: 1;
}

.clock {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--slate-500);
  background: var(--slate-100);
  padding: 4px 12px;
  border-radius: 20px;
}

/* ---- PAGE ------------------------------------------------- */
.page {
  display: none;
  padding: 28px 32px;
  animation: fadeIn 0.25s ease;
}
.page.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; } }

/* ---- STATS ----------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  border-left: 4px solid transparent;
}

.stat-card[data-color="blue"]  { border-left-color: var(--blue-700); }
.stat-card[data-color="green"] { border-left-color: var(--green); }
.stat-card[data-color="amber"] { border-left-color: var(--amber); }

.stat-value {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--font-mono);
}

/* ---- FORMS & INPUTS -------------------------------------- */
input, select, textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--slate-100);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: all var(--transition);
}

input:focus { border-color: var(--blue-600); box-shadow: 0 0 0 3px rgba(30,136,229,0.1); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
}

.btn-primary { background: var(--blue-700); color: #fff; }
.btn-primary:hover { background: var(--blue-800); transform: translateY(-1px); }

/* ---- LOADING OVERLAY ------------------------------------- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13,27,42,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.spinner {
  width: 48px; height: 48px;
  border: 4px solid rgba(255,255,255,0.1);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- UTILITIES ------------------------------------------- */
.hidden { display: none !important; }

/* Responsive */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .hamburger { display: block; }
}