/* Global Custom Scrollbar Styles for PT Artha Solusi Aditama Web System */

/* Webkit-based browsers (Chrome, Edge, Safari, Opera) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
  border: 2px solid transparent;
  background-clip: content-box;
  transition: background-color 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
  background-clip: content-box;
}

/* Dark Mode Scrollbar */
html.dark ::-webkit-scrollbar-thumb,
html[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: #475569;
  background-clip: content-box;
}

html.dark ::-webkit-scrollbar-thumb:hover,
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: #64748b;
  background-clip: content-box;
}

/* Firefox scrollbar support */
* {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

html.dark *,
html[data-theme="dark"] * {
  scrollbar-color: #475569 transparent;
}

/* --- OPTIMASI SMOOTH VIDEO PLAYBACK (MENGATASI VIDEO LAG/BERAT) --- */
video,
video[src*="webm"],
video[src*="mp4"] {
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* ==========================================================================
   RESPONSIVE MODALS (CUSTOMER MANAGEMENT / TAMBAH / EDIT CUSTOMER)
   Targetkan khusus kontainer modal form aktif tanpa menimpa modal tersembunyi
   ========================================================================== */
.fixed.inset-0:not([style*="display:none"]):not([style*="display: none"]):not(.hidden):has(> div form),
.fixed.inset-0:not([style*="display:none"]):not([style*="display: none"]):not(.hidden):has([id*="CustomerForm"]),
.fixed.inset-0:not([style*="display:none"]):not([style*="display: none"]):not(.hidden):has([id*="addCustomerForm"]) {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: clamp(8px, 2.5vw, 24px) !important;
  box-sizing: border-box !important;
  overflow-y: auto !important;
}

.fixed.inset-0:has(> div form) > div[class*="bg-white"],
.fixed.inset-0:has([id*="CustomerForm"]) > div[class*="bg-white"] {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  max-width: clamp(320px, 92vw, 600px) !important;
  max-height: min(92vh, 850px) !important;
  border-radius: 1.25rem !important;
  overflow: hidden !important;
  margin: auto !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35) !important;
}

/* Header Modal Sticky */
.fixed.inset-0:has(> div form) > div[class*="bg-white"] > div[class*="bg-[#0F3D5E]"] {
  flex-shrink: 0 !important;
  padding: 1rem 1.25rem !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
}

/* Body Modal Scrollable */
.fixed.inset-0:has(> div form) > div[class*="bg-white"] form {
  flex: 1 1 auto !important;
  overflow-y: auto !important;
  max-height: 100% !important;
  overscroll-behavior: contain !important;
  scrollbar-width: thin !important;
}

/* Footer Modal Sticky */
.fixed.inset-0:has(> div form) > div[class*="bg-white"] > div[class*="border-t"] {
  flex-shrink: 0 !important;
  padding: 0.875rem 1.25rem !important;
  background-color: #f8fafc !important;
  border-top: 1px solid #e2e8f0 !important;
}

/* Mobile viewport adjustments */
@media (max-width: 640px) {
  .fixed.inset-0:has(> div form),
  .fixed.inset-0:has([id*="CustomerForm"]) {
    padding: 10px !important;
    align-items: flex-end !important;
  }

  .fixed.inset-0:has(> div form) > div[class*="bg-white"],
  .fixed.inset-0:has([id*="CustomerForm"]) > div[class*="bg-white"] {
    max-height: 94vh !important;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
  }
}
