/* ================================================================
   DISPLAN - Global CSS
   File: /assets/css/global.css
   Fungsi: Style bersama semua halaman
   Versi: MVP (tanpa sidebar - akan ditambahkan nanti)
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

/* ================================================================
   BASE
   ================================================================ */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: #f8fafc;
  color: #1e293b;
  margin: 0;
  padding: 0;
  animation: pageIn 0.18s ease-out;
}

/* Transisi halaman smooth */
@keyframes pageIn {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Transisi keluar saat klik link */
body.page-out {
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  pointer-events: none;
}

/* ================================================================
   KOMPONEN BERSAMA
   ================================================================ */

/* Badge status */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}
.badge-green   { background:#dcfce7; color:#166534; }
.badge-blue    { background:#dbeafe; color:#1e40af; }
.badge-yellow  { background:#fef9c3; color:#854d0e; }
.badge-red     { background:#fee2e2; color:#991b1b; }
.badge-purple  { background:#f3e8ff; color:#6b21a8; }
.badge-gray    { background:#f1f5f9; color:#475569; }

/* Progress bar */
.progress-bar {
  height: 8px;
  border-radius: 4px;
  background: #e5e7eb;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}
.progress-green  { background: #22c55e; }
.progress-blue   { background: #3b82f6; }
.progress-yellow { background: #eab308; }
.progress-red    { background: #ef4444; }

/* Card */
.card {
  background: white;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transform: translateY(-1px);
  transition: all 0.2s;
}

/* Tabel umum */
.table-base th {
  background: #f8fafc;
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 12px;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}
.table-base td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.82rem;
  vertical-align: middle;
}
.table-base tr:hover td { background: #f8fafc; }

/* Input form */
.input-base {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-family: inherit;
  transition: all 0.15s;
  background: white;
}
.input-base:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.input-base.error {
  border-color: #ef4444;
  background: #fef2f2;
}

/* Tombol */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  text-decoration: none;
}
.btn-sm  { padding: 5px 12px; font-size: 0.75rem; }
.btn-md  { padding: 8px 16px; font-size: 0.82rem; }
.btn-lg  { padding: 10px 20px; font-size: 0.9rem;  }

.btn-primary            { background:#1e3a5f; color:white; }
.btn-primary:hover      { background:#1e40af; }
.btn-success            { background:#16a34a; color:white; }
.btn-success:hover      { background:#15803d; }
.btn-danger             { background:#fee2e2; color:#991b1b; }
.btn-danger:hover       { background:#fecaca; }
.btn-secondary          { background:#f1f5f9; color:#374151; }
.btn-secondary:hover    { background:#e2e8f0; }
.btn-disabled           { background:#e5e7eb; color:#9ca3af; cursor:not-allowed; }

/* ================================================================
   SKELETON LOADING
   ================================================================ */

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    #f1f5f9 25%,
    #e2e8f0 50%,
    #f1f5f9 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  border-radius: 4px;
}

.skeleton-card {
  background: white;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 16px;
}

.skeleton-circle { border-radius: 50%; }
.skeleton-btn    { height: 36px; border-radius: 8px; }

/* ================================================================
   TOAST NOTIFICATION
   ================================================================ */
#toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  font-size: 0.82rem;
  font-weight: 500;
  min-width: 260px;
  max-width: 360px;
  transition: all 0.3s;
}

.toast-success { background: #22c55e; color: white; }
.toast-error   { background: #ef4444; color: white; }
.toast-warning { background: #eab308; color: #1c1917; }
.toast-info    { background: #3b82f6; color: white; }

/* ================================================================
   LOADING OVERLAY
   ================================================================ */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
}

#loading-overlay .loading-box {
  background: white;
  border-radius: 14px;
  padding: 24px 28px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #e2e8f0;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ================================================================
   PRINT CSS
   ================================================================ */
@media print {

  .no-print,
  nav,
  header,
  #btn-print,
  #btn-generate,
  .filter-bar {
    display: none !important;
  }

  body {
    background: white !important;
    margin: 0 !important;
    padding: 0 !important;
    animation: none !important;
  }

  #dokumen-laporan {
    display: block !important;
  }

  .card {
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
  }

  table { page-break-inside: auto; }
  tr    { page-break-inside: avoid; }
  thead { display: table-header-group; }

  .print-thead th,
  .badge,
  .progress-fill,
  .badge-green, .badge-blue,
  .badge-yellow, .badge-red {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-section-keuangan {
    page-break-after: always;
    break-after: page;
  }

  .print-section-fisik {
    page-break-before: always;
    break-before: page;
  }

  a[href]::after { content: none !important; }
  body { font-size: 10px !important; }

  @page {
    size: A4 portrait;
    margin: 15mm 12mm;
  }
}

/* ================================================================
   SCROLLBAR
   ================================================================ */
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: #64748b; }
