/* =====================================================
   MENU FLIPBOOK - Modern Sayfa Çeviren Menü Görüntüleyici
   izbel.com.tr için özel tasarım
   ===================================================== */

/* Ana Modal Container */
#menuFlipbookModal .modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    border: none;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
}

#menuFlipbookModal .modal-header {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 1.5rem;
}

#menuFlipbookModal .modal-title {
    color: #fff;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#menuFlipbookModal .modal-title i {
    color: #4ade80;
}

#menuFlipbookModal .btn-close {
    filter: invert(1);
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

#menuFlipbookModal .btn-close:hover {
    opacity: 1;
}

/* Flipbook Container */
.flipbook-container {
    position: relative;
    width: 100%;
    height: 75vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, #2d3748 0%, #1a202c 100%);
    overflow: hidden;
    perspective: 2000px;
}

/* Kitap Wrapper */
.book-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-style: preserve-3d;
}

/* Sayfa Container */
.page-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 90%;
    max-height: 90%;
}

/* PDF Sayfa */
.pdf-page {
    background: #fff;
    border-radius: 8px;
    box-shadow:
        0 0 20px rgba(0, 0, 0, 0.3),
        0 0 60px rgba(0, 0, 0, 0.2),
        inset 0 0 80px rgba(0, 0, 0, 0.05);
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    transform-origin: center center;
    position: relative;
    overflow: hidden;
}

.pdf-page::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 30px;
    height: 100%;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.1) 0%, transparent 100%);
    pointer-events: none;
}

.pdf-page::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 30px;
    height: 100%;
    background: linear-gradient(-90deg, rgba(0, 0, 0, 0.05) 0%, transparent 100%);
    pointer-events: none;
}

/* Canvas Container */
.canvas-container {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 4px;
}

.canvas-container canvas {
    display: block;
    /* Yüksek kaliteli render için */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    -ms-interpolation-mode: bicubic;
    /* Smooth scaling */
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Navigasyon Okları */
.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0.7;
}

.nav-arrow:hover {
    background: rgba(74, 222, 128, 0.3);
    border-color: #4ade80;
    transform: translateY(-50%) scale(1.1);
    opacity: 1;
}

.nav-arrow:active {
    transform: translateY(-50%) scale(0.95);
}

.nav-arrow.disabled {
    opacity: 0.2;
    cursor: not-allowed;
    pointer-events: none;
}

.nav-arrow.prev {
    left: 20px;
}

.nav-arrow.next {
    right: 20px;
}

/* Sayfa Çevirme Animasyonu */
.page-flip-left {
    animation: flipLeft 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

.page-flip-right {
    animation: flipRight 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes flipLeft {
    0% {
        transform: rotateY(0deg);
    }

    50% {
        transform: rotateY(-15deg) scale(0.95);
    }

    100% {
        transform: rotateY(0deg);
    }
}

@keyframes flipRight {
    0% {
        transform: rotateY(0deg);
    }

    50% {
        transform: rotateY(15deg) scale(0.95);
    }

    100% {
        transform: rotateY(0deg);
    }
}

/* Sayfa Bilgisi */
.page-info {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    padding: 10px 25px;
    border-radius: 30px;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 50;
}

.page-info .page-number {
    color: #4ade80;
    font-weight: 700;
}

.page-info .page-dots {
    display: flex;
    gap: 6px;
}

.page-info .page-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.page-info .page-dot.active {
    background: #4ade80;
    transform: scale(1.3);
}

.page-info .page-dot:hover:not(.active) {
    background: rgba(255, 255, 255, 0.6);
}

/* Yükleme Durumu */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(26, 26, 46, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #4ade80;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    margin-top: 20px;
    color: #fff;
    font-size: 1rem;
    font-weight: 500;
}

.loading-progress {
    margin-top: 15px;
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4ade80, #22d3ee);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}

/* Hata Durumu */
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-align: center;
    padding: 40px;
}

.error-state i {
    font-size: 4rem;
    color: #f87171;
    margin-bottom: 20px;
}

.error-state h4 {
    margin-bottom: 10px;
    font-weight: 600;
}

.error-state p {
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 20px;
}

.error-state .btn-retry {
    background: linear-gradient(135deg, #4ade80, #22d3ee);
    color: #1a1a2e;
    border: none;
    padding: 10px 30px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.error-state .btn-retry:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(74, 222, 128, 0.3);
}

/* Modal Footer */
#menuFlipbookModal .modal-footer {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-actions {
    display: flex;
    gap: 10px;
}

.footer-actions .btn {
    border-radius: 25px;
    padding: 8px 20px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.footer-actions .btn-download {
    background: linear-gradient(135deg, #4ade80, #22d3ee);
    color: #1a1a2e;
    border: none;
}

.footer-actions .btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(74, 222, 128, 0.3);
}

.footer-actions .btn-close-modal {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.footer-actions .btn-close-modal:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Download Hint Banner */
.download-hint-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.15), rgba(34, 211, 238, 0.1));
    border: 1px solid rgba(74, 222, 128, 0.3);
    border-radius: 10px;
    padding: 10px 16px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    line-height: 1.4;
    animation: hintPulse 3s ease-in-out infinite;
    flex: 1;
    max-width: 400px;
}

.download-hint-banner i {
    color: #4ade80;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.download-hint-banner strong {
    color: #4ade80;
}

@keyframes hintPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.2);
    }

    50% {
        box-shadow: 0 0 15px 2px rgba(74, 222, 128, 0.15);
    }
}

