/* ============================================
   SMART MBG TRACKER - Main Stylesheet
   Clean, Responsive, Light/Dark Mode
   Optimized for Laptop & Mobile Friendly
   ============================================ */

/* --- CSS Variables --- */
:root {
  --bg-body: #f0fdf4;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-input: #ffffff;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border-color: #e5e7eb;
  --accent-green: #15803d;
  --accent-green-light: #dcfce7;
  --accent-green-hover: #166534;
  --accent-red: #dc2626;
  --accent-red-light: #fee2e2;
  --accent-yellow: #ca8a04;
  --accent-yellow-light: #fef9c3;
  --accent-blue: #2563eb;
  --accent-blue-light: #dbeafe;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.05), 0 4px 6px -4px rgba(0,0,0,0.05);
  --radius: 10px;
  --radius-lg: 14px;
  --sidebar-width: 260px;
  --header-height: 64px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-body: #111827;
  --bg-card: #1f2937;
  --bg-sidebar: #1f2937;
  --bg-input: #374151;
  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
  --text-muted: #9ca3af;
  --border-color: #374151;
  --accent-green: #22c55e;
  --accent-green-light: #14532d;
  --accent-green-hover: #16a34a;
  --accent-red: #ef4444;
  --accent-red-light: #450a0a;
  --accent-yellow: #eab308;
  --accent-yellow-light: #422006;
  --accent-blue: #3b82f6;
  --accent-blue-light: #1e3a5f;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.3), 0 4px 6px -4px rgba(0,0,0,0.3);
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.5;
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent-green);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  text-decoration: none;
  opacity: 0.85;
}

/* --- Layout --- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 1000;
  transition: var(--transition);
  overflow-y: auto;
  box-shadow: 5px 0 20px rgba(0,0,0,.03);
}

.sidebar-brand {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: var(--accent-green);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
  flex-shrink: 0;
}

.brand-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -.3px;
}

.brand-text span {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.sidebar-user {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  background: var(--accent-green-light);
  color: var(--accent-green);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: capitalize;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 12px;
  list-style: none;
}

.nav-item {
  margin-bottom: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
  text-decoration: none;
}

.nav-link:hover {
  background: var(--accent-green-light);
  color: var(--accent-green);
}

.nav-link.active {
  background: var(--accent-green);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(21,128,61,.2);
}

.nav-link.active:hover {
  background: var(--accent-green-hover);
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
}

.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px;
  background: var(--accent-red-light);
  color: var(--accent-red);
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.btn-logout:hover {
  background: var(--accent-red);
  color: white;
}

/* --- Main Content Layout --- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* --- Header --- */
.top-header {
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius);
  font-size: 1.25rem;
}

.menu-toggle:hover {
  background: var(--bg-body);
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.3px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.datetime-display {
  text-align: right;
}

.date-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.time-text {
  font-size: 12px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.theme-toggle {
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
}

.theme-toggle:hover {
  background: var(--accent-green-light);
  color: var(--accent-green);
  border-color: var(--accent-green);
}

/* --- Content Area --- */
.content-area {
  flex: 1;
  padding: 24px;
}

/* --- Dashboard Grid System (Laptop/Desktop) --- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  transition: var(--transition);
  overflow: hidden;
}

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

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: linear-gradient(135deg, var(--bg-card), var(--bg-body));
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 24px;
}

/* --- Stats Grid --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  transition: var(--transition);
}

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

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

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

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.stat-icon.green { background: var(--accent-green-light); color: var(--accent-green); }
.stat-icon.blue { background: var(--accent-blue-light); color: var(--accent-blue); }
.stat-icon.yellow { background: var(--accent-yellow-light); color: var(--accent-yellow); }
.stat-icon.red { background: var(--accent-red-light); color: var(--accent-red); }

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

.stat-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

/* --- Tables --- */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table thead th {
  background: var(--bg-body);
  padding: 14px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table tbody td {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background 0.2s ease, transform 0.2s ease;
}

.data-table tbody tr:hover {
  background: var(--bg-body);
}

.data-table tbody tr.taken {
  background: var(--accent-green-light);
  border-left: 4px solid var(--accent-green);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary { background: var(--accent-green); color: white; }
.btn-primary:hover { background: var(--accent-green-hover); }

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

.btn-danger { background: var(--accent-red); color: white; }
.btn-danger:hover { background: #b91c1c; }

.btn-warning { background: var(--accent-yellow); color: white; }
.btn-warning:hover { background: #a16207; }

.btn-info { background: var(--accent-blue); color: white; }
.btn-info:hover { background: #1d4ed8; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 8px; font-size: 11px; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; }

/* --- Forms & Search --- */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text-primary);
  transition: var(--transition);
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-green);
  box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.1);
}

select.form-control {
  cursor: pointer;
  appearance: none;
  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='%236b7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.search-box {
  position: relative;
}

.search-box input {
  padding-left: 40px;
  padding-right: 14px;
  border-radius: 999px;
}

.search-box .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* --- Checkbox Custom --- */
.custom-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-input);
  cursor: pointer;
  position: relative;
  transition: var(--transition);
  flex-shrink: 0;
}

.custom-checkbox:checked {
  background: var(--accent-green);
  border-color: var(--accent-green);
}

.custom-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 8px;
  top: 3px;
  width: 6px;
  height: 11px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* --- Status Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}

