/* =========================================================================
   TEMA DINAMIS (AUTO-SWITCH LIGHT & DARK MODE)
   ========================================================================= */

/* =======================================================================
   1. TEMA TERANG (LIGHT MODE) - DEFAULT (Warna Biru Royal)
   ======================================================================= */

#picaOverlay .pica-modal.card-pica {
  background: #ffffff !important;
  color: #334155 !important;
  border: none !important; 
  border-radius: 20px !important; 
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2) !important;
  width: 94vw !important;
  max-width: 450px !important;
  display: flex !important;
  flex-direction: column !important;
  max-height: 85vh !important;
  overflow: hidden !important;
  transition: background 0.3s ease !important;
}

/* Header Biru Gradient */
#picaOverlay .cm-header {
  background: linear-gradient(135deg, #5b8cff 0%, #3b66f5 100%) !important;
  padding: 20px 24px !important;
  border-bottom: none !important;
  border-radius: 20px 20px 0 0 !important;
}

#picaModalTitle { color: #ffffff !important; }

#picaOverlay .cm-close {
  background: rgba(255, 255, 255, 0.2) !important;
  color: #ffffff !important;
}
#picaOverlay .cm-close:hover { background: rgba(239, 68, 68, 0.8) !important; }

/* Body & Input Terang */
#picaOverlay .cm-body {
  background: #ffffff !important;
  padding: 24px !important;
}

.pica-ctx {
  background: #eff6ff !important; 
  border: 1px solid #bfdbfe !important;
}
.pica-ctx, .pica-ctx-row { color: #1e3a8a !important; }
.pica-ctx b { color: #3b66f5 !important; }

.pica-form-grid label { color: #64748b !important; }

.pica-form-grid input,
.pica-form-grid textarea,
.pica-form-grid select {
  background: #ffffff !important;
  border: 1.5px solid #93c5fd !important; 
  color: #1e293b !important;
  border-radius: 12px !important; 
}

.pica-form-grid input:focus,
.pica-form-grid textarea:focus,
.pica-form-grid select:focus {
  border-color: #3b66f5 !important; 
  box-shadow: 0 0 0 4px rgba(59, 102, 245, 0.1) !important;
}

/* Footer Terang */
#picaOverlay .cm-footer {
  background: #f8fafc !important;
  border-top: 1px solid #e2e8f0 !important;
  border-radius: 0 0 20px 20px !important;
}

#picaOverlay .btn-primary {
  background: linear-gradient(135deg, #5b8cff 0%, #3b66f5 100%) !important;
  color: #ffffff !important;
}

#picaOverlay .btn-ghost {
  background: #ffffff !important;
  color: #3b66f5 !important;
  border: 1.5px solid #93c5fd !important;
}
#picaOverlay .btn-ghost:hover { background: #eff6ff !important; }

/* =======================================================================
   2. TEMA GELAP (DARK MODE) - OVERRIDE (Warna Hitam Transparan)
   ======================================================================= */

/* Modal Utama (Kaca Hitam) */
:root[data-wd-theme="dark"] #picaOverlay .pica-modal.card-pica {
  background: rgba(72, 76, 86, 0.82) !important; 
  backdrop-filter: blur(16px) !important;        
  -webkit-backdrop-filter: blur(16px) !important;
  color: #fbfdff !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important; 
  box-shadow: 0 25px 50px -12px rgba(32, 5, 50, 0.69) !important; 
}

/* Header (Hitam Transparan) */
:root[data-wd-theme="dark"] #picaOverlay .cm-header {
  background: rgba(0, 0, 0, 0.4) !important; 
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}
:root[data-wd-theme="dark"] #picaOverlay .cm-close {
  background: rgba(255, 255, 255, 0.1) !important;
}

/* Body & Input Gelap */
:root[data-wd-theme="dark"] #picaOverlay .cm-body {
  background: transparent !important;
}

:root[data-wd-theme="dark"] .pica-ctx {
  background: rgba(59, 130, 246, 0.1) !important; 
  border: 1px solid rgba(59, 130, 246, 0.25) !important;
}
:root[data-wd-theme="dark"] .pica-ctx, 
:root[data-wd-theme="dark"] .pica-ctx-row { color: #93c5fd !important; }
:root[data-wd-theme="dark"] .pica-ctx b { color: #ffffff !important; }

:root[data-wd-theme="dark"] .pica-form-grid label { color: #94a3b8 !important; }

:root[data-wd-theme="dark"] .pica-form-grid input,
:root[data-wd-theme="dark"] .pica-form-grid textarea,
:root[data-wd-theme="dark"] .pica-form-grid select {
  background: rgba(0, 0, 0, 0.3) !important; 
  border: 1px solid rgba(255, 255, 255, 0.1) !important; 
  color: #f8fafc !important; 
}

:root[data-wd-theme="dark"] .pica-form-grid input::placeholder,
:root[data-wd-theme="dark"] .pica-form-grid textarea::placeholder {
  color: rgba(255, 255, 255, 0.3) !important;
}

:root[data-wd-theme="dark"] .pica-form-grid input:focus,
:root[data-wd-theme="dark"] .pica-form-grid textarea:focus,
:root[data-wd-theme="dark"] .pica-form-grid select:focus {
  border-color: #3b82f6 !important; 
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2) !important;
  background: rgba(0, 0, 0, 0.5) !important; 
}

/* Footer Gelap */
:root[data-wd-theme="dark"] #picaOverlay .cm-footer {
  background: rgba(0, 0, 0, 0.4) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.05) !important;
}

:root[data-wd-theme="dark"] #picaOverlay .btn-primary {
  background: #3b82f6 !important;
}

:root[data-wd-theme="dark"] #picaOverlay .btn-ghost {
  background: rgba(255, 255, 255, 0.05) !important;
  color: #e2e8f0 !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}
:root[data-wd-theme="dark"] #picaOverlay .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1) !important;
}

/* Scrollbar */
#picaOverlay .cm-body::-webkit-scrollbar { width: 6px; }
#picaOverlay .cm-body::-webkit-scrollbar-track { background: transparent; }
#picaOverlay .cm-body::-webkit-scrollbar-thumb { background: rgba(150, 150, 150, 0.3); border-radius: 8px; }
:root[data-wd-theme="dark"] #picaOverlay .cm-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); }