/**
 * Styles pour le widget Réalisations
 */

.realisations-container {
    position: relative;
}

.realisations-slider {
    position: relative;
    margin: 0 auto;
}

.realisation-slide {
    display: none;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.realisation-slide.active {
    display: block;
    opacity: 1;
}

.realisation-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

/* Colonne de gauche (carte + navigation) */
.realisation-left-col {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Carte de gauche */
.realisation-card {
    background-color: #ffffff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0px 0px 30px 0px rgba(0, 0, 0, 0.05);
    position: relative;
    min-height: 400px;
    overflow: hidden;
}

.realisation-card::before {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 200px;
    height: 200px;
    background-image: url(/wp-content/uploads/2025/10/logoaratice.svg);
    background-repeat: no-repeat;
    background-size: contain;
    filter: brightness(100%) contrast(100%) saturate(0%) blur(0px) hue-rotate(0deg);
    opacity: 0.1;
    z-index: 0;
    pointer-events: none;
}

.realisation-card>* {
    position: relative;
    z-index: 1;
}

.realisation-year {
    background-color: #163c79;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 20px;
}

.realisation-content {
    color: #333333;
}

.realisation-field {
    margin-bottom: 20px;
}

.realisation-label {
    color: #666666;
    font-size: 14px;
    font-weight: 500;
    display: block;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.realisation-value {
    font-size: 18px;
    font-weight: 700;
    color: #333333;
    margin-bottom: 10px;
}

.realisation-description {
    font-size: 16px;
    line-height: 1.6;
    color: #555555;
}

/* Grille de photos */
.realisation-photos {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    height: fit-content;
}

.realisation-photo {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    cursor: pointer;
    position: relative;
}

.realisation-photo:hover {
    transform: scale(1.02);
}

.realisation-photo::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg transform='translate(-308 -1139)' fill='%23ffffff'%3E%3Cpath d='M321.46,1163.45 C315.17,1163.45 310.07,1158.44 310.07,1152.25 C310.07,1146.06 315.17,1141.04 321.46,1141.04 C327.75,1141.04 332.85,1146.06 332.85,1152.25 C332.85,1158.44 327.75,1163.45 321.46,1163.45 L321.46,1163.45 Z M339.688,1169.25 L331.429,1161.12 C333.592,1158.77 334.92,1155.67 334.92,1152.25 C334.92,1144.93 328.894,1139 321.46,1139 C314.026,1139 308,1144.93 308,1152.25 C308,1159.56 314.026,1165.49 321.46,1165.49 C324.672,1165.49 327.618,1164.38 329.932,1162.53 L338.225,1170.69 C338.629,1171.09 339.284,1171.09 339.688,1170.69 C340.093,1170.3 340.093,1169.65 339.688,1169.25 L339.688,1169.25 Z M326.519,1151.41 L322.522,1151.41 L322.522,1147.41 C322.522,1146.85 322.075,1146.41 321.523,1146.41 C320.972,1146.41 320.524,1146.85 320.524,1147.41 L320.524,1151.41 L316.529,1151.41 C315.978,1151.41 315.53,1151.59 315.53,1152.14 C315.53,1152.7 315.978,1153.41 316.529,1153.41 L320.524,1153.41 L320.524,1157.41 C320.524,1157.97 320.972,1158.41 321.523,1158.41 C322.075,1158.41 322.522,1157.97 322.522,1157.41 L322.522,1153.41 L326.519,1153.41 C327.07,1153.41 327.518,1152.96 327.518,1152.41 C327.518,1151.86 327.07,1151.41 326.519,1151.41 L326.519,1151.41 Z'%3E%3C/path%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.realisation-photo:hover::after {
    opacity: 1;
}

.realisation-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.realisation-photo:hover img {
    transform: scale(1.03);
    filter: brightness(0.7);
}

/* Placeholder pour photos manquantes */
.realisation-photo-placeholder {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: #f5f5f5;
    border-radius: 8px;
    border: 2px dashed #ccc;
}

.realisation-photo-placeholder p {
    color: #999;
    font-size: 14px;
    margin: 0;
}

/* Navigation */
.realisations-navigation {
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 12px 20px;
    border-radius: 25px;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    color: #333333;
}

.nav-btn:hover {
    background-color: rgba(22, 60, 121, 0.1);
    color: #163c79;
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-btn:disabled:hover {
    background: none;
    color: #333333;
}

.nav-arrow {
    font-size: 18px;
    font-weight: bold;
}

.nav-text {
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .realisations-container {
        padding: 20px 15px;
    }

    .realisation-layout {
        grid-template-columns: 1fr;
        gap: 30px;
        /* Empêcher le swipe horizontal sur le layout global pour ne pas interférer avec le slider avant/après */
        /* Permettre seulement le scroll vertical */
        touch-action: pan-y;
    }
    
    /* Permettre le scroll/swipe horizontal uniquement sur les photos individuelles */
    .realisation-photo {
        touch-action: pan-x pan-y;
    }
    
    /* Permettre le touch sur le slider avant/après */
    .before-after-container,
    .before-after-wrapper {
        touch-action: pan-x pan-y;
    }

    .realisation-left-col {
        gap: 20px;
    }

    .realisation-card {
        padding: 20px;
        min-height: auto;
    }

    /* Slider horizontal pour les photos sur mobile */
    .realisation-photos {
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        gap: 15px;
        padding-bottom: 10px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* Firefox */
        -ms-overflow-style: none;
        /* IE et Edge */
    }

    .realisation-photos::-webkit-scrollbar {
        display: none;
        /* Chrome, Safari et Opera */
    }

    .realisation-photo {
        flex: 0 0 85%;
        scroll-snap-align: center;
        aspect-ratio: 4/3;
    }

    .realisation-photos-wrapper {
        position: relative;
    }

    .realisations-navigation {
        flex-direction: row;
        gap: 10px;
    }

    .nav-btn {
        flex: 1;
        padding: 12px 15px;
    }

    .prev-btn {
        justify-content: flex-start;
    }

    .next-btn {
        justify-content: flex-end;
    }

    .nav-text {
        font-size: 13px;
    }

    .nav-arrow {
        font-size: 16px;
    }
}

/* Points de pagination pour le slider photos mobile */
.photos-pagination {
    display: none;
}

@media (max-width: 768px) {
    .photos-pagination {
        display: flex;
        justify-content: center;
        gap: 8px;
        margin-top: 15px;
    }

    .photos-pagination-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background-color: #ccc;
        transition: all 0.3s ease;
        cursor: pointer;
    }

    .photos-pagination-dot.active {
        background-color: #163c79;
        width: 24px;
        border-radius: 4px;
    }
}

@media (max-width: 480px) {
    .realisation-photo {
        flex: 0 0 90%;
    }

    .realisation-card {
        padding: 15px;
    }

    .realisation-value {
        font-size: 16px;
    }

    .realisation-description {
        font-size: 14px;
    }
}

/* Mode édition Elementor */
.elementor-editor .realisations-container {
    min-height: 400px;
}

.elementor-editor .realisation-photo .placeholder {
    background: #f0f0f0;
    border: 2px dashed #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    font-size: 14px;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.realisation-slide.active {
    animation: slideIn 0.5s ease-out;
}

/* États de chargement */
.realisations-container.loading {
    opacity: 0.7;
}

.realisations-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #163c79;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Lightbox pour les photos */
.realisations-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.realisations-lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    image-rendering: high-quality;
    image-rendering: -webkit-optimize-contrast;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #163c79;
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1000;
    line-height: 1;
}

.lightbox-close:hover {
    background: #1a4d96;
    transform: scale(1.1);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(22, 60, 121, 0.9);
    color: white;
    border: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1000;
}

.lightbox-nav:hover {
    background: #163c79;
    transform: translateY(-50%) scale(1.1);
}

.lightbox-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.lightbox-nav:disabled:hover {
    transform: translateY(-50%);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(22, 60, 121, 0.9);
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

/* Animation d'entrée */
@keyframes lightboxFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.realisations-lightbox.active .lightbox-image {
    animation: lightboxFadeIn 0.3s ease-out;
}

/* Responsive lightbox */
@media (max-width: 768px) {
    .lightbox-nav {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .lightbox-prev {
        left: 10px;
    }

    .lightbox-next {
        right: 10px;
    }

    .lightbox-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 24px;
    }

    .lightbox-counter {
        bottom: 10px;
        padding: 6px 16px;
        font-size: 12px;
    }
}

/* ===== SLIDER AVANT/APRÈS ===== */
.before-after-container {
    width: 100%;
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.before-after-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

.before-image,
.after-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.after-image {
    clip-path: inset(0 50% 0 0);
}

.before-after-slider {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    background: transparent;
    cursor: ew-resize;
    z-index: 10;
    transform: translateX(-50%);
}

.slider-line {
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background: #ffffff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    transform: translateX(-50%);
    pointer-events: none;
}

.slider-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: #163c79;
    border: 3px solid #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: ew-resize;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    pointer-events: none;
}

.slider-button svg {
    width: 16px;
    height: 16px;
    stroke-width: 3;
    color: #ffffff;
}

.before-after-slider:hover .slider-button {
    background: #1a4d96;
    transform: translate(-50%, -50%) scale(1.1);
}

.before-after-slider:active .slider-button {
    transform: translate(-50%, -50%) scale(0.95);
}

.before-after-labels {
    position: absolute;
    width: 100%;
    top: 20px;
    left: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    pointer-events: none;
    z-index: 5;
}

.label-before,
.label-after {
    background: rgba(22, 60, 121, 0.9);
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Photos supplémentaires pour le type mixte */
.realisation-photos-supplementaires {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.realisation-photos-supplementaires .realisation-photo {
    aspect-ratio: 1;
}

/* Layout adaptatif pour le type mixte */
[data-type="mixte"] .realisation-photos-wrapper {
    display: flex;
    flex-direction: column;
}

/* Responsive du slider avant/après */
@media (max-width: 768px) {

    .slider-button {
        width: 40px;
        height: 40px;
    }

    .slider-button svg {
        width: 14px;
        height: 14px;
    }

    .before-after-labels {
        padding: 0 15px;
        top: 15px;
    }

    .label-before,
    .label-after {
        padding: 5px 10px;
        font-size: 10px;
    }

    /* Photos supplémentaires en slider horizontal sur mobile */
    .realisation-photos-supplementaires {
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        gap: 15px;
        padding-bottom: 10px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .realisation-photos-supplementaires::-webkit-scrollbar {
        display: none;
    }

    .realisation-photos-supplementaires .realisation-photo {
        flex: 0 0 85%;
        scroll-snap-align: center;
        aspect-ratio: 4/3;
    }
}

@media (max-width: 480px) {
    .slider-button {
        width: 35px;
        height: 35px;
    }

    .slider-button svg {
        width: 12px;
        height: 12px;
    }

    .before-after-labels {
        padding: 0 10px;
        top: 10px;
    }

    .label-before,
    .label-after {
        padding: 4px 8px;
        font-size: 9px;
    }

    .realisation-photos-supplementaires .realisation-photo {
        flex: 0 0 90%;
    }
}

/* Animation de chargement pour le slider avant/après */
.before-after-container.loading {
    position: relative;
}

.before-after-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #163c79;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 20;
}