/**
 * PDF Flipbook Interactive - Frontend CSS
 * Version 2.1.9
 */

/* Container */
.pfi-flipbook-container {
    position: relative;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 8px;
    overflow: hidden;
    width: 100%;
    min-height: 500px;
    display: flex;
    flex-direction: column;
}

/* Wrapper - flipbook area */
.pfi-flipbook-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.pfi-flipbook {
    display: block;
}

.pfi-page {
    background: #fff;
}

.pfi-page img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Navigation - ALLTID längst ner */
.pfi-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   Pages
   ========================================================================== */

.pfi-page {
    position: relative;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.pfi-page img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

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

/* ==========================================================================
   Hotspots
   ========================================================================== */

.pfi-hotspot {
    position: absolute;
    cursor: pointer;
    pointer-events: auto;
    border: 2px solid transparent;
    border-radius: 4px;
    transition: all 0.3s ease;
    background: rgba(59, 130, 246, 0.1);
}

.pfi-hotspot:hover {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.6);
    transform: scale(1.02);
}

.pfi-hotspot-link {
    background: rgba(34, 197, 94, 0.1);
}

.pfi-hotspot-link:hover {
    background: rgba(34, 197, 94, 0.3);
    border-color: rgba(34, 197, 94, 0.6);
}

.pfi-hotspot-video {
    background: rgba(239, 68, 68, 0.1);
}

.pfi-hotspot-video:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.6);
}

.pfi-hotspot-video::after {
    content: '▶';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   Navigation
   ========================================================================== */

.pfi-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
}

.pfi-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pfi-nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

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

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

.pfi-page-counter {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    padding: 0 16px;
    min-width: 80px;
    text-align: center;
}

/* ==========================================================================
   Loading
   ========================================================================== */

.pfi-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(26, 26, 46, 0.95);
    z-index: 100;
}

.pfi-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: pfi-spin 1s linear infinite;
}

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

.pfi-loading p {
    margin-top: 16px;
    color: #fff;
    font-size: 14px;
}

/* ==========================================================================
   Error
   ========================================================================== */

.pfi-error {
    padding: 40px;
    text-align: center;
    color: #ef4444;
    background: #fef2f2;
    border-radius: 8px;
}

/* ==========================================================================
   Modal
   ========================================================================== */

.pfi-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    box-sizing: border-box;
}

.pfi-modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    max-width: 90%;
    max-height: 90%;
    overflow: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.pfi-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
}

.pfi-modal-close:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.pfi-modal-body {
    padding: 20px;
}

.pfi-modal-body img {
    display: block;
    max-width: 100%;
    height: auto;
}

.pfi-modal-body iframe {
    display: block;
    width: 100%;
    min-width: 560px;
    height: 315px;
    border: none;
}

.pfi-modal-body video {
    display: block;
    max-width: 100%;
}

.pfi-modal-body h3 {
    margin: 0 0 16px;
    font-size: 20px;
}

/* Modal Form */
.pfi-modal-body .pfi-form {
    min-width: 300px;
}

.pfi-modal-body .pfi-form-group {
    margin-bottom: 16px;
}

.pfi-modal-body .pfi-form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
}

.pfi-modal-body .pfi-form-group input,
.pfi-modal-body .pfi-form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}

.pfi-modal-body .pfi-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.pfi-modal-body button[type="submit"] {
    width: 100%;
    padding: 12px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.pfi-modal-body button[type="submit"]:hover {
    background: #2563eb;
}

/* ==========================================================================
   Fullscreen
   ========================================================================== */

.pfi-flipbook-container:fullscreen {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
}

.pfi-flipbook-container:fullscreen .pfi-flipbook-wrapper {
    height: calc(100vh - 72px);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .pfi-flipbook-wrapper {
        padding: 10px;
    }
    
    .pfi-navigation {
        padding: 12px;
        gap: 4px;
    }
    
    .pfi-nav-btn {
        width: 36px;
        height: 36px;
    }
    
    .pfi-page-counter {
        font-size: 12px;
        padding: 0 8px;
        min-width: 60px;
    }
    
    .pfi-modal-body iframe {
        min-width: 100%;
        height: 200px;
    }
}

/* ==========================================================================
   PageFlip Library Overrides
   ========================================================================== */

.stf__parent {
    margin: 0 auto;
}

.stf__wrapper {
    perspective: 2000px;
}

.stf__block {
    background: #fff;
}

/* ==========================================================================
   Fullscreen Overlay (utan WP header/footer)
   ========================================================================== */

.pfi-fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 100%);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pfi-fullscreen-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.pfi-fullscreen-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #fff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.pfi-fullscreen-close:hover {
    background: #ef4444;
    border-color: #ef4444;
    transform: scale(1.1);
}

.pfi-fullscreen-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-height: calc(100vh - 120px);
}

.pfi-fullscreen-content .pfi-flipbook {
    max-width: 100%;
    max-height: 100%;
}

.pfi-fullscreen-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50px;
    margin-top: 20px;
}

.pfi-fullscreen-nav .pfi-nav-btn {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pfi-fullscreen-nav .pfi-nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.pfi-fullscreen-nav .pfi-nav-btn svg {
    width: 24px;
    height: 24px;
}

.pfi-fs-counter {
    color: #fff;
    font-size: 18px;
    font-weight: 500;
    padding: 0 20px;
    min-width: 100px;
    text-align: center;
}
