/**
 * Styles frontend pour ACF Repeater Elementor
 */

/* Conteneur principal */
.acf-repeater-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

/* Layout Grid */
.acf-repeater-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

/* Layout Flexbox */
.acf-repeater-flexbox {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.acf-repeater-flexbox .acf-repeater-item {
    flex: 1;
    min-width: 300px;
}

/* Layout Masonry */
.acf-repeater-masonry {
    column-count: 3;
    column-gap: 20px;
    column-fill: balance;
}

.acf-repeater-masonry .acf-repeater-item {
    break-inside: avoid;
    margin-bottom: 20px;
}

/* Layout Liste */
.acf-repeater-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Layout Carrousel */
.acf-repeater-carousel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 20px;
    padding-bottom: 10px;
}

.acf-repeater-carousel .acf-repeater-item {
    flex: 0 0 auto;
    scroll-snap-align: start;
    min-width: 300px;
}

.acf-repeater-carousel::-webkit-scrollbar {
    height: 8px;
}

.acf-repeater-carousel::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.acf-repeater-carousel::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.acf-repeater-carousel::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Éléments du repeater */
.acf-repeater-item {
    position: relative;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.acf-repeater-item:hover {
    transform: translateY(-2px);
}

/* Contenu des éléments */
.acf-repeater-item-content {
    padding: 20px;
}

.acf-repeater-item-default {
    padding: 20px;
}

/* Champs ACF */
.acf-field {
    margin-bottom: 15px;
}

.acf-field:last-child {
    margin-bottom: 0;
}

.acf-field-label {
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.acf-field-content {
    color: #666;
    line-height: 1.6;
}

/* Types de champs spécifiques */
.acf-field-type-image img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.acf-field-type-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.acf-gallery-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 4px;
}

.acf-field-type-link a,
.acf-field-type-url a,
.acf-field-type-email a {
    color: #007cba;
    text-decoration: none;
    transition: color 0.3s ease;
}

.acf-field-type-link a:hover,
.acf-field-type-url a:hover,
.acf-field-type-email a:hover {
    color: #005a87;
    text-decoration: underline;
}

.acf-field-type-wysiwyg {
    line-height: 1.8;
}

.acf-field-type-wysiwyg h1,
.acf-field-type-wysiwyg h2,
.acf-field-type-wysiwyg h3,
.acf-field-type-wysiwyg h4,
.acf-field-type-wysiwyg h5,
.acf-field-type-wysiwyg h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    color: #333;
}

.acf-field-type-wysiwyg p {
    margin-bottom: 1em;
}

.acf-field-type-wysiwyg ul,
.acf-field-type-wysiwyg ol {
    margin-bottom: 1em;
    padding-left: 20px;
}

.acf-color-preview {
    border: 1px solid #ddd;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
}

/* Responsive */
@media (max-width: 1024px) {
    .acf-repeater-masonry {
        column-count: 2;
    }
    
    .acf-repeater-carousel .acf-repeater-item {
        min-width: 250px;
    }
}

@media (max-width: 768px) {
    .acf-repeater-container {
        gap: 15px;
    }
    
    .acf-repeater-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .acf-repeater-flexbox .acf-repeater-item {
        min-width: 100%;
    }
    
    .acf-repeater-masonry {
        column-count: 1;
    }
    
    .acf-repeater-carousel .acf-repeater-item {
        min-width: 200px;
    }
    
    .acf-repeater-item-content,
    .acf-repeater-item-default {
        padding: 15px;
    }
    
    .acf-field-type-gallery {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
    
    .acf-gallery-item img {
        height: 80px;
    }
}

@media (max-width: 480px) {
    .acf-repeater-container {
        gap: 10px;
    }
    
    .acf-repeater-carousel .acf-repeater-item {
        min-width: 150px;
    }
    
    .acf-repeater-item-content,
    .acf-repeater-item-default {
        padding: 12px;
    }
    
    .acf-field {
        margin-bottom: 12px;
    }
    
    .acf-field-label {
        font-size: 13px;
    }
}

/* Animations d'entrée */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Classes d'animation */
.acf-repeater-item.animate-fade-up {
    animation: fadeInUp 0.6s ease forwards;
}

.acf-repeater-item.animate-fade-left {
    animation: fadeInLeft 0.6s ease forwards;
}

.acf-repeater-item.animate-fade-right {
    animation: fadeInRight 0.6s ease forwards;
}

.acf-repeater-item.animate-scale {
    animation: scaleIn 0.6s ease forwards;
}

/* Délais d'animation pour effet cascade */
.acf-repeater-item:nth-child(1) { animation-delay: 0.1s; }
.acf-repeater-item:nth-child(2) { animation-delay: 0.2s; }
.acf-repeater-item:nth-child(3) { animation-delay: 0.3s; }
.acf-repeater-item:nth-child(4) { animation-delay: 0.4s; }
.acf-repeater-item:nth-child(5) { animation-delay: 0.5s; }
.acf-repeater-item:nth-child(6) { animation-delay: 0.6s; }
.acf-repeater-item:nth-child(n+7) { animation-delay: 0.7s; }

/* États initiaux pour les animations */
.acf-repeater-item.animate-fade-up,
.acf-repeater-item.animate-fade-left,
.acf-repeater-item.animate-fade-right,
.acf-repeater-item.animate-scale {
    opacity: 0;
}

/* Utilitaires */
.acf-repeater-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.acf-repeater-empty {
    text-align: center;
    padding: 40px;
    color: #999;
    font-style: italic;
}

/* Accessibilité */
@media (prefers-reduced-motion: reduce) {
    .acf-repeater-item {
        transition: none;
    }
    
    .acf-repeater-item.animate-fade-up,
    .acf-repeater-item.animate-fade-left,
    .acf-repeater-item.animate-fade-right,
    .acf-repeater-item.animate-scale {
        animation: none;
        opacity: 1;
    }
}
