.flipbook-container {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
}

.flipbook-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 500px;
    background: #2a2a2a;
    border-radius: 12px;
    padding: 30px 20px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
}

.flipbook-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 100%;
    background: linear-gradient(to right, rgba(0,0,0,0.3), rgba(0,0,0,0.1), rgba(0,0,0,0.3));
    z-index: 10;
    pointer-events: none;
}

/* Pagina singola: niente rilegatura, padding piu' arioso */
.flipbook-wrapper-single {
    min-height: auto;
    padding: 40px 20px;
}

.flipbook-wrapper-single::before {
    display: none;
}

.flipbook {
    position: relative;
}

.flipbook .page {
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.flipbook .page canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.flipbook .page-cover {
    background: linear-gradient(135deg, #b08d57 0%, #8a6d3b 100%);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
}

.flipbook .page-cover h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.flipbook .page-cover p {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Controls */
.flipbook-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.flip-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid #b08d57;
    background: white;
    color: #b08d57;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(176,141,87,0.3);
    -webkit-appearance: none;
    appearance: none;
    padding: 0;
}

.flip-btn:hover {
    background: #b08d57;
    color: white;
}

.flip-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

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

.flip-page-info {
    font-size: 0.9rem;
    color: var(--text-medium, #777);
    min-width: 100px;
    text-align: center;
}

/* Loading */
.flipbook-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: rgba(255,255,255,0.7);
    gap: 16px;
}

.flipbook-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: #b08d57;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.flipbook-loading p {
    font-size: 0.95rem;
}

/* Responsive */
@media (max-width: 768px) {
    .flipbook-wrapper {
        min-height: 520px;
        padding: 15px 5px;
        border-radius: 8px;
        touch-action: pan-y;
        -webkit-user-select: none;
        user-select: none;
    }

    .flipbook-wrapper::before {
        display: none;
    }

    .flipbook {
        touch-action: none;
        -webkit-touch-callout: none;
    }

    .flipbook-controls {
        gap: 15px;
        margin-top: 16px;
    }

    .flip-btn {
        width: 56px;
        height: 56px;
    }
    .flip-btn svg { width: 22px; height: 22px; }
    .flipbook-controls { gap: 18px; padding: 8px 0; }

    .flipbook-loading {
        min-height: 350px;
    }

    .flip-page-info {
        font-size: 0.85rem;
        font-weight: 500;
    }
}

@media (max-width: 480px) {
    .flipbook-wrapper {
        min-height: 500px;
        padding: 10px 4px;
        border-radius: 8px;
    }
}
