/* Custom styles to complement Tailwind */

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

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

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Grid background */
.bg-grid-pattern {
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* Drop zone active state */
.drop-zone.drag-over {
  border-color: #22c55e !important;
  background-color: rgba(34, 197, 94, 0.05);
}

.drop-zone.drag-over #dragOverlay {
  opacity: 1;
}

/* Light mode */
html.light body {
  background-color: #f1f5f9;
  color: #1e293b;
}

html.light header {
  background-color: rgba(255,255,255,0.85);
  border-color: rgba(0,0,0,0.08);
}

html.light .bg-dark-800 {
  background-color: #ffffff;
  border-color: rgba(0,0,0,0.08);
}

html.light .bg-dark-700 {
  background-color: #f8fafc;
}

html.light .bg-dark-600 {
  background-color: #f1f5f9;
}

html.light .text-slate-400 {
  color: #64748b;
}

html.light .text-slate-500 {
  color: #94a3b8;
}

html.light .border-white\/5 {
  border-color: rgba(0,0,0,0.05);
}

html.light .border-white\/8 {
  border-color: rgba(0,0,0,0.08);
}

html.light .border-white\/10 {
  border-color: rgba(0,0,0,0.10);
}

html.light .bg-dark-900 {
  background-color: #f1f5f9;
}

html.light #toast {
  background-color: #1e293b;
  border-color: rgba(255,255,255,0.1);
  color: #f1f5f9;
}

html.light .file-card {
  background-color: #ffffff;
  border-color: rgba(0,0,0,0.08);
}

/* Progress bar */
.progress-bar {
  height: 3px;
  background: linear-gradient(90deg, #22c55e, #4ade80);
  border-radius: 2px;
  transition: width 0.2s ease;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

/* Queue item */
.queue-item {
  animation: fadeInUp 0.25s ease forwards;
}

/* File card */
.file-card {
  animation: fadeInUp 0.25s ease forwards;
  background: #1e1e2e;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.file-card:hover {
  border-color: rgba(34, 197, 94, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

/* Skeleton loader */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0.04) 25%,
    rgba(255,255,255,0.08) 50%,
    rgba(255,255,255,0.04) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

/* View button active */
.view-btn.active {
  background-color: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.view-btn:not(.active) {
  color: #64748b;
}

.view-btn:hover:not(.active) {
  background-color: rgba(255,255,255,0.05);
  color: #94a3b8;
}

/* API doc tab buttons */
.api-tab-btn {
  background-color: #22222f;
  color: #64748b;
}
.api-tab-btn.active {
  background-color: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}
.api-tab-btn:hover:not(.active) {
  background-color: rgba(255,255,255,0.06);
  color: #94a3b8;
}

/* Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(34, 197, 94, 0.2);
  border-top-color: #22c55e;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Copy button animation */
.copy-btn.copied {
  color: #4ade80 !important;
}

/* Toast show */
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* List item */
.list-item {
  animation: fadeInUp 0.2s ease forwards;
  background: #1e1e2e;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color 0.2s, background 0.2s;
}

.list-item:hover {
  border-color: rgba(34, 197, 94, 0.2);
  background: rgba(34, 197, 94, 0.03);
}

html.light .list-item {
  background: #ffffff;
  border-color: rgba(0,0,0,0.08);
}

html.light .file-card {
  background: #ffffff;
  border-color: rgba(0,0,0,0.08);
}

/* ── Kontras Mobile Fix ───────────────────────────────────── */
@media (max-width: 768px) {
  /* Teks sedikit lebih terang di mobile */
  .text-slate-400 {
    color: #94a3b8 !important;
  }
  .text-slate-500 {
    color: #7a8a9e !important;
  }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* Modal transition */
#previewModal.show {
  opacity: 1;
  pointer-events: auto;
}

/* Responsive */
@media (max-width: 640px) {
  .drop-zone { padding: 2.5rem 1.5rem; }
}

/* ── Mobile Performance Fix ────────────────────────────────── */
/* Chrome Android kadang nge-bug dengan backdrop-filter, disable di mobile */
@media (max-width: 768px) {
  * {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  /* Kompensasi: naikkan opacity background agar tetap terlihat solid */
  header {
    background-color: #111118 !important;
  }
}

/* ── Glow Orb (ringan, bukan Tailwind blur-3xl) ────────────── */
/* Tailwind blur-3xl bikin stacking context baru tiap rerender — berat di mobile.
   CSS filter: blur() di elemen non-fixed lebih efisien. */
.glow-orb {
  position: fixed;
  top: -80px;
  left: 50%;
  transform: translateX(-50%);
  width: 480px;
  height: 260px;
  background: rgba(34, 197, 94, 0.12);
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  will-change: auto; /* jangan will-change: filter — justru lebih berat */
}
/* Di mobile: lebih kecil dan lebih transparan, cukup buat depth */
@media (max-width: 640px) {
  .glow-orb {
    width: 280px;
    height: 160px;
    background: rgba(34, 197, 94, 0.09);
    filter: blur(60px);
  }
}

/* GPU hint: isolate popup layer agar tidak trigger repaint seluruh halaman */
#successPopup {
  contain: layout style;
  will-change: opacity;
}
#successCard {
  contain: layout style paint;
  will-change: transform, opacity;
}

/* ── Success Popup ─────────────────────────────────────────── */
.success-card {
  background: #1a1a26;
  box-shadow: 0 25px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05);
  /* backdrop-filter dihapus — bikin seluruh halaman blur di Chrome Android */

  /* PENTING: saat tersembunyi (opacity 0), kartu ini TIDAK BOLEH
     menerima klik/tap. Tanpa baris ini, kartu yang lebarnya hampir
     selebar layar mobile akan tetap "menangkap" tap walau tak
     terlihat, dan memblokir semua tombol di belakangnya (drop zone,
     copy/hapus, grid/list, refresh, dst). Inilah sebab utama tombol
     terasa "mati total" di mobile padahal normal di layar lebar. */
  pointer-events: none;
}
.success-card.opacity-100 {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}
.success-card.scale-100 {
  transform: scale(1);
}

/* Timer bar gradient */
#popupTimerBar {
  background: linear-gradient(90deg, #22c55e, #4ade80);
  box-shadow: 0 0 8px rgba(34,197,94,0.4);
}

/* Fade overlay — no background, only card is clickable */
#successPopup {
  transition: background 0.3s;
}
