/* ==========================================================================
   CSS DASHBOARD ICYRIEL — FINAL & CLEAN
   File: css/dashboard.css
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. VARIABEL & RESET GLOBAL
   -------------------------------------------------------------------------- */

/* Dark mode override — hanya berlaku saat tema gelap aktif */
[data-bs-theme="dark"] {
  --glass-bg: rgba(10, 15, 30, 0.85);
  --glass-bg-light: rgba(10, 15, 30, 0.4);
  --accent-primary: #00d2ff;
  --accent-primary-hover: #00f2ff;
  --accent-glow: rgba(0, 210, 255, 0.25);
  --accent-glow-strong: rgba(0, 210, 255, 0.5);
  --bg-dark: #050810;
}

/* Light mode override — pastikan tema es konsisten */
[data-bs-theme="light"] {
  --glass-bg: rgba(255, 255, 255, 0.65);
  --glass-bg-light: rgba(240, 248, 255, 0.5);
  --card-bg: rgba(240, 248, 255, 0.85);
  --accent-glow: rgba(0, 119, 182, 0.2);
  --accent-glow-strong: rgba(0, 119, 182, 0.4);
}

html,
body {
  height: auto !important;
  min-height: 100vh !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  position: relative !important;
  max-width: 100vw !important;
}

body {
  font-family: "Rajdhani", sans-serif;
}

[data-bs-theme="dark"] body {
  background-color: #050810;
  color: #ffffff;
}

/* Cegah body shift saat sidebar mobile terbuka */
/* FIX — cukup lock scroll, jangan fixed */
body.mobile-sidebar-open {
  overflow: hidden !important;
  touch-action: none !important;
}
.bg-base {
  height: auto !important;
  min-height: 100vh !important;
  overflow: visible !important;
}

.container {
  height: auto !important;
  padding-bottom: 80px !important;
}

/* Background Grid Effect */
.cyber-grid {
  position: fixed !important;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none !important;
  z-index: -5 !important;
  overflow: hidden !important;
}

/* Paksa container animasi background tidak overflow */
body > canvas,
body > svg,
#particle-container,
.laser-line,
[id*="laser"],
[class*="laser"] {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100% !important;
  overflow: hidden !important;
  pointer-events: none !important;
  z-index: -5 !important;
}

/* --------------------------------------------------------------------------
   2. TIPOGRAFI & UTILITAS TEKS
   -------------------------------------------------------------------------- */
.text-cyan {
  color: var(--accent-primary) !important;
}

