/**
 * Styles pour le visualiseur PDF protégé
 * Version 2.0 Premium - Flipbook 3D avec particules et effets
 * Optimisé et sans doublons
 */

/* ========================================
   VARIABLES CSS
======================================== */

:root {
    --primary-color: #007bff;
    --primary-dark: #0056b3;
    --secondary-color: #667eea;
    --secondary-dark: #764ba2;
    --dark-bg: #1a1a1a;
    --darker-bg: #0d0d0d;
    --medium-dark: #2c2c2c;
    --light-border: #404040;
    --white: #ffffff;
    --transition-fast: 0.2s;
    --transition-normal: 0.3s;
    --transition-slow: 0.5s; 
}

/* ========================================
   MODAL PRINCIPAL
======================================== */

.pdf-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.pdf-modal.active {
    display: flex;
}

.pdf-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
}

.pdf-modal-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    height: 90vh;
    background: var(--medium-dark);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: background var(--transition-normal) ease;
}

.pdf-modal-content:fullscreen {
    width: 100%;
    height: 100vh;
    max-width: none;
    border-radius: 0;
}

.pdf-modal-content:fullscreen .pdf-viewer-container {
    background: #000;
}

/* ========================================
   HEADER
======================================== */

.pdf-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--dark-bg);
    border-bottom: 1px solid var(--light-border);
    position: relative;
    flex-shrink: 0;
}

.pdf-header::after {
    content: '🔒 Protégé';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: #888;
    opacity: 0.5;
}

.pdf-close {
    background: none;
    border: none;
    color: var(--white);
    font-size: 32px;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all var(--transition-fast);
}

.pdf-close:hover {
    background: var(--light-border);
    transform: rotate(90deg);
}

/* ========================================
   SÉLECTEUR DE LANGUE
======================================== */

.pdf-lang-selector {
    display: flex;
    gap: 8px;
}

.pdf-lang-btn {
    background: #333;
    border: 2px solid transparent;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 20px;
    cursor: pointer;
    transition: all var(--transition-fast);
    opacity: 0.6;
}

.pdf-lang-btn:hover {
    opacity: 1;
    background: var(--light-border);
}

.pdf-lang-btn.active {
    opacity: 1;
    border-color: var(--primary-color);
    background: #1a3a5a;
}

/* ========================================
   MODE SWITCH
======================================== */

.view-mode-switch {
    display: flex;
    gap: 0;
    background: #2a2a2a;
    padding: 3px;
    border-radius: 10px;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.3);
}

.mode-btn {
    background: transparent;
    border: none;
    color: #999;
    font-size: 18px;
    cursor: pointer;
    padding: 10px 20px;
    border-radius: 8px;
    transition: all var(--transition-normal) cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    font-weight: 500;
}

.mode-label {
    font-size: 13px;
    font-weight: 500;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--white);
    transform: translateY(-1px);
}

.mode-btn.active {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--secondary-dark) 100%);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

.mode-btn:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* ========================================
   VIEWER CONTAINER
======================================== */

.pdf-viewer-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--dark-bg);
    position: relative;
    min-height: 0;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.pdf-viewer-container::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.pdf-viewer-container::-webkit-scrollbar-track {
    background: var(--dark-bg);
}

.pdf-viewer-container::-webkit-scrollbar-thumb {
    background: var(--light-border);
    border-radius: 5px;
}

.pdf-viewer-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ========================================
   MODE SIMPLE
======================================== */

.simple-viewer {
    display: none;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.simple-viewer.active {
    display: flex;
}

.simple-viewer .pdf-canvas {
    max-width: 90%;
    max-height: 90%;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    transition: opacity var(--transition-normal) ease;
}

/* ========================================
   MODE FLIPBOOK
======================================== */

.flipbook-viewer {
    display: none;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(circle at center, #2a2a2a 0%, var(--dark-bg) 100%);
}

.flipbook-viewer.active {
    display: flex;
}

.flipbook-stage {
    perspective: 2500px;
    perspective-origin: center center;
    width: 100%;
    max-width: 1600px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.4));
}

.flipbook-container {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 0;
    position: relative;
    transform-style: preserve-3d;
    transition: transform var(--transition-normal) ease;
}