.badge-green { background: var(--accent-green-light); color: var(--accent-green); }
.badge-red { background: var(--accent-red-light); color: var(--accent-red); }
.badge-yellow { background: var(--accent-yellow-light); color: var(--accent-yellow); }
.badge-blue { background: var(--accent-blue-light); color: var(--accent-blue); }

/* --- Progress Bar --- */
.progress-bar-container {
  width: 100%;
  height: 12px;
  background: var(--bg-body);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #16a34a);
  border-radius: 999px;
  transition: width 0.5s ease;
}

/* --- Toast Notification --- */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(200%);
  z-index: 9999;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast-container.show {
  transform: translateX(-50%) translateY(0);
}

.toast-notification {
  background: var(--accent-green);
  color: white;
  padding: 14px 24px;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 500;
  min-width: 320px;
  max-width: 90vw;
}

.toast-notification .toast-icon { font-size: 20px; flex-shrink: 0; }
.toast-notification .toast-close {
  margin-left: auto; background: none; border: none; color: white;
  cursor: pointer; font-size: 16px; width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center; opacity: 0.7;
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0,0,0,0.15);
  transform: scale(0.95);
  transition: transform 0.3s ease;
}
.modal-overlay.active .modal-content { transform: scale(1); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 20px; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 8px; }

/* --- Pagination --- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 20px; }
.pagination button { padding: 8px 14px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius); color: var(--text-primary); font-size: 13px; font-weight: 600; cursor: pointer; transition: var(--transition); }
.pagination button:hover { background: var(--accent-green-light); color: var(--accent-green); border-color: var(--accent-green); }
.pagination button.active { background: var(--accent-green); color: white; border-color: var(--accent-green); }
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Empty State --- */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.6; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.empty-state-desc { font-size: 13px; }

/* --- RFID & Scan Box --- */
.rfid-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 18px;
  background: var(--accent-green-light);
  border: 1px solid var(--accent-green);
  border-radius: 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.rfid-status .pulse { width: 10px; height: 10px; background: var(--accent-green); border-radius: 50%; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.scan-info {
  background: var(--accent-blue-light);
  border: 1px solid var(--accent-blue);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.scan-info-icon { font-size: 24px; }
.scan-info-text { font-size: 13px; color: var(--text-primary); }
.scan-info-text strong { display: block; font-size: 15px; margin-bottom: 2px; }

/* --- Login Page --- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg-body); padding: 20px; }
.login-card { background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 420px; padding: 40px 32px; border: 1px solid var(--border-color); }
.login-brand { text-align: center; margin-bottom: 32px; }
.login-brand .brand-icon { margin: 0 auto 16px; width: 56px; height: 56px; font-size: 28px; }
.login-brand h1 { font-size: 22px; font-weight: 800; color: var(--text-primary); margin-bottom: 4px; }
.login-brand p { font-size: 13px; color: var(--text-secondary); }
.login-form .form-group { margin-bottom: 20px; }
.login-form .btn { width: 100%; padding: 12px; font-size: 15px; }

/* --- Toolbar & Filter Bar --- */
.toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; padding: 16px; background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--border-color); box-shadow: var(--shadow); }
.filter-bar select, .filter-bar input { min-width: 140px; }