.font-tech {
  font-family: "Exo 2", sans-serif !important;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.font-mono-cyber {
  font-family: "JetBrains Mono", "Courier New", monospace;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.status-aktif {
  color: #00ffcc;
  font-weight: bold;
}

.status-non {
  color: #ff4d4d;
  opacity: 0.6;
}

/* --------------------------------------------------------------------------
   3. KOMPONEN UTAMA
   -------------------------------------------------------------------------- */
.cyber-card {
  background: var(--glass-bg);
  backdrop-filter: blur(15px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 0 20px var(--accent-glow);
  border-radius: 12px;
  color: var(--text-main);
}

.auth-box {
  max-width: 400px;
  width: 100%;
  background: var(--glass-bg);
  backdrop-filter: blur(15px);
  border: 1px solid var(--accent-primary);
  box-shadow: 0 0 30px var(--accent-glow);
}

.stat-box {
  background: var(--glass-bg-light);
  border: 1px solid rgba(0, 210, 255, 0.2);
  border-left: 4px solid var(--accent-primary);
  padding: 20px;
  border-radius: 12px;
  transition: 0.3s;
  height: 100%;
}

.stat-box:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 0 15px rgba(0, 210, 255, 0.1);
}

.stat-box .h3,
.stat-box .h4,
.stat-box .h5 {
  font-family: "Orbitron", sans-serif;
  letter-spacing: -1px;
  white-space: nowrap;
}

.stat-label {
  font-family: "Orbitron", sans-serif;
  font-size: 0.65rem;
  letter-spacing: 2px;
  color: var(--accent-primary);
  opacity: 0.8;
}

.stat-value {
  font-size: 1.7rem;
  color: #fff;
  text-shadow: 0 0 10px rgba(0, 210, 255, 0.3);
}

.order-summary-box {
  background: rgba(0, 210, 255, 0.05);
  border: 1px dashed var(--accent-primary);
  border-radius: 8px;
  transition: 0.3s all;
}

.badge-tier {
  font-family: "Orbitron", sans-serif;
  font-size: 0.65rem;
  padding: 5px 10px;
  letter-spacing: 1px;
  border: 1px solid rgba(0, 210, 255, 0.3);
  background: rgba(0, 0, 0, 0.3);
}

/* --------------------------------------------------------------------------
   4. FORM, TOMBOL & INPUT
   -------------------------------------------------------------------------- */
.form-control,
.form-select {
  background: rgba(0, 0, 0, 0.4) !important;
  border: 1px solid #333 !important;
  color: var(--accent-primary) !important;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 15px rgba(0, 210, 255, 0.3) !important;
}

.custom-select-icy {
  background-color: #0a0f1e !important;
  color: var(--accent-primary) !important;
  border: 1px solid rgba(0, 210, 255, 0.3) !important;
  font-size: 0.75rem !important;
  cursor: pointer;
}

.custom-select-icy option {
  background-color: var(--bg-dark);
  color: var(--accent-primary);
}

.btn-main-action,
.btn-submit {
  background: var(--accent-primary);
  color: #000;
  font-family: "Orbitron", sans-serif;
  font-weight: 900;
  border: none;
  transition: 0.3s;
}

.btn-main-action:hover,
.btn-submit:hover {
  background: var(--accent-primary-hover);
  box-shadow: 0 0 20px var(--accent-glow-strong);
  transform: translateY(-2px);
}

.page-btn {
  background: transparent;
  border: 1px solid var(--accent-primary);
  color: var(--accent-primary);
  padding: 2px 10px;
  border-radius: 4px;
  margin: 0 2px;
}

.page-btn:disabled {
  border-color: #333;
  color: #555;
  cursor: not-allowed;
}

.page-btn.active {
  background: var(--accent-primary);
  color: #000;
}

/* --------------------------------------------------------------------------
   5. TABEL
   -------------------------------------------------------------------------- */
.table-dark {
  --bs-table-bg: transparent;
}

.table-responsive {
  border-radius: 8px;
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.card-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#adminPerformanceBody tr td {
  padding: 1.2rem 0.5rem !important;
  vertical-align: middle;
}

#adminPerformanceBody tr {
  transition: background 0.3s ease;
}

#adminPerformanceBody tr:hover {
  background: rgba(0, 210, 255, 0.08) !important;
}

/* --------------------------------------------------------------------------
   6. ANIMASI
   -------------------------------------------------------------------------- */
@keyframes pulse-cyan {
  0% {
    opacity: 0.5;
    text-shadow: 0 0 5px var(--accent-primary);
  }
  50% {
    opacity: 1;
    text-shadow: 0 0 20px var(--accent-primary);
  }
  100% {
    opacity: 0.5;
    text-shadow: 0 0 5px var(--accent-primary);
  }
}

.loading-stat {
  animation: pulse-cyan 1.5s infinite;
  color: var(--accent-primary) !important;
  font-family: "Orbitron", sans-serif;
}

