/* Custom Tiles Widget Styles */

.custom-tiles-wrapper {
    position: relative;
    width: 100%;
    max-width: 60rem;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: repeat(3, var(--tile-width, 15rem));
    grid-template-rows: repeat(3, var(--tile-height, 14rem));
    gap: 0;
    justify-content: center;
}

.custom-tiles-hexagon {
    position: relative;
    width: var(--tile-width, 15rem);
    height: var(--tile-height, 14rem);
    clip-path: polygon(
        /* Sommet haut-gauche (5 points) */
        26% 1.6%,
        27% 0.6%,
        28% 0.2%,
        29% 0%,
        30% 0%,
        /* Bord haut */
        70% 0%,
        /* Sommet haut-droite (5 points) */
        71% 0%,
        72% 0.2%,
        73% 0.6%,
        74% 1.6%,
        /* Sommet droite (5 points) */
        99% 46%,
        99.4% 48%,
        99.7% 49.4%,
        99.8% 50%,
        99.7% 50.6%,
        99.4% 52%,
        99% 54%,
        /* Sommet bas-droite (5 points) */
        74% 98.4%,
        73% 99.4%,
        72% 99.8%,
        71% 100%,
        70% 100%,
        /* Bord bas */
        30% 100%,
        /* Sommet bas-gauche (5 points) */
        29% 100%,
        28% 99.8%,
        27% 99.4%,
        26% 98.4%,
        /* Sommet gauche (5 points) */
        1% 54%,
        0.6% 52%,
        0.3% 50.6%,
        0.2% 50%,
        0.3% 49.4%,
        0.6% 48%,
        1% 46%
    );
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.custom-tiles-tile {
    background-color: var(--border-color, #000000);
}

/* Styles de bordure */
.custom-tiles-wrapper[style*="--border-style: solid"] .custom-tiles-tile {
    background-color: var(--border-color, #000000);
}

.custom-tiles-wrapper[style*="--border-style: double"] .custom-tiles-tile {
    background: 
        linear-gradient(var(--border-color, #000000), var(--border-color, #000000)) padding-box,
        repeating-linear-gradient(
            90deg,
            var(--border-color, #000000) 0px,
            var(--border-color, #000000) 3px,
            transparent 3px,
            transparent 6px,
            var(--border-color, #000000) 6px,
            var(--border-color, #000000) 9px
        ) border-box;
}

.custom-tiles-wrapper[style*="--border-style: dashed"] .custom-tiles-tile {
    background: 
        repeating-linear-gradient(
            90deg,
            var(--border-color, #000000) 0px,
            var(--border-color, #000000) 15px,
            transparent 15px,
            transparent 25px
        ),
        repeating-linear-gradient(
            0deg,
            var(--border-color, #000000) 0px,
            var(--border-color, #000000) 15px,
            transparent 15px,
            transparent 25px
        ),
        repeating-linear-gradient(
            45deg,
            var(--border-color, #000000) 0px,
            var(--border-color, #000000) 10px,
            transparent 10px,
            transparent 18px
        ),
        repeating-linear-gradient(
            -45deg,
            var(--border-color, #000000) 0px,
            var(--border-color, #000000) 10px,
            transparent 10px,
            transparent 18px
        );
}

.custom-tiles-wrapper[style*="--border-style: dotted"] .custom-tiles-tile {
    background: 
        radial-gradient(
            circle at 50% 50%,
            var(--border-color, #000000) 0px,
            var(--border-color, #000000) 3px,
            transparent 3px,
            transparent 100%
        );
    background-size: 12px 12px;
    background-position: 0 0;
}

/* Bordure intérieure avec style personnalisable */
.custom-tiles-hexagon::before {
    content: '';
    position: absolute;
    top: var(--border-width, 2rem);
    left: var(--border-width, 2rem);
    right: var(--border-width, 2rem);
    bottom: var(--border-width, 2rem);
    clip-path: polygon(
        /* Sommet haut-gauche (5 points) */
        26% 1.6%,
        27% 0.6%,
        28% 0.2%,
        29% 0%,
        30% 0%,
        /* Bord haut */
        70% 0%,
        /* Sommet haut-droite (5 points) */
        71% 0%,
        72% 0.2%,
        73% 0.6%,
        74% 1.6%,
        /* Sommet droite (5 points) */
        99% 46%,
        99.4% 48%,
        99.7% 49.4%,
        99.8% 50%,
        99.7% 50.6%,
        99.4% 52%,
        99% 54%,
        /* Sommet bas-droite (5 points) */
        74% 98.4%,
        73% 99.4%,
        72% 99.8%,
        71% 100%,
        70% 100%,
        /* Bord bas */
        30% 100%,
        /* Sommet bas-gauche (5 points) */
        29% 100%,
        28% 99.8%,
        27% 99.4%,
        26% 98.4%,
        /* Sommet gauche (5 points) */
        1% 54%,
        0.6% 52%,
        0.3% 50.6%,
        0.2% 50%,
        0.3% 49.4%,
        0.6% 48%,
        1% 46%
    );
    z-index: 1;
}


.custom-tiles-central {
    background-color: transparent;
}

.custom-tiles-central::before {
    background-color: var(--central-bg-color, #FF8C00);
}

.custom-tiles-tile::before {
    background-color: var(--tile-bg-color, #9B59B6);
    animation: hueShift 8s ease-in-out infinite;
}

/* Animation de variation de teinte */
@keyframes hueShift {
    0%, 100% {
        filter: hue-rotate(0deg);
    }
    50% {
        filter: hue-rotate(30deg);
    }
}

/* Délais différents pour chaque tuile */
.custom-tiles-tile-1::before {
    animation-delay: 0s;
}

.custom-tiles-tile-2::before {
    animation-delay: 1.3s;
}

.custom-tiles-tile-3::before {
    animation: none;
}

.custom-tiles-tile-4::before {
    animation-delay: 4s;
}

.custom-tiles-tile-5::before {
    animation: none;
}

.custom-tiles-tile-6::before {
    animation-delay: 6.6s;
}

/* Positionnement des hexagones */
.custom-tiles-central {
    grid-column: 2;
    grid-row: 1;
    z-index: 10;
    margin-top: 0;
}

.custom-tiles-tile-1 {
    grid-column: 1;
    grid-row: 2;
    margin-left: calc(var(--tile-width, 15rem) / 2);
}

.custom-tiles-tile-2 {
    grid-column: 2;
    grid-row: 2;
}

.custom-tiles-tile-3 {
    grid-column: 3;
    grid-row: 2;
    margin-left: calc(var(--tile-width, 15rem) / -2);
}

.custom-tiles-tile-4 {
    grid-column: 1;
    grid-row: 3;
    margin-left: calc(var(--tile-width, 15rem) / 2);
    margin-top: 0;
}

.custom-tiles-tile-5 {
    grid-column: 2;
    grid-row: 3;
    margin-top: 0;
}

.custom-tiles-tile-6 {
    grid-column: 3;
    grid-row: 3;
    margin-left: calc(var(--tile-width, 15rem) / -2);
    margin-top: 0;
}

/* Tuile centrale */
.custom-tiles-central-text {
    color: #FFFFFF;
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    text-transform: uppercase;
    padding: 2rem;
    z-index: 2;
    position: relative;
}

.custom-tiles-central-image {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
    z-index: 2;
    position: relative;
}

/* Tuiles personnalisées */
.custom-tiles-tile {
    cursor: pointer;
    transition: transform 0.3s ease;
}

.custom-tiles-tile:hover {
    transform: scale(1.05);
}

.custom-tiles-image-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: opacity 0.3s ease;
}

.custom-tiles-tile-image {
    max-width: 60%;
    max-height: 60%;
    object-fit: contain;
}

.custom-tiles-tile-title {
    position: absolute;
    bottom: 1rem;
    left: 0;
    right: 0;
    color: #FFFFFF;
    font-size: 1rem;
    font-weight: bold;
    text-align: center;
    padding: 0.5rem;
    padding-bottom: 1rem !important;
    z-index: 3;
    transition: opacity 0.3s ease;
}

.custom-tiles-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 4;
    padding: 2rem;
}

.custom-tiles-tile:hover .custom-tiles-overlay {
    opacity: 1;
}

.custom-tiles-tile:hover .custom-tiles-image-wrapper {
    opacity: 0.2;
}

.custom-tiles-tile:hover .custom-tiles-tile-title {
    opacity: 0;
}

.custom-tiles-tile-text {
    color: #FFFFFF;
    font-size: 0.9rem;
    text-align: center;
    line-height: 1.4;
}

/* Désactiver le hover */
.custom-tiles-tile.custom-tiles-no-hover {
    cursor: default !important;
}

.custom-tiles-tile.custom-tiles-no-hover:hover {
    transform: none !important;
}

.custom-tiles-tile.custom-tiles-no-hover .custom-tiles-overlay {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.custom-tiles-tile.custom-tiles-no-hover:hover .custom-tiles-overlay {
    display: none !important;
    opacity: 0 !important;
}

.custom-tiles-tile.custom-tiles-no-hover:hover .custom-tiles-image-wrapper {
    opacity: 1 !important;
}

.custom-tiles-tile.custom-tiles-no-hover:hover .custom-tiles-tile-title {
    opacity: 1 !important;
}

.custom-tiles-empty {
    opacity: 0.3;
    cursor: default;
}

.custom-tiles-empty:hover {
    transform: none;
}

/* Responsive */
@media (max-width: 1024px) {
    .custom-tiles-image-wrapper img {
        top: -20px;
        position: relative;
    }
    .custom-tiles-tile-title {
        position: relative;
        top: 65px;
    }
}
@media (max-width: 768px) {
    .custom-tiles-wrapper {
        grid-template-columns: repeat(3, var(--tile-width, 10rem));
        grid-template-rows: repeat(3, var(--tile-height, 8.67rem));
        max-width: 40rem;
    }

    .custom-tiles-tile-title {
        position: relative;
        top: 30px;
    }
    
    /* Suppression des tailles fixes pour utiliser les variables CSS */
    
    .custom-tiles-tile-1 {
        margin-left: calc(var(--tile-width, 10rem) / 2);
    }
    
    .custom-tiles-tile-2 {
        margin-top: 0;
    }
    
    .custom-tiles-tile-3 {
        margin-left: calc(var(--tile-width, 10rem) / -2);
    }
    
    .custom-tiles-tile-4 {
        margin-left: calc(var(--tile-width, 10rem) / 2);
        margin-top: 0;
    }
    
    .custom-tiles-tile-5 {
        margin-top: 0;
    }
    
    .custom-tiles-tile-6 {
        margin-left: calc(var(--tile-width, 10rem) / -2);
        margin-top: 0;
    }
    
    .custom-tiles-central-text {
        font-size: 1rem;
        padding: 1.33rem;
    }
    
    .custom-tiles-tile-title {
        font-size: 0.7rem;
        padding: 0.33rem;
    }
    
    .custom-tiles-tile-text {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .custom-tiles-wrapper {
        grid-template-columns: repeat(3, var(--tile-width, 7.5rem));
        grid-template-rows: repeat(3, var(--tile-height, 6.5rem));
        max-width: 30rem;
    }

    .custom-tiles-image-wrapper img {
        top: -20px;
        position: relative;
    }

    /* Suppression des tailles fixes pour utiliser les variables CSS */
    
    .custom-tiles-tile-1 {
        margin-left: calc(var(--tile-width, 7.5rem) / 2);
    }
    
    .custom-tiles-tile-2 {
        margin-top: 0;
    }
    
    .custom-tiles-tile-3 {
        margin-left: calc(var(--tile-width, 7.5rem) / -2);
    }
    
    .custom-tiles-tile-4 {
        margin-left: calc(var(--tile-width, 7.5rem) / 2);
        margin-top: 0;
    }
    
    .custom-tiles-tile-5 {
        margin-top: 0;
    }
    
    .custom-tiles-tile-6 {
        margin-left: calc(var(--tile-width, 7.5rem) / -2);
        margin-top: 0;
    }
    
    .custom-tiles-central-text {
        font-size: 0.75rem;
        padding: 1rem;
    }
    
    .custom-tiles-tile-title {
        font-size: 0.55rem;
        padding: 0.25rem;
    }
    
    .custom-tiles-tile-text {
        font-size: 0.55rem;
    }
}
