/* SIPENGADAAN RSUD Lembang - Custom Styles */
:root {
  --primary: #1e40af;
  --primary-light: #3b82f6;
  --accent: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --sidebar-width: 260px;
}

* { box-sizing: border-box; }

body { font-family: 'Segoe UI', system-ui, sans-serif; }

/* Sidebar */
#sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #1e3a8a 0%, #1e40af 50%, #1d4ed8 100%);
  min-height: 100vh;
  position: fixed;
  left: 0; top: 0;
  z-index: 50;
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

#main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 18px;
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  border-radius: 8px;
  margin: 2px 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none; background: transparent; width: calc(100% - 16px);
  text-align: left;
}
.nav-item:hover, .nav-item.active {
  background: rgba(255,255,255,0.15);
  color: white;
}
.nav-item.active { background: rgba(255,255,255,0.2); color: white; }
.nav-item i { width: 20px; text-align: center; font-size: 15px; }

/* Cards */
.card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  padding: 20px;
}

.stat-card {
  background: white; border-radius: 12px;
  padding: 20px; border-left: 4px solid var(--primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Status badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
}
.badge-draft { background: #f1f5f9; color: #64748b; }
.badge-diajukan { background: #dbeafe; color: #1e40af; }
.badge-verif { background: #fef3c7; color: #92400e; }
.badge-menunggu { background: #ede9fe; color: #5b21b6; }
.badge-disetujui { background: #d1fae5; color: #065f46; }
.badge-proses { background: #cffafe; color: #164e63; }
.badge-selesai { background: #d1fae5; color: #065f46; }
.badge-ditolak { background: #fee2e2; color: #991b1b; }
.badge-revisi { background: #fff7ed; color: #9a3412; }

/* Table */
.table-container { overflow-x: auto; border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { background: #f8fafc; padding: 11px 14px; text-align: left; font-weight: 600; color: #374151; border-bottom: 2px solid #e2e8f0; white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid #f1f5f9; color: #374151; vertical-align: middle; }
tr:hover td { background: #f8fafc; }
tr:last-child td { border-bottom: none; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px;
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  border: none; transition: all 0.2s; text-decoration: none;
}
.btn-primary { background: #2563eb; color: white; }
.btn-primary:hover { background: #1d4ed8; }
.btn-success { background: #10b981; color: white; }
.btn-success:hover { background: #059669; }
.btn-danger { background: #ef4444; color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: #f59e0b; color: white; }
.btn-warning:hover { background: #d97706; }
.btn-secondary { background: #f1f5f9; color: #374151; border: 1px solid #e2e8f0; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Form */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 5px; }
.form-control {
  width: 100%; padding: 9px 12px; border: 1px solid #d1d5db;
  border-radius: 8px; font-size: 14px; color: #1f2937;
  transition: border-color 0.2s;
  background: white;
}
.form-control:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-control:disabled { background: #f9fafb; color: #6b7280; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 20px; backdrop-filter: blur(2px);
}
.modal-box {
  background: white; border-radius: 16px; max-height: 90vh;
  overflow-y: auto; width: 100%; position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-sm { max-width: 480px; }
.modal-md { max-width: 680px; }
.modal-lg { max-width: 900px; }
.modal-xl { max-width: 1100px; }

/* Login page */
.login-container {
  min-height: 100vh;
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 50%, #2563eb 100%);
  display: flex; align-items: center; justify-content: center;
}

/* Alerts */
.alert {
  padding: 12px 16px; border-radius: 8px; font-size: 13.5px;
  display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px;
}
.alert-info { background: #eff6ff; color: #1e40af; border-left: 3px solid #2563eb; }
.alert-success { background: #f0fdf4; color: #166534; border-left: 3px solid #22c55e; }
.alert-warning { background: #fffbeb; color: #92400e; border-left: 3px solid #f59e0b; }
.alert-error { background: #fef2f2; color: #991b1b; border-left: 3px solid #ef4444; }

/* Progress bar */
.progress-bar { background: #e2e8f0; border-radius: 20px; overflow: hidden; height: 8px; }
.progress-fill { height: 100%; border-radius: 20px; transition: width 0.5s ease; }
.progress-blue { background: linear-gradient(90deg, #3b82f6, #2563eb); }
.progress-green { background: linear-gradient(90deg, #10b981, #059669); }
.progress-orange { background: linear-gradient(90deg, #f59e0b, #d97706); }
.progress-red { background: linear-gradient(90deg, #ef4444, #dc2626); }

/* Workflow steps */
.workflow-step {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 8px; font-size: 13px;
  border: 1px solid #e2e8f0; background: white;
}
.workflow-step.active { border-color: #2563eb; background: #eff6ff; }
.workflow-step.done { border-color: #10b981; background: #f0fdf4; }
.workflow-step.pending { border-color: #e2e8f0; background: #f9fafb; color: #9ca3af; }
.workflow-step.rejected { border-color: #ef4444; background: #fef2f2; }

/* Chat */
.chat-bubble {
  padding: 8px 14px; border-radius: 12px; max-width: 75%;
  font-size: 13px; line-height: 1.5;
}
.chat-bubble.own { background: #2563eb; color: white; margin-left: auto; border-bottom-right-radius: 4px; }
.chat-bubble.other { background: #f1f5f9; color: #1f2937; border-bottom-left-radius: 4px; }
.chat-bubble.system { background: #fef3c7; color: #92400e; margin: 4px auto; font-size: 12px; font-style: italic; }

/* Loading spinner */
.spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-dark { border-color: rgba(30,64,175,0.2); border-top-color: #1e40af; }

/* Toast */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 18px; border-radius: 10px; font-size: 13.5px; font-weight: 500; box-shadow: 0 4px 12px rgba(0,0,0,0.15); min-width: 280px; display: flex; align-items: center; gap: 10px; animation: slideIn 0.3s ease; }
.toast-success { background: #f0fdf4; color: #166534; border-left: 3px solid #22c55e; }
.toast-error { background: #fef2f2; color: #991b1b; border-left: 3px solid #ef4444; }
.toast-warning { background: #fffbeb; color: #92400e; border-left: 3px solid #f59e0b; }
.toast-info { background: #eff6ff; color: #1e40af; border-left: 3px solid #2563eb; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* File upload zone */
.file-zone {
  border: 2px dashed #d1d5db; border-radius: 10px;
  padding: 24px; text-align: center; cursor: pointer;
  transition: all 0.2s;
}
.file-zone:hover, .file-zone.dragover { border-color: #2563eb; background: #eff6ff; }

/* Nota Dinas Print */
@media print {
  .no-print { display: none !important; }
  body { font-size: 11pt; }
  .nota-print { padding: 0; margin: 0; }
}

/* Responsive */
@media (max-width: 768px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); }
  #main-content { margin-left: 0; }
}

/* Sura Pesanan template */
.sp-template { border: 2px solid #1e40af; padding: 20px; font-family: 'Times New Roman', serif; }
.sp-header { text-align: center; border-bottom: 2px solid #1e40af; padding-bottom: 12px; margin-bottom: 16px; }

/* Number input */
input[type="number"]::-webkit-outer-spin-button, input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

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

/* Autocomplete Kode Rekening */
.kode-autocomplete { position: relative; }
.kode-autocomplete-input { width: 100%; }
.kode-dropdown {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 500;
  background: white; border: 1px solid #d1d5db; border-top: none;
  border-radius: 0 0 8px 8px; max-height: 280px; overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.kode-dropdown-item {
  padding: 9px 12px; cursor: pointer; border-bottom: 1px solid #f1f5f9;
  display: flex; flex-direction: column; gap: 2px;
  transition: background 0.15s;
}
.kode-dropdown-item:hover, .kode-dropdown-item.selected { background: #eff6ff; }
.kode-dropdown-item:last-child { border-bottom: none; }
.kode-dropdown-item .kode-code { font-family: monospace; font-size: 11px; font-weight: 700; color: #1d4ed8; }
.kode-dropdown-item .kode-name { font-size: 13px; color: #1f2937; font-weight: 500; }
.kode-dropdown-item .kode-sub { font-size: 11px; color: #6b7280; }
.kode-dropdown-item .kode-badge { display: inline-block; font-size: 10px; padding: 1px 6px; border-radius: 10px; }
.kode-dropdown-empty { padding: 12px; text-align: center; color: #9ca3af; font-size: 13px; }
.kode-selected-display {
  background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px;
  padding: 8px 12px; font-size: 13px; display: flex; align-items: center;
  justify-content: space-between; gap: 8px; margin-top: 4px;
}
.kode-selected-display .kode-sel-info { flex: 1; }
.kode-selected-display .kode-sel-kode { font-family: monospace; font-size: 11px; font-weight: 700; color: #1d4ed8; }
.kode-selected-display .kode-sel-nama { font-size: 12.5px; font-weight: 600; color: #1f2937; }
.kode-selected-display .kode-sel-sub { font-size: 11px; color: #6b7280; }

/* New Kode Autocomplete Items */
.kode-ac-item { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid #f1f5f9; transition: background 0.15s; }
.kode-ac-item:hover { background: #eff6ff; }
.kode-ac-item:last-child { border-bottom: none; }

/* Rupiah Input — auto-format titik ribuan */
input.rupiah-input {
  font-family: 'Segoe UI', system-ui, sans-serif;
  text-align: right;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
input.rupiah-input:focus {
  background-color: #fffbeb;
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245,158,11,0.15);
}
input.rupiah-input::placeholder { text-align: right; color: #9ca3af; }

/* Pagination */
.pagination { display: flex; align-items: center; gap: 4px; }
.page-btn { min-width: 32px; height: 32px; border-radius: 6px; border: 1px solid #e2e8f0; background: white; font-size: 13px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
.page-btn:hover { background: #eff6ff; border-color: #2563eb; color: #2563eb; }
.page-btn.active { background: #2563eb; color: white; border-color: #2563eb; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
