* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: #f4f5f7;
  color: #1f2430;
}

/* ---- Login ---- */
.login-body {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2b3352, #4a5b8c);
}
.login-box {
  background: #fff;
  padding: 40px 36px;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  width: 100%;
  max-width: 360px;
}
.login-box h1 { margin: 0 0 4px; font-size: 22px; }
.login-box .subtitle { color: #6b7280; margin-bottom: 20px; font-size: 14px; }
.login-box label { display: block; font-size: 13px; margin: 12px 0 4px; color: #374151; }
.login-box input {
  width: 100%; padding: 10px 12px; border: 1px solid #d1d5db;
  border-radius: 8px; font-size: 14px;
}
.login-box button {
  margin-top: 20px; width: 100%; padding: 11px; border: none;
  background: #2b3352; color: #fff; font-size: 15px; border-radius: 8px;
  cursor: pointer;
}
.login-box button:hover { background: #3a4576; }
.alert-error {
  background: #fee2e2; color: #991b1b; padding: 8px 12px;
  border-radius: 8px; font-size: 13px; margin-bottom: 8px;
}

/* ---- Topbar ---- */
.topbar {
  background: #2b3352; color: #fff; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar h1 { font-size: 18px; margin: 0; }
.topbar-right { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.btn-logout {
  color: #fff; text-decoration: none; background: rgba(255,255,255,0.15);
  padding: 6px 12px; border-radius: 6px; font-size: 13px;
}
.btn-logout:hover { background: rgba(255,255,255,0.3); }

/* ---- Container / File grid ---- */
.container { max-width: 1100px; margin: 0 auto; padding: 24px; }
.search-bar { display: flex; gap: 8px; margin-bottom: 20px; }
.search-bar input {
  flex: 1; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px;
}
.search-bar button {
  padding: 10px 18px; border: none; background: #2b3352; color: #fff;
  border-radius: 8px; cursor: pointer;
}
.empty-state { color: #6b7280; text-align: center; margin-top: 60px; }

.file-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}
.file-card {
  background: #fff; border-radius: 10px; padding: 18px 10px;
  text-align: center; text-decoration: none; color: #1f2430;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: transform .12s, box-shadow .12s;
}
.file-card:hover { transform: translateY(-3px); box-shadow: 0 8px 18px rgba(0,0,0,0.12); }
.file-icon { font-size: 40px; }
.file-name {
  font-size: 13px; margin-top: 8px; word-break: break-word;
}
.file-meta { font-size: 11px; color: #9ca3af; margin-top: 4px; }

.footer { text-align: center; color: #9ca3af; font-size: 12px; padding: 20px; }

/* ---- Viewer ---- */
.viewer-body { background: #525659; margin: 0; height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
.viewer-topbar {
  background: #323639; color: #fff; padding: 10px 16px;
  display: flex; align-items: center; gap: 16px; flex-shrink: 0;
  flex-wrap: wrap;
}
.btn-back { color: #fff; text-decoration: none; font-size: 14px; flex-shrink: 0; }
.viewer-title { flex: 1; font-size: 14px; word-break: break-word; min-width: 200px; }
.viewer-controls { display: flex; align-items: center; gap: 8px; }
.viewer-controls button {
  background: #4a4e51; color: #fff; border: none; width: 28px; height: 28px;
  border-radius: 4px; cursor: pointer; font-size: 16px;
}
.viewer-controls span { font-size: 13px; min-width: 42px; text-align: center; }

.pdf-container {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column;
  align-items: center; gap: 16px; padding: 20px;
}
.loading { color: #fff; margin-top: 60px; font-size: 14px; }

.page-wrapper { position: relative; box-shadow: 0 2px 10px rgba(0,0,0,0.4); background: #6b6f72; }
.pdf-page { display: block; pointer-events: none; } /* canvas hanya visual, tidak menerima klik/drag */

.page-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.55); font-size: 13px;
}

/* Text layer PDF.js: teks transparan ditumpuk PAS di atas canvas (posisi & ukuran
   identik dengan viewport canvas) agar bisa di-select & di-copy dengan presisi,
   tanpa menampilkan/menyediakan file PDF aslinya untuk diunduh. */
.textLayer {
  position: absolute;
  text-align: initial;
  inset: 0;
  overflow: hidden;
  line-height: 1;
  text-size-adjust: none;
  forced-color-adjust: none;
  transform-origin: 0 0;
  z-index: 2;
}
.textLayer span, .textLayer br {
  color: transparent;
  position: absolute;
  white-space: pre;
  cursor: text;
  transform-origin: 0% 0%;
}
.textLayer ::selection { background: rgba(0, 100, 255, 0.35); }
.textLayer .endOfContent {
  display: block;
  position: absolute;
  inset: 100% 0 0;
  z-index: -1;
  cursor: default;
  user-select: none;
}
.textLayer .endOfContent.active { top: 0; }

.watermark {
  position: absolute; bottom: 8px; right: 10px;
  font-size: 11px; color: rgba(255,255,255,0.55);
  background: rgba(0,0,0,0.25); padding: 2px 6px; border-radius: 4px;
  pointer-events: none; z-index: 3;
}

.protect-overlay {
  position: fixed; inset: 0; background: rgba(10,10,15,0.97);
  color: #fff; display: flex; align-items: center; justify-content: center;
  text-align: center; font-size: 15px; z-index: 9999; padding: 20px;
}
