/* ===== CSS VARIABLES (ELEGANT PRO EDITION) ===== */
:root {
  /* Base & Backgrounds: Deep Slate Navy (Sangat tenang dan premium) */
  --bg: #090b11;           /* Background luar yang sangat gelap */
  --bg2: #0f121d;          /* Background sidebar & topbar */
  --bg3: #141826;          /* Background table headers */
  --surface: #181d2e;      /* Card backgrounds & inputs */
  --surface2: #21283d;     /* Hover states / Active card highlights */
  
  /* Borders: Tipis dan menyatu (Subtle) */
  --border: rgba(255, 255, 255, 0.04);
  --border2: rgba(255, 255, 255, 0.08);
  
  /* Typography: Kontras yang nyaman di mata */
  --text: #f8fafc;         /* Off-white, tidak terlalu menusuk mata */
  --text2: #94a3b8;        /* Slate grey untuk deskripsi secondary */
  --text3: #475569;        /* Muted grey untuk placeholder */
  
  /* Accents & Glows: Clean Emerald & Soft Indigo */
  --accent: #10b981;       /* Emerald Green (Melambangkan sukses & stabil) */
  --accent2: #34d399;      /* Light emerald untuk hover */
  --accent-glow: rgba(16, 185, 129, 0.15);
  
  /* Smooth Semantic Colors */
  --red: #ef4444;          /* Red */
  --purple: #8b5cf6;       /* Indigo/Purple */
  --green: #10b981;        /* Success */
  --blue: #3b82f6;         /* Info */
  --orange: #f59e0b;       /* Warning */
  --teal: #06b6d4;         /* Teal */
  
  /* Fonts & UI (Clean & Sophisticated) */
  --font: 'Outfit', 'Inter', -apple-system, sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --radius: 12px;          /* Konsisten dan tidak terlalu membulat */
  --radius-sm: 6px;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
  --transition: 0.25s cubic-bezier(0.25, 1, 0.5, 1); /* Efek animasi yang smooth */
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ===== LAYOUT ===== */
.app { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: 260px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}
.sidebar-logo {
  padding: 24px 24px 20px;
  border-bottom: 1px solid var(--border);
}
.logo-mark {
  display: flex; align-items: center; gap: 12px;
  font-size: 18px; font-weight: 700; letter-spacing: -0.2px;
}
.logo-icon {
  width: 32px; height: 32px; background: linear-gradient(135deg, var(--accent) 0%, #059669 100%);
  border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: white;
  box-shadow: 0 4px 12px var(--accent-glow);
}
.logo-sub { font-size: 11px; color: var(--text3); margin-top: 2px; font-weight: 500; letter-spacing: 0.5px; }

.sidebar-nav { flex: 1; padding: 20px 14px; overflow-y: auto; }
.nav-section { margin-bottom: 24px; }
.nav-label {
  font-size: 11px; font-weight: 600; color: var(--text3);
  letter-spacing: 1px; text-transform: uppercase;
  padding: 0 12px; margin-bottom: 8px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  cursor: pointer; transition: all var(--transition);
  font-size: 14px; font-weight: 500; color: var(--text2);
  margin-bottom: 3px; border: 1px solid transparent;
  position: relative;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.02); color: var(--text); }
.nav-item.active {
  background: rgba(16, 185, 129, 0.08); 
  color: #fff;
}
.nav-item.active::before {
  content: ''; position: absolute; left: 0;
  top: 50%; transform: translateY(-50%);
  width: 3px; height: 16px; background: var(--accent);
  border-radius: 0 2px 2px 0;
}
.nav-emoji { font-size: 14px; width: 20px; text-align: center; flex-shrink: 0; opacity: 0.7; }
.nav-item.active .nav-emoji { opacity: 1; }
.nav-dot {
  margin-left: auto; width: 5px; height: 5px;
  border-radius: 50%; background: var(--accent);
}

.sidebar-footer {
  padding: 16px 24px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text3);
}
.sidebar-footer strong { color: var(--text2); }

/* ===== MAIN CONTENT ===== */
.main {
  margin-left: 260px;
  flex: 1; min-height: 100vh;
  display: flex; flex-direction: column;
}