/* --- Sesi & Catat Page --- */
.sesi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.sesi-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 20px; transition: var(--transition); }
.sesi-card:hover { box-shadow: var(--shadow-lg); }
.sesi-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sesi-card-title { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.sesi-card-body { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; }
.sesi-card-body div { margin-bottom: 4px; }
.sesi-card-footer { display: flex; gap: 8px; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-box { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 16px; text-align: center; position: relative; overflow: hidden; transition: var(--transition); }
.stat-box::before { content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: var(--accent-green); }
.stat-box:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.stat-box-value { font-size: 32px; font-weight: 800; color: var(--text-primary); line-height: 1; }
.stat-box-value.success { color: var(--accent-green); }
.stat-box-value.danger { color: var(--accent-red); }
.stat-box-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }

/* --- Other Utilities --- */
.upload-area { border: 2px dashed var(--border-color); border-radius: var(--radius-lg); padding: 40px; text-align: center; transition: var(--transition); cursor: pointer; }
.upload-area:hover { border-color: var(--accent-green); background: var(--accent-green-light); }
.upload-area-icon { font-size: 40px; margin-bottom: 12px; color: var(--text-muted); }
.upload-area-text { font-size: 14px; color: var(--text-secondary); margin-bottom: 4px; }
.upload-area-hint { font-size: 12px; color: var(--text-muted); }

.log-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-color); }
.log-item:last-child { border-bottom: none; }
.log-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-green); margin-top: 6px; flex-shrink: 0; }
.log-content { flex: 1; font-size: 13px; color: var(--text-primary); }
.log-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 500; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.alert-success { background: var(--accent-green-light); color: var(--accent-green); border: 1px solid var(--accent-green); }
.alert-error { background: var(--accent-red-light); color: var(--accent-red); border: 1px solid var(--accent-red); }
.alert-warning { background: var(--accent-yellow-light); color: var(--accent-yellow); border: 1px solid var(--accent-yellow); }

.section-title { font-size: 18px; font-weight: 700; color: var(--text-primary); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.page-info { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.page-info-item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); }
.spinner { width: 20px; height: 20px; border: 2px solid var(--border-color); border-top-color: var(--accent-green); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.action-btns { display: flex; gap: 4px; }
.action-btn { width: 32px; height: 32px; border-radius: var(--radius); border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 14px; transition: var(--transition); }
.action-btn.edit { background: var(--accent-blue-light); color: var(--accent-blue); }
.action-btn.edit:hover { background: var(--accent-blue); color: white; }
.action-btn.delete { background: var(--accent-red-light); color: var(--accent-red); }
.action-btn.delete:hover { background: var(--accent-red); color: white; }
.checkbox-cell { display: flex; align-items: center; justify-content: center; }
.taken-info { font-size: 11px; color: var(--accent-green); margin-left: 8px; font-weight: 600; }

/* --- Scrollbar Customization --- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-green); }

/* ============================================
   RESPONSIVE MEDIA QUERIES (Clean & Structured)
   ============================================ */

/* --- Tablet Devices (max-width: 1023px) --- */
@media (max-width: 1023px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- Smart Mobile Devices (max-width: 768px) --- */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 0px;
  }

  .sidebar {
    transform: translateX(-100%);
    width: 280px;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .menu-toggle {
    display: block;
  }

  .datetime-display {
    display: none;
  }

  .content-area {
    padding: 12px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr; /* Stack Chart & Logs di HP */
    gap: 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .stat-card {
    padding: 16px;
  }

  .stat-value {
    font-size: 22px;
  }

  .stat-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .stat-box {
    padding: 20px;
  }

  .stat-box-value {
    font-size: 36px;
  }

  .card {
    border-radius: 16px;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-left, .toolbar-right {
    width: 100%;
  }

  .toolbar .search-box,
  .toolbar select,
  .toolbar .btn {
    width: 100%;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
  }

  .filter-bar select,
  .filter-bar input {
    width: 100%;
    min-width: unset;
  }

  .btn {
    width: 100%;
    min-height: 48px; /* Lebih ramah sentuhan jari */
  }

  .custom-checkbox {
    width: 34px;
    height: 34px;
  }

  .data-table thead th { font-size: 11px; }
  .data-table tbody td { font-size: 13px; }
  .data-table thead th, .data-table tbody td { padding: 10px 12px; }

  .sesi-grid {
    grid-template-columns: 1fr;
  }

  .modal-content {
    width: 95%;
    margin: 20px;
  }

  /* Overlay Background untuk Sidebar Mobile */
  .sidebar-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
  }

  .sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
  }
}

/* --- Small Screen Mobile (max-width: 480px) --- */
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stat-card {
    padding: 14px;
  }

  .header-right {
    gap: 8px;
  }

  .theme-toggle {
    width: 36px;
    height: 36px;
  }

  .page-title {
    font-size: 16px;
  }

  .card-body {
    padding: 16px;
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  .sidebar, .top-header, .toolbar, .btn, .modal-overlay, .toast-container {
    display: none !important;
  }
  .main-content {
    margin-left: 0 !important;
  }
  .card {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
    break-inside: avoid;
  }
  body {
    background: white !important;
    color: black !important;
  }
}