/* Mobil için hint banner düzenlemesi */
@media (max-width: 768px) {
    .download-hint-banner {
        font-size: 0.75rem;
        padding: 8px 12px;
        gap: 8px;
        max-width: 100%;
        text-align: center;
        justify-content: center;
    }

    .download-hint-banner i {
        font-size: 1rem;
    }
}

/* Zoom Kontrolleri */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.zoom-controls .btn-zoom {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.zoom-controls .btn-zoom:hover {
    background: rgba(255, 255, 255, 0.2);
}

.zoom-controls .zoom-level {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    min-width: 50px;
    text-align: center;
}

/* Mobil Responsive */
@media (max-width: 768px) {
    .flipbook-container {
        height: 60vh;
    }

    .nav-arrow {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }

    .nav-arrow.prev {
        left: 10px;
    }

    .nav-arrow.next {
        right: 10px;
    }

    .page-info {
        padding: 8px 15px;
        font-size: 0.8rem;
        bottom: 10px;
    }

    .page-info .page-dots {
        display: none;
    }

    .zoom-controls {
        display: none;
    }

    #menuFlipbookModal .modal-footer {
        flex-direction: column;
        gap: 10px;
    }

    .footer-actions {
        width: 100%;
        justify-content: center;
    }
}

/* Resim Görüntüleme (PDF değil ise) */
.image-viewer {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 20px;
}

.image-viewer img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

/* Touch Swipe Desteği */
.flipbook-container.touch-active {
    cursor: grab;
}

.flipbook-container.touch-active:active {
    cursor: grabbing;
}

/* Fullscreen Modu */
#menuFlipbookModal.fullscreen .modal-dialog {
    max-width: 100%;
    width: 100%;
    height: 100%;
    margin: 0;
}

#menuFlipbookModal.fullscreen .modal-content {
    height: 100%;
    border-radius: 0;
}

#menuFlipbookModal.fullscreen .flipbook-container {
    height: calc(100vh - 120px);
}

.btn-fullscreen {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-fullscreen:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Thumbnail Şeridi (Opsiyonel) */
.thumbnail-strip {
    position: absolute;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    max-width: 80%;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.thumbnail-strip::-webkit-scrollbar {
    display: none;
}

.thumbnail-item {
    width: 40px;
    height: 55px;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    flex-shrink: 0;
}

.thumbnail-item.active {
    opacity: 1;
    border-color: #4ade80;
}

.thumbnail-item:hover:not(.active) {
    opacity: 0.9;
}

.thumbnail-item canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Sayfa 5'den az ise thumbnail'leri gizle */
.thumbnail-strip.hide {
    display: none;
}