/**
 * Flipbook Viewer Styles
 */

body {
    margin: 0;
    font-family: sans-serif;
    background: #1a1a1a;
    color: #fff;
}

.flipbook-container {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.flipbook-wrapper {
    position: relative;
    width: 100%;
    height: calc(100vh - 70px);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    overflow: hidden;
}

.flipbook-book {
    position: relative;
    transition: transform 0.2s ease-out;
}

/* Drag/pan cursor states */

.flipbook-wrapper.flipbook-draggable {
    cursor: grab;
}

.flipbook-wrapper.flipbook-dragging {
    cursor: grabbing;
}

.flipbook-wrapper.flipbook-dragging .flipbook-book {
    transition: none;
}

/* Side navigation arrows */

.flipbook-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    border: none;
    color: white;
    cursor: pointer;
    z-index: 10;
    transition: background-color 0.2s, opacity 0.2s;
    opacity: 0.7;
}

.flipbook-nav:hover {
    background: rgba(0, 0, 0, 0.7);
    opacity: 1;
}

.flipbook-nav:active {
    background: rgba(0, 0, 0, 0.8);
}

.flipbook-nav svg {
    width: 32px;
    height: 32px;
}

.flipbook-nav-prev {
    left: 0;
    border-radius: 0 8px 8px 0;
}

.flipbook-nav-next {
    right: 0;
    border-radius: 8px 0 0 8px;
}

/* Page styles */

.flipbook-page {
    background-color: white;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    position: relative;
}

.flipbook-page-canvas {
    display: block;
    width: 100%;
    height: auto;
}

/* PDF Links layer */

.flipbook-links-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.flipbook-link {
    position: absolute;
    pointer-events: auto;
    cursor: pointer;
    border-radius: 2px;
    transition: background-color 0.15s ease;
}

.flipbook-link:hover {
    background-color: rgba(0, 100, 200, 0.15);
}

/* Controls */

.flipbook-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #2a2a2a;
    border-top: 1px solid #3a3a3a;
}

.flipbook-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: #444;
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.flipbook-btn:hover {
    background: #555;
}

.flipbook-btn:active {
    transform: scale(0.95);
}

.flipbook-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.flipbook-btn svg {
    width: 20px;
    height: 20px;
}

a.flipbook-btn {
    text-decoration: none;
}

.flipbook-page-info {
    color: #fff;
    font-size: 14px;
    padding: 0 10px;
    user-select: none;
}

.flipbook-current-page,
.flipbook-total-pages {
    font-weight: 600;
}

/* Zoom controls */

.flipbook-zoom-info {
    color: #fff;
    font-size: 14px;
    padding: 0 5px;
    user-select: none;
    min-width: 45px;
    text-align: center;
}

.flipbook-zoom-level {
    font-weight: 600;
}

.flipbook-divider {
    width: 1px;
    height: 24px;
    background: #555;
    margin: 0 5px;
}

/* Loading */

.flipbook-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(26, 26, 26, 0.95);
    z-index: 100;
}

.flipbook-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #333;
    border-top-color: #fff;
    border-radius: 50%;
    animation: flipbook-spin 1s linear infinite;
}

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

.flipbook-loading-text {
    color: #fff;
    margin-top: 15px;
    font-size: 14px;
}

/* Error state */

.flipbook-error {
    color: #ff6b6b;
    text-align: center;
    padding: 40px;
    font-size: 16px;
}

/* Fullscreen styles */

.flipbook-container:fullscreen {
    max-width: none;
    border-radius: 0;
}

/* Responsive */

@media (max-width: 768px) {

    .flipbook-wrapper {
        height: calc(100vh - 60px);
        padding: 10px;
    }

    .flipbook-controls {
        padding: 10px;
        gap: 10px;
    }

    .flipbook-btn {
        width: 36px;
        height: 36px;
    }

    .flipbook-btn svg {
        width: 18px;
        height: 18px;
    }

    .flipbook-page-info {
        font-size: 12px;
    }

    .flipbook-nav {
        width: 40px;
        height: 60px;
    }

    .flipbook-nav svg {
        width: 24px;
        height: 24px;
    }
}

@media (max-width: 480px) {

    .flipbook-nav {
        width: 32px;
        height: 50px;
    }

    .flipbook-nav svg {
        width: 20px;
        height: 20px;
    }
}

/* StPageFlip overrides */

.stf__wrapper {
    margin: 0 auto;
}

.stf__parent {
    display: flex;
    justify-content: center;
}

.stf__block {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Page turn shadow effect */

.stf__item {
    background-color: #fff;
}

/* Hard cover effect for first and last page */

.flipbook-page:first-child,
.flipbook-page:last-child {
    background: linear-gradient(to right, #f0f0f0, #fff);
}
