/* ═══════════════════════════════════════════════════════════════════════════════
   Manga Reader — Mobil Uyumlu CSS
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ─── Desktop Ayarları ─────────────────────────────────────────────────────────── */
.reader-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px 40px;
}

#webtoon-reader {
  display: block;
  width: 100%;
}

#webtoon-reader img {
  display: block;
  width: 100%;
  height: auto;
  border-bottom: 10px solid #000;
  background: #111;
  margin: 0;
  padding: 0;
}

#webtoon-reader img:last-child {
  border-bottom: none;
}

#paged-reader {
  display: none;
  flex-direction: column;
  align-items: center;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  min-height: 400px;
  width: 100%;
}

#paged-reader.visible {
  display: flex;
}

#paged-img-wrap {
  position: relative;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #000;
  width: 100%;
  flex: 1;
  overflow: hidden;
}

#paged-img {
  max-height: 85vh;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

/* ─── Tablet Ayarları (768px - 1024px) ────────────────────────────────────────── */
@media (max-width: 1024px) {
  .reader-wrap {
    padding: 0 12px 32px;
  }

  #paged-img {
    max-height: 80vh;
  }
}

/* ─── Mobil Ayarları (max-width: 768px) ───────────────────────────────────────── */
@media (max-width: 768px) {
  .reader-wrap {
    max-width: 100%;
    padding: 0 0 32px;
    margin: 0;
  }

  /* Webtoon modu — tam genişlik */
  #webtoon-reader {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
  }

  #webtoon-reader img {
    width: 100%;
    max-width: 100vw;
    height: auto;
    border-bottom: 8px solid #000;
    margin: 0;
    padding: 0;
    display: block;
  }

  /* Sayfa sayfa modu — tam ekran */
  #paged-reader {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    border-radius: 0;
    min-height: 100vh;
  }

  #paged-reader.visible {
    display: flex;
  }

  #paged-img-wrap {
    width: 100vw;
    height: 100vh;
    position: relative;
  }

  #paged-img {
    max-height: 100vh;
    max-width: 100vw;
    width: auto;
    height: auto;
    object-fit: contain;
  }

  /* Kontrol çubuğu — alt kısım sabit */
  #paged-controls {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    gap: 8px;
  }

  .paged-nav-btn {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.15);
    cursor: pointer;
    background: rgba(255, 255, 255, 0.08);
    color: #f0f0f5;
    transition: all 0.15s ease;
    flex: 1;
    white-space: nowrap;
  }

  .paged-nav-btn:hover:not(:disabled) {
    background: rgba(124, 109, 255, 0.3);
    border-color: rgba(124, 109, 255, 0.5);
  }

  .paged-nav-btn:disabled {
    opacity: 0.3;
    cursor: default;
  }

  /* Üst bar — mobilde daha kompakt */
  .reader-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    background: #13161f;
    border-radius: 0;
    padding: 10px 12px;
    margin-bottom: 0;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  .reader-top-bar a {
    font-size: 12px;
    color: #9395a8;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .reader-top-bar span {
    font-size: 12px;
    font-weight: 700;
    color: #7c6dff;
  }

  .reader-top-bar .nav-buttons {
    display: flex;
    gap: 4px;
  }

  .reader-top-bar a.nav-btn {
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #9395a8;
    text-decoration: none;
    transition: all 0.15s ease;
    max-width: none;
  }

  .reader-top-bar a.nav-btn:hover {
    background: rgba(124, 109, 255, 0.2);
    border-color: rgba(124, 109, 255, 0.3);
    color: #7c6dff;
  }

  .reader-top-bar a.nav-btn.next {
    background: linear-gradient(135deg, #7c6dff, #5a4de0);
    color: white;
    border: none;
  }

  .reader-top-bar a.nav-btn.next:hover {
    opacity: 0.9;
  }

  /* Mod butonları — mobilde gizle veya küçült */
  .mode-buttons {
    display: flex;
    gap: 4px;
  }

  .mode-btn {
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.12);
    cursor: pointer;
    background: transparent;
    color: #9395a8;
    transition: all 0.15s ease;
  }

  .mode-btn.active {
    background: rgba(124, 109, 255, 0.2);
    color: #9d91ff;
    border-color: rgba(124, 109, 255, 0.4);
  }

  .mode-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.06);
    color: #f0f0f5;
  }

  /* Tıklama ipuçları */
  #paged-img-wrap::before,
  #paged-img-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 25%;
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
    z-index: 2;
  }

  #paged-img-wrap::before {
    left: 0;
    background: linear-gradient(to right, rgba(124, 109, 255, 0.15), transparent);
  }

  #paged-img-wrap::after {
    right: 0;
    background: linear-gradient(to left, rgba(124, 109, 255, 0.15), transparent);
  }

  #paged-img-wrap:hover::before,
  #paged-img-wrap:hover::after {
    opacity: 1;
  }

  .click-hint {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 24px;
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
    z-index: 3;
    color: rgba(255, 255, 255, 0.5);
  }

  #paged-img-wrap:hover .click-hint {
    opacity: 1;
  }

  .click-hint.hint-left {
    left: 12px;
  }

  .click-hint.hint-right {
    right: 12px;
  }

  /* Sayfa göstergesi */
  #page-indicator,
  #paged-indicator {
    font-size: 12px;
    color: #9395a8;
  }

  /* Tema butonları */
  .theme-buttons {
    display: flex;
    gap: 4px;
  }

  .theme-btn {
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.12);
    cursor: pointer;
    background: transparent;
    color: #9395a8;
    transition: all 0.15s ease;
  }

  .theme-btn.active {
    background: rgba(124, 109, 255, 0.2);
    color: #9d91ff;
    border-color: rgba(124, 109, 255, 0.4);
  }

  .theme-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.06);
    color: #f0f0f5;
  }
}

/* ─── Çok Küçük Mobil (max-width: 480px) ──────────────────────────────────────── */
@media (max-width: 480px) {
  .reader-top-bar {
    padding: 8px 10px;
    gap: 6px;
  }

  .reader-top-bar a {
    font-size: 11px;
    max-width: 120px;
  }

  .reader-top-bar span {
    font-size: 11px;
  }

  .mode-btn,
  .theme-btn,
  .reader-top-bar a.nav-btn {
    padding: 5px 8px;
    font-size: 10px;
  }

  #paged-controls {
    padding: 10px 12px;
    gap: 6px;
  }

  .paged-nav-btn {
    padding: 6px 8px;
    font-size: 11px;
  }

  .click-hint {
    font-size: 20px;
  }

  .click-hint.hint-left {
    left: 8px;
  }

  .click-hint.hint-right {
    right: 8px;
  }
}

/* ─── Landscape Mode (Yatay) ──────────────────────────────────────────────────── */
@media (max-height: 500px) and (orientation: landscape) {
  #paged-reader {
    min-height: auto;
  }

  #paged-img-wrap {
    height: calc(100vh - 50px);
  }

  #paged-img {
    max-height: calc(100vh - 50px);
  }

  #paged-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
  }

  .reader-top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }
}

/* ─── Print Styles ────────────────────────────────────────────────────────────── */
@media print {
  .reader-top-bar,
  #paged-controls,
  .mode-buttons,
  .theme-buttons {
    display: none !important;
  }

  #webtoon-reader,
  #paged-reader {
    width: 100%;
    max-width: 100%;
  }
}
