/**
 * E-Gazete sayı görüntüleyici (views/egazete/oku.ctp). Sitenin genel düzeninde, .egazete-okuyucu kutusunun içinde çalışır;
 * yükleme ekranı, kontrol çubuğu ve yan oklar bu kutuya göre konumlanır. Tam ekranda kutu ekranı kaplar.
 */
.egazete-okuyucu {
    --bar-bg: rgba(255, 255, 255, 0.90);
    --bar-border: rgba(0, 0, 0, 0.08);
    --text-dim: #666666;
    position: relative;
    height: calc(100vh - 140px);
    min-height: 560px;
    background-color: #ffffff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.egazete-okuyucu:fullscreen {
    height: 100vh;
    border-radius: 0;
}

.egazete-okuyucu:-webkit-full-screen {
    height: 100vh;
    border-radius: 0;
}

/* Sayfa alanı: üst ve alttan 50px boşluk */
.egazete-oku {
    padding: 50px 0;
}

/* Arşivdeki modalın içi (?modal=1, layouts/egazete): header ve footer yok, görüntüleyici tüm pencereyi kaplar */
body.egazete-modal {
    margin: 0;
    background-color: #ffffff;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    overflow: hidden;
}

body.egazete-modal .egazete-oku,
body.egazete-modal .container {
    max-width: none;
    margin: 0;
    padding: 0;
}

body.egazete-modal .egazete-okuyucu {
    height: 100vh;
    min-height: 0;
    border-radius: 0;
    box-shadow: none;
}

/* ===================================================
   YÜKLENİYOR EKRANI
=================================================== */
#loader {
    position: absolute;
    inset: 0;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid #f0f0f2;
    border-top-color: var(--primary-red);
    border-radius: 50%;
    animation: egazete-spin 0.8s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    margin-bottom: 16px;
}

@keyframes egazete-spin {
    to { transform: rotate(360deg); }
}

#load-status {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dim);
}

/* ===================================================
   EN ALTTA YÜZEN BLUR KONTROL ÇUBUĞU (TOOLBAR)
=================================================== */
header.egazete-bar {
    position: absolute;
    bottom: 16px;
    top: auto;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bar-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 4px 14px;
    height: 44px;
    border-radius: 9999px;
    border: 1px solid var(--bar-border);
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.04);
    white-space: nowrap;
}

.issue {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding-right: 12px;
    border-right: 1px solid var(--bar-border);
}

.issue-badge {
    background: var(--primary-red);
    color: #ffffff;
    font-weight: 700;
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 9999px;
    white-space: nowrap;
    line-height: 1.2;
}

.issue-date {
    color: #444444;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.controls {
    display: flex;
    gap: 3px;
    align-items: center;
}

.controls button,
.controls .download {
    background: transparent;
    border: none;
    color: #222222;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    outline: none;
}

.controls button:hover,
.controls .download:hover {
    background: rgba(224, 0, 0, 0.08);
    color: var(--primary-red);
}

.controls button:active,
.controls .download:active {
    transform: scale(0.92);
}

.controls button:disabled {
    opacity: 0.22;
    cursor: not-allowed;
    pointer-events: none;
}

.page-info {
    font-size: 13px;
    font-weight: 600;
    color: #111111;
    padding: 0 6px;
    min-width: 52px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.page-info .slash {
    color: #aaaaaa;
    font-size: 11px;
}

.page-info #page-total {
    color: #777777;
}

.divider {
    width: 1px;
    height: 18px;
    margin: 0 4px;
    background: var(--bar-border);
}

/* ===================================================
   YAN ÇEVİRME OKLARI (DESKTOP)
=================================================== */
.side-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 60px;
    background: var(--bar-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--bar-border);
    color: #222222;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 50;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, color 0.2s ease, opacity 0.2s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    outline: none;
}

.side-prev {
    left: 20px;
}

.side-next {
    right: 20px;
}

.side-nav:hover {
    background: var(--primary-red);
    border-color: var(--primary-red);
    color: #ffffff;
    transform: translateY(-50%) scale(1.06);
}

.side-nav:active {
    transform: translateY(-50%) scale(0.96);
}

.side-nav:disabled {
    opacity: 0.12;
    cursor: not-allowed;
    pointer-events: none;
}

/* ===================================================
   GAZETE GÖRÜNTÜLEYİCİ VE SAYFALAR
=================================================== */
#viewport {
    width: 100%;
    height: calc(100% - 76px);
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 2500px;
    position: relative;
    overflow: hidden;
    touch-action: none;
}

#flipbook {
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    user-select: none;
    -webkit-user-select: none;
    box-shadow: none !important;
    border: none !important;
    outline: none !important;
    transform-origin: center center;
    cursor: default;
    background: transparent;
    will-change: transform;
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

#flipbook.zoomed {
    cursor: grab;
}

#flipbook.zoomed:active {
    cursor: grabbing;
}

.page {
    background-color: #ffffff;
    position: relative;
    overflow: hidden;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform;
}

/* Sayfa katlanma / çerçeve / cilt gölgeleri sıfırlandı */
.page.even,
.page.odd {
    box-shadow: none !important;
    border: none !important;
}

.page canvas {
    width: 100%;
    height: 100%;
    display: block;
    background-color: #ffffff;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    image-rendering: -webkit-optimize-contrast;
}

/* Turn.js olası gölgelerini tamamen engelle */
.turn-page,
.turn-page-wrapper,
#flipbook .shadow,
#flipbook div[style*="box-shadow"] {
    box-shadow: none !important;
    border: none !important;
    outline: none !important;
}

/* ===================================================
   RESPONSIVE (MOBİL VE TABLET)
=================================================== */
@media (max-width: 991px) {
    .side-nav {
        display: none;
    }
}

@media (max-width: 768px) {
    header.egazete-bar {
        bottom: 10px;
        height: 40px;
        padding: 3px 10px;
        gap: 8px;
        max-width: 94%;
    }

    .issue-date {
        display: none;
    }

    .issue {
        padding-right: 8px;
    }

    .issue-badge {
        font-size: 10px;
        padding: 2.5px 7px;
    }

    .controls button,
    .controls .download {
        width: 28px;
        height: 28px;
    }

    .controls button svg,
    .controls .download svg {
        width: 14px;
        height: 14px;
    }

    .page-info {
        min-width: 44px;
        font-size: 12px;
        padding: 0 3px;
    }

    #viewport {
        height: calc(100% - 60px);
    }

    .egazete-okuyucu {
        height: calc(100vh - 120px);
        min-height: 460px;
    }

    .egazete-oku {
        padding: 30px 0;
    }

    body.egazete-modal .egazete-okuyucu {
        height: 100vh;
        min-height: 0;
    }

    body.egazete-modal .egazete-oku {
        padding: 0;
    }
}
