/* ============================================================
   LitDigi Mobile Bridge & Reader Pro Styles (v1.2.0 Full Parity)
   - AMOLED Dark Mode (reading-amoled)
   - Webtoon Vertical Scroll Mode
   - Zen Reading 2.0 Floating Dock (Auto-Scroll, TTS, Offline)
   - Anti-Plagiat Lapis 2 (anti-copy) & Lapis 4 (Dynamic Watermark)
   - Native Android Bottom Navigation Bar & Live Offline Banner
   ============================================================ */

/* AMOLED Pure Black Theme for OLED Android Devices */
.page-section.reading-amoled {
  background-color: #000000 !important;
  color: #d4d4d8 !important;
}
.page-section.reading-amoled .reading-container,
.page-section.reading-amoled .reading-content-area {
  background: #050505 !important;
  color: #d4d4d8 !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  box-shadow: none !important;
}
.page-section.reading-amoled .reading-text,
.page-section.reading-amoled .chapter-reading-title {
  color: #e4e4e7 !important;
}
.page-section.reading-amoled .chapter-story-name,
.page-section.reading-amoled .reading-subtitle {
  color: #a1a1aa !important;
}
.page-section.reading-amoled .reading-controls-bar {
  background: rgba(10, 10, 10, 0.94) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.12) !important;
}

.theme-ctrl-btn.ta {
  background: #000000;
  border: 2px solid #38bdf8;
}
.theme-ctrl-btn.ta.active {
  box-shadow: 0 0 0 2px #00e1ff;
}

/* Anti-Plagiat Lapis 2: Non-selectable protected reading area */
.litdigi-protected-reader {
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-touch-callout: none !important;
}
.litdigi-protected-reader input,
.litdigi-protected-reader textarea {
  user-select: text !important;
  -webkit-user-select: text !important;
}

/* Anti-Plagiat Lapis 4: Dynamic Session Watermark */
#litdigi-dynamic-watermark {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9990;
  opacity: 0.065;
  background-repeat: repeat;
}

/* Webtoon Vertical Scroll Mode */
#reading.webtoon-mode .reading-container,
#chapterDetail.webtoon-mode .reading-container {
  max-width: 720px;
  padding-left: 0 !important;
  padding-right: 0 !important;
}
#reading.webtoon-mode .reading-content-area,
#chapterDetail.webtoon-mode .reading-content-area {
  padding-left: 12px !important;
  padding-right: 12px !important;
  border-radius: 0 !important;
}
#reading.webtoon-mode .reading-text img,
#chapterDetail.webtoon-mode .reading-text img {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  margin: 0 !important;
  border-radius: 0 !important;
}
#reading.webtoon-mode .reading-text p,
#chapterDetail.webtoon-mode .reading-text p {
  margin-bottom: 0.9em;
}

/* Zen Reading 2.0 Floating Dock */
.ld-reader-pro-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 14px auto 18px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(35, 166, 213, 0.35);
  color: #f8fafc;
  backdrop-filter: blur(8px);
}
.ld-pro-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: #1e293b;
  color: #e2e8f0;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
.ld-pro-btn:active {
  transform: scale(0.96);
}
.ld-pro-btn.active {
  background: linear-gradient(135deg, #23a6d5, #0284c7);
  border-color: #38bdf8;
  color: #ffffff;
}
.ld-pro-select {
  padding: 6px 8px;
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.3);
  font-size: 0.78rem;
}
.ld-shield-pill {
  font-size: 0.72rem;
  color: #7dd3fc;
  background: rgba(14, 116, 144, 0.25);
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 4px 10px;
  border-radius: 999px;
}

