/* === Idem Dergi Viewer Stilleri === */

:root {
    --filmstrip-height: 150px;
    --filmstrip-bottom-gap: 6px;
}

.viewer-body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    overscroll-behavior: none;
}

.viewer-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    background: #1a1a1a;
    position: relative;
    overflow: hidden;
}
/* Araç çubuğu */
.viewer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 1rem;
    background: #222;
    border-bottom: 1px solid #333;
    z-index: 10;
    flex-shrink: 0;
}

.toolbar-left,
.toolbar-center,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toolbar-center {
    font-size: 0.9rem;
}

/* Marka bağlantısı */
.viewer-brand {
    color: #fff;
    font-weight: bold;
    font-size: 1.1rem;
    text-decoration: none;
    margin-right: 0.25rem;
}

.viewer-brand:hover {
    color: #ccc;
}

/* Bölüm paneli */
.sections-panel {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    background: #2a2a2a;
    border-right: 1px solid #444;
    z-index: 20;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sections-panel.hidden {
    transform: translateX(-100%);
}

.sections-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #444;
    color: #ddd;
}

.sections-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex: 1;
}

.sections-list li {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid #333;
    cursor: pointer;
    color: #ccc;
    font-size: 0.85rem;
    transition: background-color 0.2s;
}

.sections-list li:hover {
    background: #3a3a3a;
    color: #fff;
}

.sections-list li .section-type {
    font-size: 0.85rem;
    color: #eee;
    font-weight: 600;
}

.sections-list li .section-title {
    display: block;
    font-size: 0.78rem;
    color: #999;
    margin-top: 2px;
}

.sections-list li .section-pages {
    font-size: 0.7rem;
    color: #666;
    float: right;
    margin-top: 2px;
}

/* Ana Swiper alanı */
#page-swiper {
    flex: 1;
    width: 100%;
    min-height: 0; /* flexbox tasma duzeltmesi */
    overflow: hidden;
    touch-action: none;
}
#page-swiper .swiper-wrapper {
    height: 100%;
}

#page-swiper .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: #1a1a1a;
}

/* Tek sayfa yayılması (kapak, arka kapak) */
#page-swiper .swiper-slide.spread-single {
    justify-content: center;
}

/* Çift sayfa yayılması */
#page-swiper .swiper-slide.spread-double {
    overflow: hidden;
}

#page-swiper .swiper-slide img.page-image {
    display: block;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

/* Çift sayfa kapsayıcı — iki sayfa tek birim olarak yakınlaşır */
#page-swiper .swiper-slide.spread-double .spread-content {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    transition: transform 0.1s ease-out;
    transform-origin: center center;
    will-change: transform;
}

#page-swiper .swiper-slide.spread-double .spread-content img.page-image {
    max-height: 100%;
    max-width: 50vw;
}

/* Tek sayfa — doğrudan resme transform uygulanır */
#page-swiper .swiper-slide.spread-single img.page-image {
    max-width: 100%;
    transition: transform 0.1s ease-out;
    transform-origin: center center;
    will-change: transform;
}

/* Film seridi ipucu tutamaci - kucuk ortalanmis hap */
.filmstrip-handle {
    position: absolute;
    bottom: calc(var(--filmstrip-bottom-gap) + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    width: 56px;
    height: 22px;
    background: rgba(60, 60, 60, 0.8);
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 30;
    pointer-events: auto;
    transition: bottom 0.3s ease, background-color 0.2s;
}

.filmstrip-handle-icon {
    color: #aaa;
    font-size: 0.55rem;
    transition: transform 0.3s ease;
    line-height: 1;
}

.filmstrip-handle:hover {
    background: rgba(80, 80, 80, 0.9);
}

.filmstrip-handle:hover .filmstrip-handle-icon {
    color: #ddd;
}

/* Film seridi gorunur oldugunda tutamaci yukari kaydir */
.filmstrip-handle.filmstrip-visible {
    bottom: calc(var(--filmstrip-height) + var(--filmstrip-bottom-gap) + env(safe-area-inset-bottom));
}

.filmstrip-handle.filmstrip-visible .filmstrip-handle-icon {
    transform: rotate(180deg);
}

/* Film seridi kaplama */
.filmstrip-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(17, 17, 17, 0.95);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-top: 1px solid #333;
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
    height: calc(var(--filmstrip-height) + env(safe-area-inset-bottom));
    z-index: 25;
    pointer-events: auto;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.filmstrip-container.filmstrip-visible {
    transform: translateY(0);
}

#filmstrip-swiper {
    height: 100%;
}

#filmstrip-swiper .swiper-slide {
    width: auto !important;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
    padding: 2px;
}

#filmstrip-swiper .swiper-slide.filmstrip-active {
    opacity: 1;
    border: 2px solid #0d6efd;
    border-radius: 3px;
    padding: 0;
}

#filmstrip-swiper .swiper-slide img {
    width: 100px;
    height: auto;
    display: block;
}

/* Duyarli ayarlar */
@media (max-width: 992px), (hover: none) and (pointer: coarse) {
    :root {
        --filmstrip-height: 120px;
    }

    #filmstrip-swiper .swiper-slide img {
        width: 84px;
        height: auto;
    }
}

@media (max-width: 576px) {
    :root {
        --filmstrip-height: 110px;
    }

    .viewer-toolbar {
        padding: 0.3rem 0.5rem;
    }

    .viewer-brand {
        font-size: 0.95rem;
    }

    .sections-panel {
        width: 100%;
    }

    #filmstrip-swiper .swiper-slide img {
        width: 72px;
        height: auto;
    }

    #btn-sections {
        font-size: 0.75rem;
        padding: 0.2rem 0.4rem;
    }
}
