/**
 * Flip Book Styles
 * Modern flip book viewer for case studies
 */

.ac-flip-book-wrapper {
    width: 100%;
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 20px;
}

.ac-flip-book-container {
    position: relative;
    width: 100%;
    margin: 0 auto;
    perspective: 2000px;
    background: #f5f5f5;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    overflow: hidden;
}

.ac-flip-book {
    position: relative;
    width: 100%;
    height: 800px;
    transform-style: preserve-3d;
}

.ac-flip-book.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Book Pages */
.ac-book-page {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: white;
    padding: 40px;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
    transition: transform 0.8s ease;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

.ac-book-page.left-page {
    left: 0;
    border-right: 1px solid #ddd;
}

.ac-book-page.right-page {
    left: 50%;
    border-left: 1px solid #ddd;
}

.ac-book-page.flipping {
    z-index: 100;
}

/* Page content styling */
.ac-book-page h1,
.ac-book-page h2,
.ac-book-page h3,
.ac-book-page h4,
.ac-book-page h5,
.ac-book-page h6 {
    margin-top: 0;
    margin-bottom: 16px;
    color: #333;
}

.ac-book-page p {
    margin-bottom: 16px;
    line-height: 1.8;
    color: #444;
}

.ac-book-page img {
    max-width: 100%;
    height: auto;
    margin: 20px 0;
    border-radius: 4px;
}

.ac-book-page ul,
.ac-book-page ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.ac-book-page li {
    margin-bottom: 8px;
    line-height: 1.6;
}

/* Page numbers */
.ac-page-number {
    position: absolute;
    bottom: 20px;
    font-size: 12px;
    color: #999;
    font-style: italic;
}

.ac-book-page.left-page .ac-page-number {
    left: 40px;
}

.ac-book-page.right-page .ac-page-number {
    right: 40px;
}

/* Navigation Controls */
.ac-flip-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    background: white;
    border-top: 1px solid #ddd;
}

.ac-flip-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    background: var(--accent-color, #0066cc);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    gap: 8px;
}

.ac-flip-btn:hover:not(:disabled) {
    background: var(--accent-hover-color, #0052a3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,102,204,0.3);
}

.ac-flip-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.ac-flip-btn i {
    font-size: 16px;
}

.ac-page-indicator {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* Zoom controls */
.ac-zoom-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.ac-zoom-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ac-zoom-btn:hover {
    background: #e0e0e0;
}

.ac-zoom-btn i {
    font-size: 16px;
    color: #666;
}

/* Fullscreen mode */
.ac-flip-book-wrapper.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    max-width: none;
    margin: 0;
    padding: 0;
    z-index: 9999;
    background: #f5f5f5;
    border-radius: 0;
}

.ac-flip-book-wrapper.fullscreen .ac-flip-book-container {
    height: calc(100vh - 80px);
    border-radius: 0;
}

.ac-flip-book-wrapper.fullscreen .ac-flip-book {
    height: calc(100vh - 160px);
}

/* Fullscreen toggle button */
.ac-fullscreen-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ac-fullscreen-btn:hover {
    background: #e0e0e0;
}

.ac-fullscreen-btn i {
    font-size: 16px;
    color: #666;
}

/* Loading state */
.ac-flip-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.ac-flip-loader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--accent-color, #0066cc);
    border-radius: 50%;
    animation: ac-spin 1s linear infinite;
}

@keyframes ac-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.ac-flip-loader-text {
    margin-top: 16px;
    color: #666;
    font-size: 14px;
}

/* Flip animation */
@keyframes flip-left {
    0% {
        transform: rotateY(0deg);
    }
    100% {
        transform: rotateY(-180deg);
    }
}

@keyframes flip-right {
    0% {
        transform: rotateY(0deg);
    }
    100% {
        transform: rotateY(180deg);
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .ac-flip-book {
        height: 600px;
    }
    
    .ac-book-page {
        padding: 30px;
    }
}

@media (max-width: 768px) {
    .ac-flip-book-wrapper {
        padding: 0 10px;
    }
    
    .ac-flip-book {
        height: 500px;
    }
    
    .ac-book-page {
        width: 100%;
        padding: 20px;
    }
    
    .ac-book-page.left-page {
        display: none;
    }
    
    .ac-book-page.right-page {
        left: 0;
        border-left: none;
    }
    
    .ac-flip-controls {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .ac-flip-btn {
        padding: 10px 20px;
        font-size: 13px;
    }
}

/* PDF Flip Book Styles */
.ac-pdf-flip-book-wrapper {
    width: 100%;
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 20px;
}

.ac-pdf-flip-book-container {
    position: relative;
    width: 100%;
    margin: 0 auto;
    background: #f5f5f5;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    overflow: hidden;
}

.ac-pdf-flip-book {
    position: relative;
    width: 100%;
    height: 800px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
}

.ac-pdf-flip-book canvas {
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border-radius: 4px;
}

/* Two-page spread layout */
.pdf-pages-container {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 20px;
}

.pdf-page {
    flex: 1;
    max-width: 50%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border-radius: 4px;
    background: white;
}

.pdf-page.left-page {
    border-right: 1px solid #ddd;
}

.pdf-page.right-page {
    border-left: 1px solid #ddd;
}

.ac-pdf-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    z-index: 10;
}

/* PDF-specific controls */
.ac-pdf-flip-book-wrapper .ac-flip-controls {
    background: white;
    border-top: 1px solid #ddd;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

/* Fullscreen for PDF */
.ac-pdf-flip-book-wrapper.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    max-width: none;
    margin: 0;
    padding: 0;
    z-index: 9999;
    background: #f5f5f5;
    border-radius: 0;
}

.ac-pdf-flip-book-wrapper.fullscreen .ac-pdf-flip-book-container {
    height: calc(100vh - 80px);
    border-radius: 0;
}

.ac-pdf-flip-book-wrapper.fullscreen .ac-pdf-flip-book {
    height: calc(100vh - 160px);
}

/* Responsive PDF */
@media (max-width: 1024px) {
    .ac-pdf-flip-book {
        height: 600px;
    }
}

@media (max-width: 768px) {
    .ac-pdf-flip-book-wrapper {
        padding: 0 10px;
    }
    
    .ac-pdf-flip-book {
        height: 500px;
    }
    
    /* Mobile: Single page view */
    .pdf-pages-container {
        flex-direction: column;
        gap: 5px;
    }
    
    .pdf-page {
        max-width: 100%;
        width: 100%;
    }
    
    .pdf-page.right-page {
        display: none; /* Hide right page on mobile */
    }
    
    .ac-pdf-flip-book-wrapper .ac-flip-controls {
        flex-wrap: wrap;
        gap: 10px;
        padding: 15px;
    }
}

/* Print styles */
@media print {
    .ac-flip-controls,
    .ac-zoom-controls,
    .ac-fullscreen-btn {
        display: none !important;
    }
    
    .ac-flip-book-wrapper,
    .ac-pdf-flip-book-wrapper {
        max-width: none;
        margin: 0;
        padding: 0;
    }
    
    .ac-flip-book-container,
    .ac-pdf-flip-book-container {
        box-shadow: none;
        border-radius: 0;
    }
    
    .ac-book-page {
        position: relative;
        width: 100%;
        height: auto;
        page-break-inside: avoid;
        box-shadow: none;
        border: none;
    }
    
    .ac-pdf-flip-book canvas {
        box-shadow: none;
        border-radius: 0;
    }
}