/* Pages wrapper */
.page-wrapper {
    position: relative;
    transform-style: preserve-3d;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.page-wrapper.left-page {
    transform-origin: right center;
}

.page-wrapper.right-page {
    transform-origin: left center;
}

/* Canvas des pages */
.pdf-canvas,
.pdf-page {
    display: block;
    max-height: 70vh;
    max-width: 45vw;
    width: auto;
    height: auto;
    min-height: 400px;
    object-fit: contain;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    background: var(--white);
    vertical-align: middle;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
    transition: opacity var(--transition-normal) ease, filter var(--transition-slow) ease;
}

/* Ombres des pages */
.page-shadow {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 30px;
    pointer-events: none;
    z-index: 5;
}

.page-shadow.left {
    right: 0;
    background: linear-gradient(to left, rgba(0, 0, 0, 0.2) 0%, transparent 100%);
}

.page-shadow.right {
    left: 0;
    background: linear-gradient(to right, rgba(0, 0, 0, 0.2) 0%, transparent 100%);
}

/* Coins de page recourbés */
.page-curl {
    position: absolute;
    width: 30px;
    height: 30px;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-normal) ease;
}

.page-curl.left {
    top: 0;
    right: 0;
    background: linear-gradient(135deg, transparent 0%, transparent 40%, rgba(0, 0, 0, 0.05) 50%, rgba(0, 0, 0, 0.1) 100%);
    border-radius: 0 0 0 30px;
}

.page-curl.right {
    top: 0;
    left: 0;
    background: linear-gradient(-135deg, transparent 0%, transparent 40%, rgba(0, 0, 0, 0.05) 50%, rgba(0, 0, 0, 0.1) 100%);
    border-radius: 0 0 30px 0;
}

.page-wrapper:hover .page-curl {
    opacity: 1;
}

/* Texture papier */
.pdf-page::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0, 0, 0, 0.01) 2px, rgba(0, 0, 0, 0.01) 4px),
        repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(0, 0, 0, 0.005) 2px, rgba(0, 0, 0, 0.005) 4px);
    pointer-events: none;
    z-index: 1;
    mix-blend-mode: multiply;
}

/* ========================================
   PAGE QUI TOURNE - CORRECTION CENTRAGE
======================================== */

.turning-page {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    display: none;
    transform-style: preserve-3d;
    transform-origin: left center;
    z-index: 30;
    /* 👉 Centrage vertical forcé */
    margin: auto;
    height: fit-content;
}

.page-front,
.page-back {
    position: relative; /* 👈 Changé de absolute à relative */
    backface-visibility: hidden;
}

.page-back {
    position: absolute;
    top: 0;
    left: 0;
    transform: rotateY(180deg);
}

.turning-page canvas {
    display: block;
    box-shadow: 
        -5px 0 25px rgba(0, 0, 0, 0.6),
        0 0 40px rgba(0, 0, 0, 0.4);
    animation: paperCrinkle 1s ease-in-out;
}

/* Effet de lumière */
.turning-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.3) 50%, rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
    animation: lightSweep 1s ease-in-out;
}

.turning-page .page-front::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 60%);
    animation: glowPulse 1s ease-in-out;
}

/* ========================================
   ANIMATIONS TOURNAGE DE PAGE 
======================================== */

.flipbook-container.turning-forward .turning-page {
    display: flex;
    align-items: center;
}