/* ===== TOPBAR ===== */
.topbar {
  background: rgba(15, 18, 29, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.page-title { font-size: 18px; font-weight: 600; }
.page-badge {
  font-size: 11px; font-weight: 600;
  background: var(--surface2); color: var(--text2);
  padding: 3px 10px; border-radius: 4px;
  border: 1px solid var(--border);
}

.topbar-right { display: flex; align-items: center; gap: 12px; }

/* ===== SEARCH BAR ===== */
.search-wrap { position: relative; }
.search-input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 9px 16px 9px 38px;
  border-radius: var(--radius-sm);
  width: 260px;
  transition: all var(--transition);
  outline: none;
}
.search-input:focus {
  border-color: rgba(16, 185, 129, 0.4);
  background: var(--bg);
  width: 300px;
}
.search-input::placeholder { color: var(--text3); }
.search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text3); font-size: 14px; pointer-events: none;
}
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  max-height: 400px; overflow-y: auto; z-index: 200;
  display: none;
}
.search-results.show { display: block; }
.search-result-item {
  padding: 12px 16px; cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.search-result-item:hover { background: var(--surface); }
.search-result-item:last-child { border-bottom: none; }
.sr-module {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; padding: 2px 6px; border-radius: 3px;
  background: var(--surface2); color: var(--text2); flex-shrink: 0;
}
.sr-info { flex: 1; min-width: 0; }
.sr-job { font-family: var(--mono); font-size: 12px; color: var(--accent); }
.sr-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-meta { font-size: 11px; color: var(--text3); }
.no-results { padding: 24px; text-align: center; color: var(--text3); font-size: 13px; }

.btn-menu {
  display: none; background: var(--surface); border: 1px solid var(--border);
  color: var(--text); padding: 8px 12px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 16px;
}

/* ===== CONTENT AREA ===== */
.content { padding: 32px; flex: 1; }

/* ===== DASHBOARD ===== */
.dashboard { display: none; }
.dashboard.active { display: block; }

.welcome-banner {
  background: linear-gradient(135deg, var(--surface) 0%, var(--bg2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 32px;
  position: relative; overflow: hidden;
}
.welcome-banner::before {
  content: '';
  position: absolute; right: -50px; top: -50px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
}
.welcome-banner h2 { font-size: 24px; font-weight: 600; margin-bottom: 6px; }
.welcome-banner p { color: var(--text2); font-size: 14px; }
.welcome-date { 
  margin-top: 16px; font-family: var(--mono); font-size: 11px;
  color: var(--accent); background: rgba(16, 185, 129, 0.06);
  display: inline-block; padding: 4px 10px; border-radius: 4px;
  font-weight: 600;
}

.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px; margin-bottom: 32px;
}
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer; transition: all var(--transition);
  position: relative; overflow: hidden;
}
.stat-card:hover {
  background: var(--surface);
  border-color: rgba(255, 255, 255, 0.08);
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}
.stat-card::after {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: var(--card-color, var(--accent));
  opacity: 0.7;
}
.stat-emoji { font-size: 20px; margin-bottom: 12px; opacity: 0.8; }
.stat-value { font-size: 26px; font-weight: 700; margin-bottom: 4px; }
.stat-label { font-size: 12px; color: var(--text2); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-sub { font-size: 11px; color: var(--text3); margin-top: 6px; font-family: var(--mono); }

.recent-section h3 {
  font-size: 16px; font-weight: 600; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.recent-table-wrap {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* ===== MODULE VIEW ===== */
.module-view { display: none; }
.module-view.active { display: block; }

.module-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: gap;
}
.module-title-wrap { display: flex; align-items: center; gap: 12px; }
.module-icon-big {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}

/* ===== FILTER BAR ===== */
.filter-bar {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end;
}
.filter-group { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 140px; }
.filter-label { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; }
.filter-input, .filter-select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  outline: none;
  transition: all var(--transition);
}
.filter-input:focus, .filter-select:focus {
  border-color: rgba(16, 185, 129, 0.4);
}
.filter-select option { background: var(--bg2); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 13px; font-weight: 600;
  cursor: pointer; border: 1px solid transparent; transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 4px 12px var(--accent-glow);
}
.btn-primary:hover { background: var(--accent2); transform: translateY(-1px); }
.btn-secondary { background: var(--surface2); color: var(--text2); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface); color: var(--text); }
.btn-danger { background: rgba(239, 68, 68, 0.1); color: var(--red); border-color: rgba(239, 68, 68, 0.2); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); }
.btn-success { background: rgba(16, 185, 129, 0.1); color: var(--green); border-color: rgba(16, 185, 129, 0.2); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ===== TABLE ===== */
.table-wrap {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
.table-toolbar {
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.table-count { font-size: 13px; color: var(--text2); }
.table-count strong { color: var(--text); }

table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
thead th {
  background: var(--bg3);
  padding: 12px 24px;
  text-align: left; font-weight: 600;
  color: var(--text2); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: rgba(255, 255, 255, 0.01); }
.td-job {
  font-family: var(--mono); font-size: 11px;
  color: var(--accent); font-weight: 600;
}
.td-qty {
  font-family: var(--mono); font-size: 12px;
}
.td-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ===== STATUS BADGES ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 3px 8px;
  border-radius: 4px; white-space: nowrap;
}
.badge-selesai, .badge-diterima, .badge-lulus { background: rgba(16, 185, 129, 0.1); color: var(--green); }
.badge-proses, .badge-dikirim, .badge-diproses, .badge-kondisional { background: rgba(245, 158, 11, 0.1); color: var(--orange); }
.badge-pending { background: rgba(59, 130, 246, 0.1); color: var(--blue); }
.badge-ditolak, .badge-dikembalikan { background: rgba(239, 68, 68, 0.1); color: var(--red); }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.show { display: flex; }
@keyframes fadeIn { from { opacity: 0; } }

.modal {
  background: var(--bg2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius);
  width: 100%; max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } }

.modal-header {
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.modal-close {
  width: 28px; height: 28px; background: transparent;
  border: none; cursor: pointer; color: var(--text3); font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px; transition: all var(--transition);
}
.modal-close:hover { background: var(--surface); color: var(--text); }

.modal-body { padding: 24px 28px; }
.modal-footer {
  padding: 16px 28px 24px;
  display: flex; justify-content: flex-end; gap: 10px;
  border-top: 1px solid var(--border);
}

/* ===== FORM ===== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text2); }
.form-label .req { color: var(--red); margin-left: 3px; }
.form-input, .form-select, .form-textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  outline: none;
  transition: all var(--transition);
  width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: rgba(16, 185, 129, 0.4);
}
.form-select option { background: var(--bg2); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 11px; color: var(--text3); }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center; padding: 60px 24px;
  color: var(--text3);
}
.empty-icon { font-size: 32px; margin-bottom: 16px; opacity: 0.5; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--text2); margin-bottom: 4px; }
.empty-text { font-size: 13px; }

/* ===== TOAST ===== */
.toast-container {
  position: fixed; bottom: 32px; right: 32px;
  z-index: 2000; display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow);
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex; align-items: center; gap: 10px;
  min-width: 260px;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }
.toast-success { border-left: 3px solid var(--green); }
.toast-error { border-left: 3px solid var(--red); }

/* ===== CONFIRM DIALOG ===== */
.confirm-box {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px; max-width: 380px; width: 100%;
  text-align: center; box-shadow: var(--shadow-lg);
}
.confirm-icon { font-size: 32px; margin-bottom: 16px; color: var(--red); }
.confirm-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.confirm-text { font-size: 13px; color: var(--text2); margin-bottom: 24px; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }

/* ===== LOADING ===== */
.loading {
  display: flex; align-items: center; justify-content: center;
  padding: 48px; gap: 12px; color: var(--text3);
}
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--surface2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .btn-menu { display: flex; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar { padding: 0 16px; }
  .content { padding: 20px 16px; }
  .search-input { width: 160px; }
  .search-input:focus { width: 200px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .filter-bar { flex-direction: column; }
  .table-wrap { overflow-x: auto; }
  .modal { max-height: 100vh; border-radius: 12px 12px 0 0; align-self: flex-end; }
}

/* ===== OVERLAY for mobile sidebar ===== */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 99;
  background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(4px);
}
.sidebar-overlay.show { display: block; }