/* ============================================================
   Skada Scan — arsip.css
   Halaman Arsip Dokumen — Dark Glassmorphism Premium
   ============================================================ */

/* ── Layout Utama ────────────────────────────────────────── */
.arsip-screen {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: var(--bg, #0c0e1a);
  position: relative;
  overflow: hidden;
}

/* Mesh gradient background (konsisten dengan app) */
.arsip-screen::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 10%, rgba(99,102,241,0.10) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(139,92,246,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 50% 30% at 60% 30%, rgba(6,182,212,0.06) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ── Header ──────────────────────────────────────────────── */
.arsip-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 60px;
  background: rgba(12, 14, 26, 0.90);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
  padding-top: env(safe-area-inset-top, 0px);
}

.arsip-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-arsip-back {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  color: #f1f5f9;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.btn-arsip-back:active { transform: scale(0.92); background: rgba(255,255,255,0.12); }

.arsip-title {
  font-size: 17px;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: -0.3px;
}

.arsip-badge-count {
  background: rgba(99,102,241,0.20);
  color: #818cf8;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(99,102,241,0.25);
  min-width: 28px;
  text-align: center;
}

/* ── Konten Utama ────────────────────────────────────────── */
.arsip-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px calc(30px + env(safe-area-inset-bottom, 0px));
  position: relative;
  z-index: 1;
}

/* ── Grid Kartu Dokumen ──────────────────────────────────── */
.arsip-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

@media (min-width: 480px) {
  .arsip-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 720px) {
  .arsip-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ── Kartu Dokumen ───────────────────────────────────────── */
.arsip-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  animation: cardFadeIn 0.4s ease both;
}

@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.arsip-card:active {
  transform: scale(0.95);
  border-color: rgba(99,102,241,0.4);
}

.arsip-card-thumb {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  display: block;
  background: rgba(255,255,255,0.03);
}

/* Placeholder thumbnail kosong */
.arsip-thumb-placeholder {
  width: 100%;
  aspect-ratio: 3/4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(99,102,241,0.08) 0%, rgba(139,92,246,0.08) 100%);
  color: rgba(99,102,241,0.6);
  font-size: 36px;
}

.arsip-card-body {
  padding: 10px 10px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.arsip-card-name {
  font-size: 12px;
  font-weight: 700;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

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

.arsip-card-date {
  font-size: 10px;
  color: #64748b;
}

.arsip-card-pages {
  font-size: 10px;
  font-weight: 600;
  color: #818cf8;
  background: rgba(99,102,241,0.12);
  padding: 2px 7px;
  border-radius: 999px;
}

/* ── Empty State ─────────────────────────────────────────── */
.arsip-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 32px;
  gap: 16px;
  animation: fadeInUp 0.5s ease both;
}

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

.arsip-empty-icon {
  font-size: 72px;
  line-height: 1;
  filter: grayscale(30%);
}

.arsip-empty-title {
  font-size: 18px;
  font-weight: 700;
  color: #f1f5f9;
}

.arsip-empty-sub {
  font-size: 14px;
  color: #64748b;
  line-height: 1.6;
  max-width: 260px;
}

.arsip-empty-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(99,102,241,0.4);
  transition: all 0.2s;
}
.arsip-empty-btn:active { transform: scale(0.96); }

/* ── Loading Skeleton ────────────────────────────────────── */
.skeleton-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  overflow: hidden;
}

.skeleton-thumb {
  width: 100%;
  aspect-ratio: 3/4;
  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;
}

.skeleton-body { padding: 10px; }

.skeleton-line {
  height: 10px;
  border-radius: 999px;
  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;
  margin-bottom: 6px;
}
.skeleton-line.short { width: 60%; }

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

/* ── Modal Pratinjau ─────────────────────────────────────── */
.arsip-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  animation: overlayIn 0.25s ease both;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.arsip-modal-sheet {
  width: 100%;
  background: #141627;
  border-radius: 24px 24px 0 0;
  border-top: 1px solid rgba(255,255,255,0.10);
  overflow: hidden;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  animation: sheetUp 0.3s cubic-bezier(0.32, 0.72, 0, 1) both;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.arsip-modal-handle {
  width: 40px;
  height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 999px;
  margin: 12px auto 0;
  flex-shrink: 0;
}

.arsip-modal-header {
  padding: 14px 20px 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.arsip-modal-title-wrap { flex: 1; min-width: 0; }

.arsip-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.arsip-modal-meta {
  font-size: 12px;
  color: #64748b;
  margin-top: 3px;
}

.btn-modal-close {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.10);
  color: #94a3b8;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 16px;
  transition: all 0.2s;
}
.btn-modal-close:active { transform: scale(0.92); }

/* Pratinjau PDF di modal */
.arsip-modal-preview {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #0c0e1a;
}

.arsip-preview-page {
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  position: relative;
}

.arsip-preview-page img {
  width: 100%;
  display: block;
}

.arsip-page-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.6);
  color: rgba(255,255,255,0.8);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}

/* Aksi modal */
.arsip-modal-actions {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.btn-arsip-action {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 8px;
  border: none;
  border-radius: 14px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-arsip-action .action-icon { font-size: 22px; line-height: 1; }

.btn-arsip-action:active { transform: scale(0.95); }

.btn-arsip-download {
  background: rgba(99,102,241,0.12);
  color: #818cf8;
  border: 1px solid rgba(99,102,241,0.2);
}
.btn-arsip-download:active { background: rgba(99,102,241,0.2); }

.btn-arsip-share {
  background: rgba(16,185,129,0.12);
  color: #34d399;
  border: 1px solid rgba(16,185,129,0.2);
}
.btn-arsip-share:active { background: rgba(16,185,129,0.2); }

.btn-arsip-rename {
  background: rgba(245,158,11,0.12);
  color: #fbbf24;
  border: 1px solid rgba(245,158,11,0.2);
}
.btn-arsip-rename:active { background: rgba(245,158,11,0.2); }

.btn-arsip-delete {
  background: rgba(244,63,94,0.10);
  color: #f87171;
  border: 1px solid rgba(244,63,94,0.20);
}
.btn-arsip-delete:active { background: rgba(244,63,94,0.20); }

/* ── Toast Notifikasi ────────────────────────────────────── */
.arsip-toast {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(99,102,241,0.3);
  color: #f1f5f9;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  z-index: 999;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.arsip-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Rename Modal ────────────────────────────────────────── */
.rename-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: overlayIn 0.2s ease both;
}

.rename-modal-box {
  background: #1e2139;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 20px;
  padding: 24px;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

.rename-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #f1f5f9;
}

.rename-modal-input {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  color: #f1f5f9;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s;
}
.rename-modal-input:focus { border-color: rgba(99,102,241,0.5); }

.rename-modal-btns {
  display: flex;
  gap: 10px;
}

.btn-rename-cancel {
  flex: 1;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  background: transparent;
  color: #94a3b8;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-rename-cancel:active { background: rgba(255,255,255,0.05); }

.btn-rename-save {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(99,102,241,0.35);
  transition: all 0.2s;
}
.btn-rename-save:active { transform: scale(0.96); }