.turning-page.turn-start {
    animation: pageTurnForward 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes pageTurnForward {
    0% {
        transform: perspective(2500px) rotateY(0deg);
        filter: brightness(1) drop-shadow(-2px 2px 8px rgba(0, 0, 0, 0.3));
    }
    15% {
        transform: perspective(2500px) rotateY(-15deg);
        filter: brightness(0.98) drop-shadow(-5px 5px 15px rgba(0, 0, 0, 0.4));
    }
    50% {
        transform: perspective(2500px) rotateY(-90deg);
        filter: brightness(0.85) drop-shadow(-10px 10px 25px rgba(0, 0, 0, 0.6));
    }
    75% {
        transform: perspective(2500px) rotateY(-165deg);
        filter: brightness(0.95) drop-shadow(-5px 5px 15px rgba(0, 0, 0, 0.4));
    }
    100% {
        transform: perspective(2500px) rotateY(-180deg);
        filter: brightness(1) drop-shadow(-2px 2px 8px rgba(0, 0, 0, 0.3));
        opacity: 0;
    }
}

.flipbook-container.turning-backward .turning-page {
    display: flex;
    align-items: center;
    left: 0;
    right: auto;
    transform-origin: right center;
}

.turning-page.turn-backward.turn-start {
    animation: pageTurnBackward 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes pageTurnBackward {
    0% {
        transform: perspective(2500px) rotateY(-180deg) scaleX(-1);
        filter: brightness(1) drop-shadow(2px 2px 8px rgba(0, 0, 0, 0.3));
        opacity: 0;
    }
    25% {
        opacity: 1;
        transform: perspective(2500px) rotateY(-165deg) scaleX(-1);
        filter: brightness(0.95) drop-shadow(5px 5px 15px rgba(0, 0, 0, 0.4));
    }
    50% {
        transform: perspective(2500px) rotateY(-90deg) scaleX(-1);
        filter: brightness(0.85) drop-shadow(10px 10px 25px rgba(0, 0, 0, 0.6));
    }
    85% {
        transform: perspective(2500px) rotateY(-15deg) scaleX(-1);
        filter: brightness(0.98) drop-shadow(5px 5px 15px rgba(0, 0, 0, 0.4));
    }
    100% {
        transform: perspective(2500px) rotateY(0deg) scaleX(-1);
        filter: brightness(1) drop-shadow(2px 2px 8px rgba(0, 0, 0, 0.3));
    }
}

/* ========================================
   PARTICULES
======================================== */

.particle-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
    overflow: hidden;
}

/* ========================================
   LOADING
======================================== */

.pdf-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    color: var(--white);
    font-size: 16px;
}

.pdf-loading::before {
    content: '';
    position: absolute;
    top: -50px;
    width: 100px;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    animation: loading 1.5s infinite;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--light-border);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.flipbook-viewer .pdf-loading {
    background: radial-gradient(circle, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.95) 100%);
    backdrop-filter: blur(20px);
}

.flipbook-viewer .pdf-loading::after {
    content: '📖';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 64px;
    animation: bookPulse 1.5s ease-in-out infinite;
}

/* ========================================
   ERROR
======================================== */

.pdf-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    color: var(--white);
    padding: 40px;
}

.error-icon {
    font-size: 48px;
}

.pdf-error p {
    font-size: 18px;
    opacity: 0.8;
}

/* ========================================
   CONTROLS
======================================== */

.pdf-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 20px;
    background: var(--dark-bg);
    border-top: 1px solid var(--light-border);
    flex-shrink: 0;
    min-height: 70px;
    transition: all var(--transition-normal) ease;
}

.pdf-modal-content[data-mode="flipbook"] .pdf-controls {
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.95) 0%, rgba(40, 40, 40, 0.95) 100%);
    backdrop-filter: blur(10px);
}

.pdf-btn {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 8px;
}

.pdf-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.pdf-btn:disabled {
    background: var(--light-border);
    cursor: not-allowed;
    opacity: 0.5;
}

.pdf-btn:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

.pdf-page-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--white);
    font-size: 14px;
    position: relative;
}

.pdf-page-info::before {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--secondary-color) 0%, var(--secondary-dark) 100%);
    width: var(--progress, 0%);
    transition: width var(--transition-normal) ease;
    border-radius: 1px;
}

.pdf-page-input {
    width: 60px;
    padding: 8px 12px;
    background: #333;
    border: 1px solid var(--light-border);
    border-radius: 6px;
    color: var(--white);
    text-align: center;
    font-size: 14px;
}

.pdf-page-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.pdf-page-total {
    opacity: 0.7;
}

/* ========================================
   UPSELL BAR
======================================== */

.pdf-upsell-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 30px;
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--secondary-dark) 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideIn var(--transition-slow) ease-out;
    flex-shrink: 0;
    min-height: 60px;
}

.pdf-upsell-text {
    color: var(--white);
    font-size: 16px;
    font-weight: 500;
}

