/**
 * Interactive Video Buttons - Frontend CSS
 * Design moderne et responsive pour le lecteur vidéo et les boutons
 */

/* ========== CONTENEUR PRINCIPAL ========== */

.ivb-player-wrapper {
    max-width: 100%;
    margin: 0 auto 30px;
    position: relative;
}

.ivb-video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* Ratio 16:9 */
    background: #000;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

/* ========== LECTEURS VIDÉO ========== */

.ivb-youtube-player,
.ivb-mp4-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.ivb-youtube-player iframe {
    width: 100%;
    height: 100%;
}

.ivb-mp4-player {
    object-fit: contain;
}

/* ========== OVERLAY DES BOUTONS ========== */

.ivb-buttons-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

/* ========== BOUTONS INTERACTIFS ========== */

.ivb-button {
    position: absolute;
    transform: translate(-50%, -50%);
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 6px;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    white-space: nowrap;
    z-index: 20;
    opacity: 0;
    display: none;
}

.ivb-button.ivb-button-visible {
    opacity: 1;
    display: block;
    animation: ivbButtonAppear 0.3s ease-out forwards;
}

/* Animation d'apparition */
@keyframes ivbButtonAppear {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Effet au survol */
.ivb-button:hover {
    transform: translate(-50%, -50%) scale(1.08);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Effet au clic */
.ivb-button:active {
    transform: translate(-50%, -50%) scale(0.98);
}

/* ========== ANIMATIONS FLUIDES ========== */

.ivb-button {
    animation-duration: 0.3s;
    animation-fill-mode: both;
}

/* ========== MESSAGES ========== */

.ivb-no-buttons-message {
    text-align: center;
    color: #666;
    font-style: italic;
    margin-top: 20px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 6px;
    border-left: 4px solid #ddd;
}

.ivb-error {
    color: #d63638;
    background: #fee;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #d63638;
    margin: 20px 0;
}

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

/* Tablettes */
@media (max-width: 768px) {
    .ivb-button {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .ivb-video-container {
        border-radius: 6px;
    }
}

/* Mobiles */
@media (max-width: 480px) {
    .ivb-button {
        padding: 8px 16px;
        font-size: 12px;
        border-width: 1px;
    }
    
    .ivb-video-container {
        border-radius: 4px;
    }
    
    .ivb-buttons-overlay {
        /* Empêcher les boutons de sortir de l'écran */
    }
    
    .ivb-button:hover {
        /* Réduire l'effet de scale sur mobile */
        transform: translate(-50%, -50%) scale(1.04);
    }
}

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

.ivb-button:focus {
    outline: 3px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

/* Mode contraste élevé */
@media (prefers-contrast: high) {
    .ivb-button {
        border-width: 3px;
        border-color: rgba(255, 255, 255, 0.8);
    }
}

/* Réduction des animations si préféré */
@media (prefers-reduced-motion: reduce) {
    .ivb-button,
    .ivb-button:hover,
    .ivb-button:active {
        transition: none;
        animation: none;
    }
    
    .ivb-button.ivb-button-visible {
        animation: none;
    }
}

/* ========== COMPATIBILITÉ THÈMES ========== */

.ivb-player-wrapper * {
    box-sizing: border-box;
}

.ivb-button:visited {
    color: inherit;
}

/* ========== PULSE EFFECT (OPTIONNEL) ========== */

.ivb-button.ivb-pulse {
    animation: ivbPulse 2s infinite;
}

@keyframes ivbPulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    50% {
        box-shadow: 0 4px 24px rgba(255, 255, 255, 0.6);
    }
}

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

.ivb-video-container.ivb-loading::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ivbSpin 0.8s linear infinite;
    z-index: 5;
}

@keyframes ivbSpin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}
