/* ===================================================================
   BOSP KITA - Adaptif Stylesheet (Mobile, Desktop PWA Window, & APK)
   Arsitektur Responsif: Bottom-Bar (Mobile/APK) & Sidebar (Desktop)
   =================================================================== */

:root {
  /* Palet Warna BOSP */
  --primary-950: #0B132B;
  --primary-900: #0F172A;
  --primary-800: #1E293B;
  --primary-700: #1E3A8A; /* Navy Resmi BOSP */
  --primary-600: #2563EB; /* Biru Aksi */
  --primary-500: #3B82F6;
  --primary-100: #DBEAFE;
  --primary-50:  #EFF6FF;

  --success-700: #047857;
  --success-600: #059669; /* Disetujui & Kas Aman */
  --success-100: #D1FAE5;
  --success-50:  #ECFDF5;

  --warning-700: #B45309;
  --warning-600: #D97706; /* Menunggu Verifikasi */
  --warning-100: #FEF3C7;
  --warning-50:  #FFFBEB;

  --danger-700:  #B91C1C;
  --danger-600:  #DC2626; /* Perlu Revisi / Ditolak */
  --danger-100:  #FEE2E2;

  --neutral-900: #0F172A;
  --neutral-800: #1E293B;
  --neutral-700: #334155;
  --neutral-600: #475569;
  --neutral-500: #64748B;
  --neutral-400: #94A3B8;
  --neutral-300: #CBD5E1;
  --neutral-200: #E2E8F0;
  --neutral-100: #F1F5F9;
  --neutral-50:  #F8FAFC;
  --white:       #FFFFFF;

  /* Tipografi & Dimensi */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --sidebar-width: 250px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  /* Shadow */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-float: 0 14px 28px rgba(30, 58, 138, 0.2), 0 10px 10px rgba(0, 0, 0, 0.05);

  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset Dasar */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--neutral-100);
  font-family: var(--font-family);
  font-size: 15px;
  color: var(--neutral-900);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ===================================================
   LAYOUT CONTAINER (ADAPTIF 3 UKURAN: HP, DESKTOP, APK)
   =================================================== */

#app-viewport {
  width: 100%;
  min-height: 100vh;
  margin: 0 auto;
  background-color: var(--neutral-50);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* --- TAMPILAN MOBILE & APK (< 768px) --- */
@media (max-width: 767px) {
  #app-viewport {
    max-width: 540px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.06);
  }

  /* Sembunyikan sidebar di layar HP */
  .app-sidebar {
    display: none !important;
  }

  /* Tampilkan Topbar Mobile */
  .app-header-mobile {
    display: flex !important;
  }

  /* Tampilkan Bottom Nav di HP */
  .bottom-nav {
    display: flex !important;
  }

  /* Tampilkan FAB di HP */
  .fab-btn {
    display: flex;
  }

  .main-content {
    padding: 16px;
    padding-bottom: 96px; /* Ruang untuk bottom bar */
  }
}

/* --- TAMPILAN DESKTOP PWA WINDOW & TABLET (>= 768px) --- */
@media (min-width: 768px) {
  #app-viewport {
    max-width: 100%;
    flex-direction: row;
    background-color: #F1F5F9;
  }

  /* Tampilkan Sidebar di Desktop */
  .app-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100vh;
    position: sticky;
    top: 0;
    background: var(--primary-900);
    color: var(--white);
    display: flex !important;
    flex-direction: column;
    justify-content: space-between;
    padding: 24px 18px;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    z-index: 50;
  }

  /* Sembunyikan Topbar Mobile & Bottom Nav di Desktop */
  .app-header-mobile {
    display: none !important;
  }

  .bottom-nav {
    display: none !important;
  }

  .fab-btn {
    display: none !important;
  }

  /* Area Konten Desktop yang Luas */
  .desktop-content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-y: auto;
  }

  .desktop-topbar {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    background: var(--white);
    padding: 16px 32px;
    border-bottom: 1px solid var(--neutral-200);
    position: sticky;
    top: 0;
    z-index: 30;
  }

  .main-content {
    padding: 28px 32px;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
  }

  /* Grid 2 Kolom untuk Desktop */
  .desktop-grid-2 {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 20px;
    align-items: start;
  }
}

/* ===================================================
   KOMPONEN SIDEBAR DESKTOP
   =================================================== */

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 20px;
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--primary-700);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-title h2 {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.2px;
  color: var(--white);
}

.sidebar-title p {
  font-size: 11px;
  color: var(--primary-100);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  color: var(--neutral-300);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
}

.sidebar-nav-item svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  flex-shrink: 0;
}

.sidebar-nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
}

.sidebar-nav-item.active {
  background: var(--primary-600);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-user-card {
  background: rgba(255, 255, 255, 0.06);
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 12px;
}

.sidebar-user-card strong {
  display: block;
  color: var(--white);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-card span {
  color: var(--neutral-400);
  font-size: 11px;
}

/* ===================================================
   TOPBAR MOBILE & DESKTOP
   =================================================== */

.app-header-mobile {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--primary-700);
  color: var(--white);
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.1);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.desktop-topbar {
  display: none;
}

.badge-mode {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.2);
  color: var(--white);
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}

.desktop-topbar .badge-mode {
  background: var(--warning-100);
  color: var(--warning-700);
  border: 1px solid var(--warning-600);
}

/* ===================================================
   BOTTOM NAVIGATION BAR (MOBILE / APK)
   =================================================== */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--white);
  border-top: 1px solid var(--neutral-200);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 8px 4px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 45;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 0;
  background: none;
  border: none;
  color: var(--neutral-500);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.nav-item svg {
  width: 22px;
  height: 22px;
  margin-bottom: 2px;
  stroke: currentColor;
  fill: none;
  transition: var(--transition);
}

.nav-item.active {
  color: var(--primary-600);
  font-weight: 700;
}

.nav-item.active svg {
  stroke: var(--primary-600);
  transform: scale(1.08);
}

/* Floating Action Button (+ Belanja) */
.fab-btn {
  position: fixed;
  bottom: 76px;
  right: 18px;
  background: var(--primary-600);
  color: var(--white);
  border: none;
  border-radius: var(--radius-full);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-float);
  z-index: 40;
  transition: var(--transition);
}

.fab-btn:active {
  transform: scale(0.96);
}

.fab-btn svg {
  width: 20px;
  height: 20px;
}

/* View Sections */
.view-section {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