.pdf-upsell-btn {
    background: var(--white);
    color: var(--secondary-color);
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.pdf-upsell-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* ========================================
   OVERLAY DERNIÈRE PAGE
======================================== */

.pdf-last-page-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.2) 20%, rgba(0, 0, 0, 0.6) 50%, rgba(0, 0, 0, 0.85) 70%, rgba(0, 0, 0, 0.95) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 40px 20px 60px;
    z-index: 100;
    opacity: 0;
    transition: opacity var(--transition-slow) ease;
    pointer-events: none;
}

.pdf-last-page-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.last-page-content {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--secondary-dark) 100%);
    border-radius: 20px;
    padding: 40px 30px;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    text-align: center;
    color: white;
    transform: translateY(30px);
    opacity: 0;
    animation: slideUpFadeIn 0.6s ease forwards;
    animation-delay: 0.2s;
}

.last-page-content::before {
    content: '🎉';
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 48px;
    animation: confettiFall 2s ease-in-out infinite;
}

.teaser-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
    position: relative;
    display: inline-block;
}

.teaser-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 10px 0;
    color: var(--white);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    line-height: 1.3;
}

.teaser-subtitle {
    font-size: 16px;
    opacity: 0.95;
    margin: 0 0 30px 0;
    line-height: 1.5;
}

.teaser-features {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 30px 0;
    text-align: left;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.15);
    padding: 15px 20px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    transition: all var(--transition-normal) ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.feature-item:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateX(5px);
    border-color: rgba(255, 255, 255, 0.2);
}

.feature-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.feature-text {
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
}

.btn-unlock-book {
    background: white;
    color: var(--secondary-color);
    border: none;
    padding: 18px 40px;
    font-size: 18px;
    font-weight: 700;
    border-radius: 50
border-radius: 50px;
    cursor: pointer;
    margin: 30px 0 20px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    transition: all var(--transition-normal) ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    animation: pulse 2s infinite;
    position: relative;
    overflow: hidden;
}

.btn-unlock-book::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-unlock-book:hover::before {
    width: 400px;
    height: 400px;
}

.btn-unlock-book:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
    background: #f8f9fa;
}

.btn-unlock-book:active {
    transform: translateY(-1px) scale(1.02);
}

.teaser-hint {
    margin: 0;
    opacity: 0.8;
    font-size: 13px;
}

.teaser-hint small {
    color: rgba(255, 255, 255, 0.9);
}

/* ========================================
   MESSAGE LIMITE (ANCIEN SYSTÈME)
======================================== */

.pdf-limit-overlay {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
}

.pdf-limit-overlay.active {
  opacity: 1;
  transform: translateY(0);
}

.limit-stats {
  font-size: 14px;
  color: #666;
  margin-top: 10px;
  padding: 10px;
  background: rgba(0, 123, 255, 0.1);
  border-radius: 5px;
}

.pdf-limit-message {
    background: white;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.limit-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.pdf-limit-message h3 {
    color: #333;
    font-size: 24px;
    margin-bottom: 15px;
}

.pdf-limit-message p {
    color: #666;
    font-size: 16px;
    margin-bottom: 10px;
    line-height: 1.6;
}

.pdf-limit-message strong {
    color: var(--secondary-color);
    font-weight: 600;
}

.btn-add-to-cart {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--secondary-dark) 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    margin: 20px 10px 10px;
    transition: transform var(--transition-fast);
}

.btn-add-to-cart:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-close-limit {
    background: #f0f0f0;
    color: #666;
    border: none;
    padding: 12px 25px;
    font-size: 14px;
    border-radius: 25px;
    cursor: pointer;
    margin: 10px;
    transition: background var(--transition-fast);
}

.btn-close-limit:hover {
    background: #e0e0e0;
}

/* ========================================
   TOAST NOTIFICATIONS
======================================== */

.pdf-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 123, 255, 0.95);
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    z-index: 99999;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    font-size: 14px;
    font-weight: 500;
}

/* ========================================
   BOUTON D'OUVERTURE (PAGE PRODUIT)
======================================== */

.btn-pdf-viewer {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    margin: 15px 0;
}

.btn-pdf-viewer:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    color: var(--white);
}

