/* ========================================
   BOOK VIEWER STYLES
   ======================================== */

#book-viewer {
    background: #000;
    color: #fff;
}

/* Hide header and footer in fullscreen mode */
#book-viewer:fullscreen .viewer-header,
#book-viewer:fullscreen .viewer-footer,
#book-viewer:-webkit-full-screen .viewer-header,
#book-viewer:-webkit-full-screen .viewer-footer,
#book-viewer:-moz-full-screen .viewer-header,
#book-viewer:-moz-full-screen .viewer-footer,
#book-viewer:-ms-fullscreen .viewer-header,
#book-viewer:-ms-fullscreen .viewer-footer {
    display: none;
}

.book-viewer-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: none;
    padding: 0;
    position: relative;
}

.viewer-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 200;
    pointer-events: auto;
}

.viewer-header button {
    pointer-events: auto !important;
    z-index: 201;
}

.viewer-title {
    font-size: 24px;
    font-weight: 600;
    color: #fff;
}

.viewer-slideshow {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    touch-action: pan-y pinch-zoom;
}

.viewer-slide-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.viewer-slide {
    display: none;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-in-out;
    pointer-events: none;
}

.viewer-slide.active {
    display: flex;
}

.viewer-slide img {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    user-select: none;
    -webkit-user-drag: none;
    cursor: pointer;
    transition: transform 0.2s ease;
    pointer-events: auto;
}

/* Image fullscreen styles - when individual image is in fullscreen */
img:fullscreen,
img:-webkit-full-screen,
img:-moz-full-screen,
img:-ms-fullscreen {
    width: 100vw;
    height: 100vh;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    background: #000;
}

/* Add subtle tap feedback on mobile */
@media (max-width: 768px) {
    .viewer-slide img:active {
        transform: scale(0.98);
    }
}

.viewer-nav {
    display: none !important;
}

.viewer-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0) 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 100;
}

.viewer-page-info {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.7);
}

.viewer-page-info #viewer-current-page {
    color: #fff;
    font-weight: 600;
    font-size: 24px;
}

.viewer-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.viewer-fullscreen-btn {
    position: absolute;
    bottom: 95px;
    right: 40px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 150;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
    user-select: none;
    -webkit-user-select: none;
}

/* Minimal fullscreen button in native fullscreen mode */
#book-viewer:fullscreen .viewer-fullscreen-btn,
#book-viewer:-webkit-full-screen .viewer-fullscreen-btn,
#book-viewer:-moz-full-screen .viewer-fullscreen-btn,
#book-viewer:-ms-fullscreen .viewer-fullscreen-btn {
    bottom: 15px;
    right: 15px;
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.5);
    opacity: 0.9;
    z-index: 2147483647;
    pointer-events: auto !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.3) !important;
    position: fixed !important;
    animation: gentlePulse 2s ease-in-out infinite;
}

#book-viewer:fullscreen .viewer-fullscreen-btn:hover,
#book-viewer:-webkit-full-screen .viewer-fullscreen-btn:hover,
#book-viewer:-moz-full-screen .viewer-fullscreen-btn:hover,
#book-viewer:-ms-fullscreen .viewer-fullscreen-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.viewer-fullscreen-btn i {
    font-size: 20px;
    pointer-events: none;
    user-select: none;
}

.viewer-fullscreen-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

/* Hint tooltip for mobile users */
.viewer-hint {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 12px 20px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 100001;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.viewer-hint.show {
    opacity: 1;
}

.viewer-hint i {
    margin-right: 8px;
    color: var(--primary);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .viewer-header {
        padding: 15px 20px;
    }

    .viewer-title {
        font-size: 18px;
    }

    .viewer-nav {
        width: 50px;
        height: 50px;
    }

    .viewer-nav-prev {
        left: 10px;
    }

    .viewer-nav-next {
        right: 10px;
    }

    .viewer-footer {
        padding: 15px 20px;
        flex-direction: column;
        gap: 12px;
    }

    .viewer-page-info {
        font-size: 16px;
    }

    .viewer-actions {
        width: 100%;
        justify-content: center;
    }

    .viewer-actions .btn {
        flex: 1;
        padding: 10px 16px;
        font-size: 14px;
    }

    .viewer-slide img {
        max-width: 98%;
        max-height: 98%;
    }

    .viewer-fullscreen-btn {
        width: 45px;
        height: 45px;
        bottom: 100px;
        right: 15px;
        background: rgba(0, 0, 0, 0.6);
        border: 1px solid rgba(255, 255, 255, 0.4);
        pointer-events: auto;
        opacity: 0.8;
    }
    
    .viewer-fullscreen-btn:hover {
        opacity: 1;
    }
}
