/* ========================================
   MODALES RÈGLES DU JEU
   ======================================== */

/* Overlay sombre semi-transparent */
.rules-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 46, 0.9); /* #1a1a2e avec opacité */
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow-y: auto;
}

.rules-overlay.active {
    display: flex;
    opacity: 1;
}

/* Conteneur de la modale */
.rules-modal {
    position: relative;
    background: linear-gradient(135deg, #1a1a2e 0%, #0d1f26 100%);
    border-radius: 24px;
    padding: 2.5rem;
    max-width: min(90vw, 1200px);
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(212, 175, 55, 0.2);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    border: 1px solid rgba(212, 175, 55, 0.3);
    margin: auto;
}

.rules-overlay.active .rules-modal {
    transform: scale(1) translateY(0);
}

/* Bouton de fermeture X */
.rules-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(212, 175, 55, 0.1);
    color: #d4af37;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    line-height: 1;
    transition: all 0.3s ease;
    z-index: 10001;
    font-weight: 300;
    pointer-events: auto;
}

.rules-close:hover {
    background: rgba(212, 175, 55, 0.2);
    transform: rotate(90deg);
    color: #f4c86f;
}

.rules-close:focus {
    outline: 2px solid #d4af37;
    outline-offset: 2px;
}

/* Contenu de la modale */
.rules-content {
    color: #ecf0f1;
}

.rules-title {
    font-family: var(--font-heading, 'Crimson Text', Georgia, serif);
    font-size: 2.5rem;
    font-weight: 700;
    color: #d4af37;
    margin-bottom: 2rem;
    line-height: 1.2;
    text-align: center;
}

/* Container pour le bouton de téléchargement */
.rules-download-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
}

/* Bouton de téléchargement PDF */
.btn-download-pdf {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    margin-bottom: 0;
    border: 1px solid #d4af37;
    border-radius: 6px;
    color: #d4af37;
    background: transparent;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    font-family: var(--font-body, 'Inter', sans-serif);
}

.btn-download-pdf:hover {
    background: #d4af37;
    color: #1a1a2e;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

.btn-download-pdf:active {
    transform: translateY(0);
}

.btn-download-pdf:focus {
    outline: 2px solid #d4af37;
    outline-offset: 2px;
}

/* Container pour les images */
.rules-images-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    align-items: center;
    justify-content: center;
}

/* Images des règles */
.rules-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(212, 175, 55, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: zoom-in;
    display: block;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    object-fit: contain;
}

.rules-image:hover {
    transform: scale(1.01);
    box-shadow: 0 12px 32px rgba(212, 175, 55, 0.3);
    border-color: rgba(212, 175, 55, 0.4);
}

/* Overlay loupe au hover (optionnel) */
.rules-image-container {
    position: relative;
    display: inline-block;
    width: 100%;
}

.rules-image-container::after {
    content: '🔍';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    font-size: 2rem;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.rules-image-container:hover::after {
    opacity: 1;
}

/* Placeholder pour images manquantes */
.rules-image-placeholder {
    width: 100%;
    min-height: 400px;
    background: rgba(212, 175, 55, 0.1);
    border: 2px dashed rgba(212, 175, 55, 0.3);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(212, 175, 55, 0.6);
    font-size: 1.2rem;
    text-align: center;
    padding: 2rem;
}

/* Disposition spécifique JDC (toujours empilé verticalement) */
.rules-images-container.jdc-layout {
    flex-direction: column;
}

/* Disposition spécifique MOH et POZ (côte à côte sur desktop, empilé sur mobile) */
.rules-images-container.moh-layout,
.rules-images-container.poz-layout {
    flex-direction: row;
    gap: 1.5rem;
}

.rules-images-container.moh-layout .rules-image,
.rules-images-container.poz-layout .rules-image {
    flex: 1;
    max-width: 50%;
}

/* Lightbox pour zoom sur images */
.rules-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 20000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: zoom-out;
}

.rules-lightbox.active {
    display: flex;
    opacity: 1;
}

.rules-lightbox-image {
    max-width: 95vw;
    max-height: 95vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.rules-lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 50px;
    height: 50px;
    border: none;
    background: rgba(212, 175, 55, 0.2);
    color: #d4af37;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    line-height: 1;
    transition: all 0.3s ease;
    z-index: 20001;
    font-weight: 300;
}

.rules-lightbox-close:hover {
    background: rgba(212, 175, 55, 0.4);
    transform: rotate(90deg);
    color: #f4c86f;
}

.rules-lightbox-close:focus {
    outline: 2px solid #d4af37;
    outline-offset: 2px;
}

/* Responsive */
@media (max-width: 768px) {
    .rules-modal {
        padding: 2rem 1.5rem;
        max-width: 95vw;
        max-height: 95vh;
    }
    
    .rules-title {
        font-size: 2rem;
        margin-bottom: 1.5rem;
    }
    
    .rules-download-container {
        margin-bottom: 1.5rem;
    }
    
    .btn-download-pdf {
        padding: 12px 18px;
        font-size: 0.9rem;
    }
    
    .rules-images-container {
        gap: 1.5rem;
    }
    
    /* Sur mobile, MOH et POZ passent en empilé */
    .rules-images-container.moh-layout,
    .rules-images-container.poz-layout {
        flex-direction: column;
    }
    
    .rules-images-container.moh-layout .rules-image,
    .rules-images-container.poz-layout .rules-image {
        max-width: 100%;
    }
    
    .rules-close {
        top: 0.75rem;
        right: 0.75rem;
        width: 36px;
        height: 36px;
        font-size: 1.5rem;
    }
    
    .rules-lightbox-image {
        max-width: 98vw;
        max-height: 98vh;
    }
    
    .rules-lightbox-close {
        top: 0.5rem;
        right: 0.5rem;
        width: 44px;
        height: 44px;
        font-size: 1.75rem;
    }
    
    .rules-image-container::after {
        font-size: 1.5rem;
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 480px) {
    .rules-modal {
        padding: 1.5rem 1rem;
        border-radius: 16px;
    }
    
    .rules-title {
        font-size: 1.75rem;
        margin-bottom: 1.25rem;
    }
    
    .rules-download-container {
        margin-bottom: 1.25rem;
    }
    
    .btn-download-pdf {
        padding: 10px 16px;
        font-size: 0.85rem;
    }
    
    .rules-images-container {
        gap: 1rem;
    }
    
    .rules-image-placeholder {
        min-height: 300px;
        font-size: 1rem;
        padding: 1.5rem;
    }
}

/* Scrollbar personnalisée pour la modale */
.rules-modal::-webkit-scrollbar {
    width: 8px;
}

.rules-modal::-webkit-scrollbar-track {
    background: rgba(212, 175, 55, 0.1);
    border-radius: 4px;
}

.rules-modal::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.3);
    border-radius: 4px;
}

.rules-modal::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 175, 55, 0.5);
}
