/* =========================================================================
   UNIT CONDITION MAP — SHARED DESIGN SYSTEM
   =========================================================================
   File ini adalah SUMBER TUNGGAL untuk warna, tipografi, sidebar, header,
   tombol, dan badge yang dipakai di SEMUA halaman (index, detail_stasiun,
   action_plan). login.html sengaja hanya memakai token warna dari sini
   (tidak memakai sidebar/header karena belum ada sesi login).

   ATURAN SINKRONISASI:
   - Jangan duplikasi CSS ini ke dalam <style> masing-masing halaman.
   - Kalau perlu ubah warna/font/ukuran sidebar, ubah HANYA di file ini —
     seluruh halaman otomatis ikut berubah.
   - Cari komentar "EDITABLE" untuk bagian yang aman diubah.
   ========================================================================= */

:root {
  /* ---- Palet warna utama (EDITABLE) ---- */
  --navy: #0A2540;
  --navy-dark: #071A2E;
  --accent: #1A73E8;
  --accent-dark: #1558B0;
  --light-blue: #E8F0FE;
  --bg-body: #F4F7FB;
  --white: #FFFFFF;
  --text-dark: #202124;
  --text-gray: #5F6368;
  --text-muted: #94A3B8;
  --border-color: #DADCE0;

  /* ---- Warna status (dipakai di badge kondisi) ---- */
  --success: #0F9D58;
  --success-bg: #E6F4EA;
  --success-border: #CEEAD6;
  --warning: #E37400;
  --warning-bg: #FEF3E0;
  --warning-border: #FCE1B0;
  --danger: #EA4335;
  --danger-bg: #FDEDEC;
  --danger-border: #F6C6C2;

  /* ---- Tipografi (EDITABLE: ganti ke font brand Anda) ---- */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;

  /* ---- Ukuran layout ---- */
  --sidebar-width: 250px;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: var(--font-family); }
body { background: var(--bg-body); color: var(--text-dark); }
a { text-decoration: none; color: inherit; }
button { font-family: var(--font-family); }

/* =========================================================================
   APP SHELL — sidebar + area konten, dipakai di semua halaman ber-login.
   ========================================================================= */
.app-shell { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.app-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--navy);
  color: var(--white);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.sidebar-brand {
  background: var(--white);
  padding: 16px;
  text-align: center;
  min-height: 70px;
  display: flex; align-items: center; justify-content: center;
}
.sidebar-brand h3 { color: var(--navy); font-size: 12px; font-weight: 800; line-height: 1.3; }
/* EDITABLE: ganti isi .sidebar-brand dengan <img src="logo.png"> untuk logo asli */

.nav-menu { list-style: none; padding: 14px 0; flex: 1; }
.nav-menu li {
  padding: 11px 20px;
  margin-right: 14px;
  font-size: 13px;
  color: #B9C4D0;
  cursor: pointer;
  display: flex; align-items: center; gap: 12px;
  transition: 0.2s;
  border-radius: 0 20px 20px 0;
}
.nav-menu li i { width: 16px; text-align: center; font-size: 14px; }
.nav-menu li:hover { background: rgba(255,255,255,0.08); color: var(--white); }
.nav-menu li.active { background: var(--accent); color: var(--white); }

.sidebar-footer { padding: 16px 20px 20px; }
.sidebar-footer p.footer-title { font-size: 11px; font-weight: 700; color: var(--text-muted); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.4px; }
.standar-kerja { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.standar-kerja li { font-size: 12px; color: var(--white); display: flex; align-items: center; gap: 10px; }
.standar-kerja li i { background: rgba(255,255,255,0.15); padding: 6px; border-radius: 5px; font-size: 10px; width: 12px; text-align: center; }
/* EDITABLE: daftar NAV_ITEMS & STANDAR_KERJA ada di shared.js, bukan di sini */

/* ---- Top header (dipakai di detail_stasiun & action_plan) ---- */
.top-header {
  background: var(--white);
  padding: 0 24px;
  height: 68px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}
.header-title h1 { font-size: 17px; color: var(--navy); font-weight: 800; letter-spacing: -0.3px; }
.header-title p { font-size: 11px; color: var(--text-gray); }
.header-right { display: flex; align-items: center; gap: 18px; }
.search-bar { position: relative; }
.search-bar input {
  padding: 8px 14px 8px 34px; border: 1px solid var(--border-color);
  border-radius: 20px; width: 260px; font-size: 12.5px; background: var(--bg-body);
}
.search-bar input:focus { outline: none; border-color: var(--accent); background: var(--white); }
.search-bar i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-gray); font-size: 12px; }