/* Offline Library Modal */
.ld-offline-modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
  background: rgba(2, 6, 23, 0.78);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.ld-offline-modal.active {
  display: flex;
}
.ld-offline-card {
  width: 100%;
  max-width: 620px;
  max-height: 84vh;
  overflow-y: auto;
  background: #0f172a;
  color: #f1f5f9;
  border: 1px solid rgba(35, 166, 213, 0.4);
  border-radius: 16px;
  padding: 18px;
}
.ld-offline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.ld-offline-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}
.ld-offline-item:last-child {
  border-bottom: none;
}

/* Biometric Draft Lock Overlay */
.ld-draft-lock-overlay {
  position: relative;
  margin: 14px 0;
  padding: 24px 18px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #f1f5f9;
  text-align: center;
}

/* Native APK Bottom Navigation Bar */
body.litdigi-native-apk:not(.ld-in-reader):not(.zen-mode) {
  padding-bottom: 68px !important;
}
body.litdigi-native-apk .ld-discord-fab {
  bottom: 76px !important;
}
.ld-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9400;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid rgba(148, 163, 184, 0.25);
  backdrop-filter: blur(12px);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
}
body.dark-mode .ld-bottom-nav,
body.theme-merdeka2026 .ld-bottom-nav {
  background: rgba(15, 23, 42, 0.95);
  border-top-color: rgba(56, 189, 248, 0.2);
}
.ld-bnav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 2px;
  cursor: pointer;
}
body.dark-mode .ld-bnav-btn,
body.theme-merdeka2026 .ld-bnav-btn {
  color: #94a3b8;
}
.ld-bnav-btn.active {
  color: #23a6d5;
}
body.dark-mode .ld-bnav-btn.active {
  color: #00e1ff;
}
.ld-bnav-ico {
  font-size: 1.05rem;
  line-height: 1.1;
}
body.zen-mode .ld-bottom-nav,
body.ld-in-reader .ld-bottom-nav {
  display: none !important;
}

/* Live Network Offline Banner */
.ld-net-banner {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10060;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid rgba(251, 191, 36, 0.55);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  font-size: 0.8rem;
  max-width: 94vw;
}
.ld-net-banner.active {
  display: flex;
}

/* Paket C: Eye-Care Warm Tint, Brightness Gesture Pill & Tap-to-Hide HUD */
#ldEyeCareOverlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9985;
  background: rgba(255, 159, 67, 0);
  transition: background-color 0.2s ease;
}

.ld-brightness-hud {
  position: fixed;
  top: 50%;
  left: 24px;
  transform: translateY(-50%);
  z-index: 10070;
  background: rgba(15, 23, 42, 0.88);
  color: #fde047;
  border: 1px solid rgba(251, 191, 36, 0.45);
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  pointer-events: none;
  display: none;
}
.ld-brightness-hud.active {
  display: block;
}

body.ld-hud-hidden header,
body.ld-hud-hidden .reading-controls-bar,
body.ld-hud-hidden .ld-reader-pro-bar {
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 0.2s ease;
}


/* Light Mode Parity, Focus States & Reduced Motion */
body:not(.dark-mode):not(.theme-merdeka2026) .ld-reader-pro-bar {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(15, 23, 42, 0.12);
  color: #0f172a;
}

body:not(.dark-mode):not(.theme-merdeka2026) .ld-pro-btn {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.14);
  color: #1e293b;
}

body:not(.dark-mode):not(.theme-merdeka2026) .ld-pro-select {
  background: #ffffff;
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.16);
}

body:not(.dark-mode):not(.theme-merdeka2026) .ld-offline-card {
  background: #ffffff;
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.14);
}

.ld-pro-btn:focus-visible,
.ld-bnav-btn:focus-visible,
.ld-offline-card button:focus-visible,
.ld-offline-card input:focus-visible {
  outline: 2px solid #0284c7;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .ld-pro-btn,
  #ldEyeCareOverlay,
  body.ld-hud-hidden header,
  body.ld-hud-hidden .reading-controls-bar,
  body.ld-hud-hidden .ld-reader-pro-bar {
    transition: none !important;
  }
}