/* --------------------------------------------------------------------------
   7. SCROLLBAR
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
  display: none !important;
}
* {
  -ms-overflow-style: none !important;
  scrollbar-width: none !important;
}

.radar-accordion .accordion-body {
  max-height: 50vh;
  overflow-y: auto !important;
  overflow-x: hidden;
  padding: 0.5rem !important;
}

.radar-accordion .accordion-body::-webkit-scrollbar {
  display: block !important;
  width: 4px;
}
.radar-accordion .accordion-body::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}
.radar-accordion .accordion-body::-webkit-scrollbar-thumb {
  background: var(--accent-primary);
  border-radius: 4px;
}

/* --------------------------------------------------------------------------
   8. SWEETALERT
   -------------------------------------------------------------------------- */
body.swal2-shown {
  overflow: hidden !important;
  touch-action: none !important;
}

.swal2-select,
.swal2-input {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.swal2-popup {
  padding: 1.5rem !important;
}

.swal2-container {
  max-width: 100vw !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
}

/* --------------------------------------------------------------------------
   9. HEADER
   -------------------------------------------------------------------------- */
/* Header tidak boleh bergeser oleh apapun */
#header.header {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  z-index: 997 !important;
  transform: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  height: 60px !important;
  padding: 0 15px 0 0 !important;
  background: rgba(5, 8, 16, 0.95) !important;
  backdrop-filter: blur(10px) !important;
  border-bottom: 1px solid rgba(0, 210, 255, 0.15) !important;
  box-shadow: 0 2px 20px rgba(0, 210, 255, 0.05) !important;
  max-width: 100vw !important;
  box-sizing: border-box !important;
}

/* Cegah semua animasi mempengaruhi layout */
* {
  animation-fill-mode: none !important;
}

canvas,
svg:not(:root) {
  display: block;
  overflow: hidden !important;
}
.toggle-sidebar-btn {
  font-size: 28px;
  padding-left: 10px;
  cursor: pointer;
  color: var(--accent-primary);
  transition: 0.3s;
  user-select: none;
}

.toggle-sidebar-btn:hover {
  color: #fff;
  text-shadow: 0 0 10px var(--accent-primary);
}

/* --------------------------------------------------------------------------
   10. SIDEBAR — Base Style
   -------------------------------------------------------------------------- */
#sidebar.sidebar {
  position: fixed;
  top: 60px;
  left: 0;
  bottom: 0;
  width: 260px;
  z-index: 996;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 20px 15px;
  overflow-y: auto;
  background: rgba(5, 8, 16, 0.95);
  backdrop-filter: blur(10px);
  border-right: 1px solid rgba(0, 210, 255, 0.2);
  box-shadow: 5px 0 15px rgba(0, 210, 255, 0.05);
}

/* --------------------------------------------------------------------------
   11. SIDEBAR — Nav Items
   -------------------------------------------------------------------------- */
.sidebar-nav {
  padding: 0;
  margin: 0;
  list-style: none; /* ← INI YANG HILANG — hapus bullet */
}

.sidebar-nav .nav-heading {
  font-size: 11px;
  text-transform: uppercase;
  color: rgba(0, 210, 255, 0.6);
  font-weight: 700;
  margin: 15px 0 5px 15px;
  letter-spacing: 1px;
  font-family: "Rajdhani", sans-serif;
}

.sidebar-nav .nav-item {
  margin-bottom: 5px;
  list-style: none; /* Double guard */
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  font-size: 14px;
  font-weight: 500;
  color: #899bbd;
  transition: 0.3s;
  background: transparent;
  padding: 10px 15px;
  border-radius: 8px;
  text-decoration: none;
  font-family: "Orbitron", sans-serif;
  white-space: nowrap;
}

/* Icon dalam nav-link */
.sidebar-nav .nav-link i {
  font-size: 18px;
  margin-right: 12px;
  color: #899bbd;
  transition: 0.3s;
  flex-shrink: 0; /* Icon tidak mengecil */
}

/* Hover & Active */
.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
  color: var(--accent-primary);
  background: rgba(0, 210, 255, 0.1);
  box-shadow: inset 3px 0 0 var(--accent-primary);
  text-shadow: 0 0 8px rgba(0, 210, 255, 0.5);
}