/* ---- Hasil pencarian global (dropdown di bawah kotak pencarian) ---- */
.global-search-results {
  display: none; position: absolute; top: 110%; left: 0; width: 380px; max-height: 420px; overflow-y: auto;
  background: #fff; border: 1px solid var(--border-color); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(15,23,42,0.14); z-index: 60; padding: 6px 0;
}
.global-search-results.show { display: block; }
.gs-loading, .gs-empty { padding: 16px 18px; font-size: 12.5px; color: var(--text-gray); text-align: center; }
.gs-section { padding: 6px 0; border-bottom: 1px solid var(--border-color); }
.gs-section:last-child { border-bottom: none; }
.gs-section-title { padding: 6px 16px; font-size: 10.5px; font-weight: 700; color: var(--text-gray); text-transform: uppercase; letter-spacing: 0.3px; }
.gs-item { display: block; padding: 8px 16px; text-decoration: none; }
.gs-item:hover { background: var(--bg-body); }
.gs-item strong { display: block; font-size: 12.5px; color: var(--text-dark); font-weight: 600; }
.gs-item span { display: block; font-size: 11px; color: var(--text-gray); margin-top: 2px; }
@media (max-width: 640px) { .global-search-results { width: 90vw; left: -60px; } }

/* =========================================================================
   USER WIDGET — SATU-SATUNYA bentuk kartu profil/akun yang dipakai di
   SEMUA halaman (Beranda, Detail Stasiun, Editor Gambar, dst), lewat
   renderUserWidget() di shared.js. Sebelumnya Beranda punya bentuk
   sendiri ("welcome-badge") yang beda dari halaman lain ("profile-area")
   -- sekarang disatukan jadi satu komponen ini saja.
   ========================================================================= */