.btn-pdf-viewer::before {
    content: '📄';
    font-size: 20px;
}

/* ========================================
   EFFET 3D AU HOVER (DESKTOP)
======================================== */

@media (min-width: 1025px) {
    .flipbook-container:hover {
        transform: scale(1.02);
    }

    .flipbook-container:hover .left-page {
        transform: perspective(2500px) rotateY(5deg);
        transition: transform var(--transition-normal) ease;
    }

    .flipbook-container:hover .right-page {
        transform: perspective(2500px) rotateY(-5deg);
        transition: transform var(--transition-normal) ease;
    }
}

/* ========================================
   CURSEUR PERSONNALISÉ
======================================== */

.flipbook-stage {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><text y="28" font-size="28">👆</text></svg>') 16 0, auto;
}

.flipbook-container.turning-forward,
.flipbook-container.turning-backward {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><text y="28" font-size="28">⌛</text></svg>') 16 16, wait;
}

/* ========================================
   ANIMATIONS GÉNÉRALES
======================================== */

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

@keyframes loading {
    0% { left: -100px; }
    100% { left: 100%; }
}

@keyframes slideIn {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

@keyframes slideUpFadeIn {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes bounce {
    0%, 100% { 
        transform: translateY(0); 
    }
    50% { 
        transform: translateY(-10px); 
    }
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    }
    50% {
        box-shadow: 0 8px 30px rgba(255, 255, 255, 0.5);
    }
}

@keyframes lightSweep {
    0%, 100% {
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
}

@keyframes glowPulse {
    0%, 100% {
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
}

@keyframes paperCrinkle {
    0%, 100% {
        filter: brightness(1);
    }
    25%, 75% {
        filter: brightness(0.95) contrast(1.05);
    }
    50% {
        filter: brightness(0.9) contrast(1.1);
    }
}

@keyframes fadeInOut {
    0%, 100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes bookPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.5;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
}

@keyframes confettiFall {
    0% {
        transform: translateX(-50%) translateY(-20px) rotate(0deg);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translateX(-50%) translateY(20px) rotate(360deg);
        opacity: 0;
    }
}

/* ========================================
   RESPONSIVE
======================================== */

@media (max-width: 1600px) {
    .pdf-page {
        max-height: 65vh;
        max-width: 43vw;
    }
}

@media (max-width: 1400px) {
    .flipbook-stage {
        perspective: 2000px;
    }
    
    .pdf-page {
        max-height: 60vh;
        max-width: 42vw;
    }
    
    .book-spine {
        width: 5px;
        min-width: 5px;
        max-width: 5px;
    }
}

@media (max-width: 1200px) {
    .flipbook-stage {
        perspective: 1500px;
    }
    
    .pdf-page {
        max-height: 55vh;
        max-width: 40vw;
    }
    
    .page-curl {
        width: 20px;
        height: 20px;
    }
    
    .book-spine {
        width: 4px;
        min-width: 4px;
        max-width: 4px;
    }
    
    .flipbook-viewer {
        padding: 30px 15px;
    }
}

@media (max-width: 1024px) {
    .mode-label {
        display: none;
    }
    
    .flipbook-viewer {
        padding: 20px 10px;
    }
    
    /* Sur tablette, empiler verticalement */
    .flipbook-container {
        flex-direction: column;
        gap: 20px;
        align-items: center;
    }

    .book-spine {
        width: 80%;
        height: 4px;
        min-height: 4px;
        max-height: 4px;
        margin: 0 auto;
        background: linear-gradient(
            180deg,
            rgba(40, 40, 40, 1) 0%,
            rgba(60, 60, 60, 1) 20%,
            rgba(80, 80, 80, 1) 50%,
            rgba(60, 60, 60, 1) 80%,
            rgba(40, 40, 40, 1) 100%
        );
    }
    
    .spine-highlight {
        width: 100%;
        height: 1px;
        top: 50%;
        left: 0;
        transform: translateY(-50%);
    }
    
    .pdf-page {
        max-height: 50vh;
        max-width: 80vw;
    }
    
    .simple-viewer .pdf-canvas {
        max-width: 85%;
        max-height: 85%;
    }
    
    .page-shadow,
    .page-curl {
        display: none;
    }
    
    /* Désactiver l'effet 3D sur tablette */
    .flipbook-container:hover .left-page,
    .flipbook-container:hover .right-page {
        transform: none;
    }
}

@media (max-width: 768px) {
    .pdf-modal-content {
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }

    .pdf-controls {
        flex-wrap: wrap;
        gap: 10px;
        padding: 15px;
    }

    .pdf-btn {
        padding: 10px 16px;
        font-size: 13px;
    }

    .btn-label {
        display: none;
    }

    .pdf-upsell-bar {
        flex-direction: column;
        gap: 12px;
        padding: 15px;
        text-align: center;
    }

    .view-mode-switch {
        display: none;
    }
    
    .flipbook-viewer {
        display: none !important;
    }
    
    .simple-viewer {
        display: flex !important;
    }
    
    .pdf-page {
        max-height: 45vh;
        max-width: 90vw;
    }
    
    .simple-viewer .pdf-canvas {
        max-width: 95%;
        max-height: 80%;
    }
    
    .particle-canvas {
        display: none;
    }
    
    .pdf-toast {
        top: 10px;
        right: 10px;
        left: 10px;
        text-align: center;
        font-size: 13px;
        padding: 12px 20px;
    }
    
    .last-page-content {
        padding: 30px 20px;
        width: 95%;
    }
    
    .teaser-title {
        font-size: 22px;
    }
    
    .teaser-subtitle {
        font-size: 14px;
    }
    
    .teaser-features {
        gap: 10px;
    }
    
    .feature-item {
        padding: 12px 15px;
    }
    
    .feature-icon {
        font-size: 20px;
    }
    
    .feature-text {
        font-size: 13px;
    }
    
    .btn-unlock-book {
        padding: 15px 30px;
        font-size: 16px;
        width: 100%;
        justify-content: center;
    }
    
    .pdf-last-page-overlay {
        padding: 20px 10px 80px;
    }
    
    .pdf-upsell-bar {
        padding: 12px 15px;
    }
}

@media (max-width: 480px) {
    .teaser-icon {
        font-size: 48px;
        margin-bottom: 15px;
    }
    
    .teaser-title {
        font-size: 20px;
    }
    
    .teaser-subtitle {
        font-size: 13px;
        margin-bottom: 20px;
    }
    
    .teaser-features {
        margin: 20px 0;
    }
    
    .btn-unlock-book {
        padding: 12px 25px;
        font-size: 15px;
    }
}

/* ========================================
   ACCESSIBILITÉ
======================================== */

.pdf-close:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* Mode contraste élevé */
@media (prefers-contrast: high) {
    .pdf-modal-overlay {
        background: rgba(0, 0, 0, 0.95);
    }
    
    .book-spine {
        background: #000;
    }
    
    .page-shadow {
        opacity: 1;
    }
}

/* Réduire les animations si demandé */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .turning-page {
        display: none !important;
    }
}

/* ========================================
   FEEDBACK TACTILE (MOBILE)
======================================== */

@media (hover: none) and (pointer: coarse) {
    .pdf-btn:active {
        transform: scale(0.95);
        background: var(--primary-dark);
    }
    
    .mode-btn:active {
        transform: scale(0.95);
    }
    
    .flipbook-container {
        -webkit-tap-highlight-color: transparent;
    }
}

/* ========================================
   DARK MODE
======================================== */

@media (prefers-color-scheme: dark) {
    .pdf-modal-content {
        background: var(--dark-bg);
    }
    
    .pdf-header {
        background: var(--darker-bg);
    }
    
    .pdf-controls {
        background: var(--darker-bg);
    }
}

/* ========================================
   PRINT
======================================== */

@media print {
    .pdf-modal {
        display: none !important;
    }
    
    .particle-canvas {
        display: none !important;
    }
}

/* ========================================
   PERFORMANCE : HARDWARE ACCELERATION
======================================== */

.pdf-canvas,
.pdf-page,
.turning-page,
.flipbook-container,
.particle-canvas,
.simple-viewer,
.flipbook-viewer {
    will-change: transform;
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Désactiver les transitions pendant le redimensionnement */
.resizing * {
    transition: none !important;
}

/* ========================================
   TRANSITIONS FLUIDES - CORRECTION DÉCALAGE
======================================== */

.flipbook-container {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 0;
    position: relative;
    transform-style: preserve-3d;
    transition: none; /* 👈 Pas de transition sur le container */
    min-height: 600px; /* 👈 Hauteur minimale pour éviter le saut */
}

.page-wrapper {
    position: relative;
    transform-style: preserve-3d;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    /* 👉 Transition uniquement sur opacity */
    transition: opacity 0.3s ease;
}

/* Pendant le chargement d'une nouvelle page */
.page-wrapper.loading {
    opacity: 0.5;
}

/* ========================================
   MODE PAGE UNIQUE (COUVERTURE/DERNIÈRE)
======================================== */

.flipbook-container.single-page-mode {
    justify-content: center;
}

.flipbook-container.single-page-mode .book-spine {
    display: none;
}

.flipbook-container.single-page-mode .page-wrapper:not(.active-single) {
    display: none;
}

.flipbook-container.single-page-mode .page-wrapper.active-single {
    max-width: 60vw;
}

.flipbook-container.single-page-mode .pdf-page {
    max-width: 60vw;
}

/* ========================================
   ZONES CLIQUABLES SUR LES PAGES
======================================== */

.page-wrapper {
    cursor: pointer;
}

.page-wrapper.left-page {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><text y="28" font-size="28">👈</text></svg>') 16 16, pointer;
}

.page-wrapper.right-page {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><text y="28" font-size="28">👉</text></svg>') 16 16, pointer;
}

.page-wrapper:hover {
    opacity: 0.95;
}

.page-wrapper.left-page:hover {
    transform: perspective(2500px) rotateY(2deg) scale(1.01);
}

.page-wrapper.right-page:hover {
    transform: perspective(2500px) rotateY(-2deg) scale(1.01);
}

/* Désactiver le clic pendant l'animation */
.flipbook-container.turning-forward .page-wrapper,
.flipbook-container.turning-backward .page-wrapper {
    pointer-events: none;
}

/**
 * CSS Amélioré pour l'Effet Teaser
 * À ajouter à viewer.css ou créer un nouveau fichier teaser.css
 */

/* ================================
   OVERLAY PAGE TEASER
   ================================ */

.pdf-limit-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
}

.pdf-limit-overlay.active {
  opacity: 1;
  transform: translateY(0);
}

.pdf-limit-message {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 40px;
  border-radius: 20px;
  max-width: 500px;
  text-align: center;
  color: white;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: scaleIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scaleIn {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.limit-icon {
  font-size: 64px;
  margin-bottom: 20px;
  animation: bounceIn 0.6s ease;
}

@keyframes bounceIn {
  0% {
    transform: scale(0.3);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

.pdf-limit-message h3 {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 15px 0;
  color: white;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.pdf-limit-message p {
  font-size: 16px;
  line-height: 1.6;
  margin: 10px 0;
  color: rgba(255, 255, 255, 0.95);
}

.pdf-limit-message strong {
  color: #ffd700;
  font-weight: 700;
}

.limit-stats {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 20px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  backdrop-filter: blur(10px);
}

.btn-add-to-cart {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 50px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  margin: 20px 10px 10px;
  box-shadow: 0 10px 30px rgba(245, 87, 108, 0.4);
  transition: all 0.3s ease;
  display: inline-block;
}

.btn-add-to-cart:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 40px rgba(245, 87, 108, 0.6);
}

.btn-add-to-cart:active {
  transform: translateY(0);
}

.btn-close-limit {
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.3);
  padding: 10px 25px;
  border-radius: 50px;
  font-size: 14px;
  cursor: pointer;
  margin: 5px;
  transition: all 0.3s ease;
}

.btn-close-limit:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-color: rgba(255, 255, 255, 0.5);
}

/* ================================
   OVERLAY DERNIÈRE PAGE (mode simple)
   ================================ */

.pdf-last-page-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.pdf-last-page-overlay.active {
  opacity: 1;
}

.last-page-content {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 40px;
  border-radius: 20px;
  max-width: 600px;
  text-align: center;
  color: white;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideUp {
  0% {
    transform: translateY(50px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.teaser-icon {
  font-size: 72px;
  margin-bottom: 20px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.teaser-title {
  font-size: 32px;
  font-weight: 700;
  margin: 0 0 15px 0;
  color: white;
  text-shadow: 0 2px 15px rgba(0, 0, 0, 0.3);
  letter-spacing: -0.5px;
}

.teaser-subtitle {
  font-size: 18px;
  margin: 10px 0 30px;
  color: rgba(255, 255, 255, 0.95);
  line-height: 1.6;
}

.teaser-features {
  display: flex;
  gap: 20px;
  margin: 30px 0;
  flex-wrap: wrap;
  justify-content: center;
}

.feature-item {
  background: rgba(255, 255, 255, 0.1);
  padding: 15px 20px;
  border-radius: 15px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.3s ease;
  flex: 1 1 calc(33.333% - 20px);
  min-width: 150px;
}

.feature-item:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.feature-icon {
  font-size: 28px;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.feature-text {
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  color: white;
}

.btn-unlock-book {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  border: none;
  padding: 18px 40px;
  border-radius: 50px;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  margin: 20px 0 10px;
  box-shadow: 0 10px 30px rgba(245, 87, 108, 0.4);
  transition: all 0.3s ease;
  display: inline-block;
  text-decoration: none;
}

.btn-unlock-book:hover {
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 15px 40px rgba(245, 87, 108, 0.6);
}

.btn-unlock-book:active {
  transform: translateY(-2px) scale(1.02);
}

.teaser-hint {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  margin: 15px 0 0;
  font-style: italic;
}

/* ================================
   RESPONSIVE
   ================================ */

@media (max-width: 768px) {
  .pdf-limit-message,
  .last-page-content {
    padding: 30px 20px;
    max-width: 90%;
  }

  .teaser-title {
    font-size: 24px;
  }

  .pdf-limit-message h3 {
    font-size: 22px;
  }

  .teaser-subtitle,
  .pdf-limit-message p {
    font-size: 15px;
  }

  .teaser-features {
    flex-direction: column;
    gap: 10px;
  }

  .feature-item {
    flex: 1 1 100%;
    min-width: auto;
  }

  .btn-unlock-book,
  .btn-add-to-cart {
    font-size: 16px;
    padding: 14px 30px;
  }

  .teaser-icon,
  .limit-icon {
    font-size: 48px;
  }
}

/* ================================
   ANIMATIONS SUPPLÉMENTAIRES
   ================================ */

/* Effet de scintillement sur les boutons */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.btn-unlock-book::before,
.btn-add-to-cart::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shimmer 3s infinite;
}

/* Effet de particules flottantes */
.teaser-icon::before,
.teaser-icon::after,
.limit-icon::before,
.limit-icon::after {
  content: '✨';
  position: absolute;
  font-size: 20px;
  animation: sparkle 2s ease-in-out infinite;
  opacity: 0;
}

.teaser-icon::before {
  left: -20px;
  top: 0;
  animation-delay: 0s;
}

.teaser-icon::after {
  right: -20px;
  top: 10px;
  animation-delay: 1s;
}

@keyframes sparkle {
  0%, 100% {
    opacity: 0;
    transform: translateY(0) scale(0.5);
  }
  50% {
    opacity: 1;
    transform: translateY(-20px) scale(1);
  }
}

/* ================================
   MODE SOMBRE (optionnel)
   ================================ */

@media (prefers-color-scheme: dark) {
  .pdf-limit-overlay {
    background: rgba(0, 0, 0, 0.9);
  }

  .pdf-limit-message,
  .last-page-content {
    background: linear-gradient(135deg, #1e3a8a 0%, #7c3aed 100%);
  }
}

/* ================================
   ACCESSIBILITÉ
   ================================ */

/* Focus pour navigation au clavier */
.btn-unlock-book:focus,
.btn-add-to-cart:focus,
.btn-close-limit:focus {
  outline: 3px solid rgba(255, 255, 255, 0.5);
  outline-offset: 3px;
}

/* Réduire les animations pour utilisateurs sensibles */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}