.sidebar-nav .nav-link:hover i,
.sidebar-nav .nav-link.active i {
  color: var(--accent-primary);
  text-shadow: 0 0 10px var(--accent-primary);
}

/* --------------------------------------------------------------------------
   12. MAIN CONTENT
   -------------------------------------------------------------------------- */
#main.main {
  margin-top: 60px;
  padding: 20px 30px;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: calc(100vh - 60px);
  position: relative;
  z-index: 1;
  max-width: 100%;
  overflow-x: hidden;
}

#app,
#main,
.main {
  max-width: 100%;
  overflow-x: hidden;
}

/* --------------------------------------------------------------------------
   13. LAYOUT RESPONSIF — PC vs Mobile
   -------------------------------------------------------------------------- */

/* ── PC (≥1200px): Sidebar terbuka by default ── */
@media (min-width: 1200px) {
  /* Hapus rule left: 0 yang unconditional */
  /* JANGAN tulis: #sidebar.sidebar { left: 0 !important } */

  /* Ganti dengan default tanpa !important */
  body:not(.toggle-sidebar) #sidebar.sidebar {
    left: 0 !important;
  }

  body:not(.toggle-sidebar) #main.main {
    margin-left: 260px !important;
  }

  body.toggle-sidebar #sidebar.sidebar {
    left: -260px !important;
  }

  body.toggle-sidebar #main.main {
    margin-left: 0 !important;
  }
}
/* ── Mobile (<1200px): Sidebar tersembunyi by default ── */
@media (max-width: 1199px) {
  #sidebar.sidebar {
    left: -260px !important;
  }

  #main.main {
    margin-left: 0 !important;
    padding: 15px !important;
  }

  /* Hamburger klik → sidebar muncul sebagai overlay */
  body.mobile-sidebar-open #sidebar.sidebar {
    left: 0 !important;
    box-shadow: 5px 0 30px rgba(0, 210, 255, 0.25);
  }

  /* toggle-sidebar TIDAK berlaku di mobile */
  body.toggle-sidebar #sidebar.sidebar {
    left: -260px !important;
  }

  /* Konten tidak bisa diklik saat sidebar overlay aktif */
  body.mobile-sidebar-open #main.main {
    pointer-events: none;
  }
}

/* --------------------------------------------------------------------------
   14. MEDIA QUERIES — Komponen Responsif
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .swal2-popup {
    width: 90vw !important;
    max-width: 90vw !important;
    margin: auto !important;
    left: 0 !important;
    right: 0 !important;
    box-sizing: border-box !important;
  }
}

@media (max-width: 600px) {
  .swal2-popup {
    width: 95% !important;
    max-width: 95% !important;
    padding: 1em !important;
    margin: auto !important;
  }
  .swal2-html-container {
    margin: 1em 0 0 0 !important;
    overflow-x: hidden !important;
  }
}

@media (max-width: 576px) {
  .cyber-card {
    padding: 15px !important;
  }
  .stat-box {
    padding: 15px !important;
  }
  .stat-value {
    font-size: 1.2rem !important;
  }

  .card-header-flex {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px;
  }

  .card-header-flex .d-flex {
    width: 100% !important;
    justify-content: space-between;
    gap: 8px;
  }

  #historyRange {
    flex-grow: 1;
    min-width: 150px;
  }

  table {
    font-size: 0.7rem !important;
  }

  #historyTableBody td,
  thead th {
    padding: 8px 4px !important;
    font-size: 0.65rem !important;
  }

  /* Sembunyikan kolom Nama Produk di HP */
  #historyTableBody td:nth-child(3),
  thead th:nth-child(3) {
    display: none;
  }
}

@media (max-width: 400px) {
  .header {
    padding: 0 10px !important;
  }
  .navbar-brand {
    font-size: 0.8rem !important;
  }
  #main.main {
    padding: 10px !important;
  }
}