.user-widget {
  display: flex; align-items: center; gap: 10px; cursor: pointer; position: relative;
  background: #fff; border: 1px solid var(--border-color); border-radius: 999px; padding: 6px 14px 6px 6px;
}
.uw-avatar { height: 32px; width: 32px; border-radius: 999px; background: #e2e8f0; display: flex; align-items: center; justify-content: center; color: var(--text-gray); flex-shrink: 0; }
.uw-text { line-height: 1.25; }
.uw-hello { font-size: 10px; color: var(--text-muted); }
.uw-name { font-size: 12px; font-weight: 800; color: var(--navy); }
.uw-name .uw-role { font-size: 10px; font-weight: 600; color: var(--text-gray); margin-left: 4px; }
.uw-chevron { color: var(--text-gray); font-size: 10px; }

.user-widget-dropdown {
  display: none; position: absolute; top: 110%; right: 0; background: #fff; border: 1px solid var(--border-color);
  border-radius: 8px; box-shadow: 0 6px 16px rgba(0,0,0,0.1); min-width: 160px; z-index: 50; overflow: hidden;
}
.user-widget-dropdown.show { display: block; }
.user-widget-dropdown a, .user-widget-dropdown button {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 10px 14px;
  border: none; background: none; cursor: pointer; font-size: 12.5px; color: var(--text-dark); text-decoration: none;
}
.user-widget-dropdown button { color: var(--danger); border-top: 1px solid var(--border-color); }

@media (max-width: 640px) {
  .uw-text { display: none; } /* sembunyikan nama/role di layar sempit, sisakan avatar saja */
}

/* =========================================================================
   KOMPONEN UMUM — badge status, tombol, kartu
   ========================================================================= */
.status-badge {
  font-size: 11px; padding: 4px 10px; border-radius: 12px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent;
}
.status-badge i { font-size: 7px; }
.status-badge.cond-good { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.status-badge.cond-warn { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.status-badge.cond-crit { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.status-badge.cond-crit i { animation: badgePulse 1.3s ease-in-out infinite; }
@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(234,67,53,0.5); }
  50% { box-shadow: 0 0 0 4px rgba(234,67,53,0); }
}

.btn {
  padding: 11px 22px; border-radius: 8px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  border: none; transition: 0.2s;
}
.btn-primary { background: var(--accent); color: var(--white); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary { background: var(--white); border: 1px solid var(--border-color); color: var(--navy); }
.btn-secondary:hover { background: var(--bg-body); }
.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: #0c8046; }

.card {
  background: var(--white); border: 1px solid var(--border-color);
  border-radius: 12px; padding: 20px;
}

/* Utility */
.text-muted { color: var(--text-gray); }
.mt-0 { margin-top: 0; }

/* =========================================================================
   NAVIGASI MOBILE — hamburger + sidebar jadi drawer geser di layar sempit.
   Dipasang otomatis oleh initMobileNav() di shared.js, dipanggil setelah
   renderSidebar() di tiap halaman. Di layar desktop (>860px) semua ini
   tidak aktif sama sekali (tetap seperti sebelumnya).
   ========================================================================= */
.mobile-nav-toggle {
  display: none;
  position: fixed; top: 14px; left: 14px; z-index: 250;
  width: 42px; height: 42px; border-radius: 8px;
  background: var(--navy); color: #fff; border: none;
  align-items: center; justify-content: center; font-size: 18px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25); cursor: pointer;
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(8,20,54,0.5); z-index: 150;
}
.sidebar-overlay.show { display: block; }

@media (max-width: 860px) {
  .mobile-nav-toggle { display: flex; }
  .app-shell { flex-direction: column; }
  .app-sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; z-index: 200;
    transform: translateX(-100%); transition: transform 0.25s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,0.25);
  }
  .app-sidebar.mobile-open { transform: translateX(0); }

  /* Header umum (dipakai detail_stasiun/component_detail/action_plan) —
     beri ruang di kiri supaya tidak tertutup tombol hamburger */
  .top-header { padding-left: 64px; flex-wrap: wrap; height: auto; min-height: 68px; gap: 8px; }
  .header-title p { display: none; }
  .search-bar { display: none; } /* pencarian disembunyikan di mobile, hemat tempat */
}

/* =========================================================================
   BILAH TAB "LAPORAN & MONITORING" — dipakai bersama di 3 halaman lewat
   renderReportTabs() di shared.js.
   ========================================================================= */
.report-tabs-row { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.report-tab-btn {
  padding: 9px 16px; border-radius: 18px; font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--border-color); background: #fff; color: var(--text-gray); cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
}
.report-tab-btn:hover { background: var(--bg-body); }
.report-tab-btn.active { background: var(--navy); border-color: var(--navy); color: #fff; }

/* =========================================================================
   MODE FULL SCREEN GAMBAR — dipakai SERAGAM di detail_stasiun.html,
   component_detail.html, dan part_detail.html (lihat openImageFullscreen()
   di shared.js). Tombol expand-nya sendiri (.visual-expand-btn) ditaruh
   di pojok kanan-atas kotak gambar masing-masing halaman.
   ========================================================================= */
.visual-expand-btn {
  position: absolute; top: 13px; right: 13px; z-index: 3;
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border-color);
  background: #fff; color: var(--navy); cursor: pointer; font-size: 12px;
  display: flex; align-items: center; justify-content: center; transition: 0.15s;
}
.visual-expand-btn:hover { background: var(--bg-body); }

.img-fullscreen-overlay {
  position: fixed; inset: 0; background: rgba(5,15,30,0.94); z-index: 500;
  display: flex; align-items: center; justify-content: center; padding: 30px; overflow: auto;
}
.img-fullscreen-close {
  position: fixed; top: 18px; right: 22px; z-index: 501;
  width: 42px; height: 42px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,0.15); color: #fff; font-size: 18px;
  display: flex; align-items: center; justify-content: center; transition: 0.15s;
}
.img-fullscreen-close:hover { background: rgba(255,255,255,0.3); }
.img-fullscreen-hint {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 501;
  color: rgba(255,255,255,0.65); font-size: 11.5px; white-space: nowrap;
}
@media (max-width: 640px) { .img-fullscreen-hint { display: none; } }

/* Saat elemen gambar (station-img-wrap / part-img-inner / part-photo-wrap)
   dipindah ke dalam overlay, lepaskan batas tinggi kecil dari halaman
   aslinya supaya gambar tampil sebesar mungkin. PENTING: wrap dibiarkan
   MENYUSUT MENGIKUTI ukuran gambar (bukan dipaksa ke lebar tetap) supaya
   tidak ada celah/letterbox kosong antara kotak dan gambar -- kalau
   tidak, posisi pin (%) akan meleset dari gambar yang sebenarnya
   terlihat begitu wrap dipindah keluar dari konteks halaman aslinya. */
.img-fullscreen-overlay .station-img-wrap,
.img-fullscreen-overlay .part-img-inner,
.img-fullscreen-overlay .part-photo-wrap {
  max-height: none !important; overflow: visible !important;
  max-width: 92vw !important;
}
.img-fullscreen-overlay .station-img-wrap img,
.img-fullscreen-overlay .part-img-inner img,
.img-fullscreen-overlay .part-photo-wrap img {
  max-width: 92vw !important; max-height: 88vh !important;
  width: auto !important; height: auto !important;
}

/* =========================================================================
   showConfirm() & showToast() — modal/toast bersama, dipakai di semua
   halaman (lihat shared.js). Menggantikan confirm()/alert() bawaan
   browser yang kaku & tidak konsisten antar halaman.
   ========================================================================= */
.btn-danger { background: var(--danger); color: #fff; border: 1px solid var(--danger); }
.btn-danger:hover { opacity: 0.9; }

.ucm-confirm-overlay {
  display: none; position: fixed; inset: 0; background: rgba(8,20,45,0.5); z-index: 500;
  align-items: center; justify-content: center; padding: 16px;
}
.ucm-confirm-overlay.show { display: flex; }
.ucm-confirm-box {
  background: #fff; border-radius: 14px; padding: 26px; width: 100%; max-width: 380px;
  text-align: center; box-shadow: 0 16px 40px rgba(0,0,0,0.2);
}
.ucm-confirm-icon {
  width: 48px; height: 48px; border-radius: 50%; background: var(--light-blue); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 20px; margin: 0 auto 14px;
}
.ucm-confirm-icon.danger { background: var(--danger-bg); color: var(--danger); }
.ucm-confirm-text { font-size: 13.5px; color: var(--text-dark); line-height: 1.6; margin-bottom: 20px; }
.ucm-confirm-actions { display: flex; gap: 10px; justify-content: center; }
.ucm-confirm-actions .btn { flex: 1; justify-content: center; }

.ucm-toast {
  position: fixed; top: 20px; right: 20px; z-index: 600;
  background: #fff; border: 1px solid var(--border-color); border-left: 4px solid var(--success);
  border-radius: 8px; padding: 14px 18px; box-shadow: 0 8px 20px rgba(0,0,0,0.12);
  font-size: 13px; color: var(--text-dark); display: flex; align-items: center; gap: 10px; max-width: 340px;
  opacity: 0; transform: translateY(-8px); pointer-events: none; transition: 0.2s;
}
.ucm-toast.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.ucm-toast i { font-size: 16px; flex-shrink: 0; }
@media (max-width: 640px) { .ucm-toast { left: 14px; right: 14px; max-width: none; } }
