/* Formatage globale de la page */
:root {
    --main-font: Poppins, sans-serif;
    --second-font: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --base-font-size: 1rem;
    --main-text-color: #ffffff;
    --secondary-text-color: #000000;
    --third-text-color: #164fac;
    --text-hover-color: #5581cc;
    --dark-text-color: rgba(0, 0, 0, 0.799);
    --dark-primary-color: rgba(0, 0, 0, 0.195);
    --dark-secondary-color: rgba(0, 0, 0, 0.088);
    --dark-third-color: rgba(0, 0, 0, 0.519);
    --red-color: rgba(255, 0, 0, 0.711);
    --logo-font: system-ui, -apple-system, sans-serif;
}
button:active {
    animation: fade-out 0.3s ease forwards;
}

@keyframes fade-out {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0.5;
        transform: scale(0.95);
    }
}
* {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    box-sizing: border-box;
    /* Pour cacher la barre de défilement */
    scrollbar-width: none; /* firefox */
    -ms-overflow-style: none; /* Internet Explorer 10+ */
}
/* Pour cacher la barre de défilement pour les navigateurs WebKit(modernes) */
::-webkit-scrollbar {
    width: 0; /* Pour cacher la barre de défilement verticale */
    height: 0; /* Pour cacher la barre de défilement horizontale */
}
html {
    font-size: var(--base-font-size);
    font-family: var(--main-font);
}
body {
    min-height: 100vh;
    min-width: 100vw;
    display: flex;
    flex-direction: column;
}

header {
    position: relative;
    margin-bottom: 0px;
}

#movie-project {
    font-family: var(--main-font);
    line-height: 1.5;
    padding: 20px;
    margin-top: 60px;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../../images/pexels-googledeepmind-17483870.webp');
    background-size: cover;
    background-position: center;
    filter: blur(15px);
    z-index: -1;
    clip-path: inset(0 0 0 0);
}

#movie-project h2 {
    line-height: 1.2;
    font-size: 1.5em;
    margin-top: 0px;
    margin-bottom: 10px;
    color: var(--dark-text-color);
}

#movie-project h3 {
    font-size: 1.2em;
    margin: 10px 0 0 0;
    color: var(--dark-text-color);
}

#movie-project p {
    margin: 0px;
    font-size: 1em;
}

#movie-project ul {
    margin: 10px 0;
    padding-left: 20px;
    list-style: disc inside;
}

#movie-project li {
    margin: 0;
    line-height: 1.7;
}

#movie-project strong {
    color: var(--dark-text-color);
}

@media screen and (max-width: 1500px) {
    .movie-container #movie-grid {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
    }
    .movie-container .movie-card{
        width: calc(100% / 4 - 20px);
    }
}
@media screen and (max-width: 1235px) {
    .movie-container #movie-grid {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
    }
    .movie-container .movie-card{
        width: calc(100% / 3 - 20px);
    }
    .movie-card img {
        width: 100%;
        height: auto;
    }
    .carousel-track .carousel-item {
        height: 400px;
    }
    #reco-result .carousel-title {
        font-size: 0.9rem;
        margin: 0;
        padding-top: 2px;
    }
    #reco-result .carousel-rating {
        font-size: 0.7rem;
        margin: 0;
        padding: 2px;
    }
}
@media screen and (max-width: 950px) {
    .movie-container #movie-grid {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
    }
    .movie-container .movie-card {
        width: calc(100% / 2 - 20px);
    }
    .movie-card img {
        width: 100%;
        height: auto;
    }
    #reco-result .carousel-coverflow, .carousel-track {
        height: 570px;
    }
    .carousel-track .carousel-item {
        height: 300px;
    }
    .carousel-track .carousel-item.active {
        opacity: 1;
        transform: scale(1.5);
    }
     #reco-result .carousel-title {
        font-size: 0.7rem;
        margin: 0;
        padding-top: 2px;
    }
    #reco-result .carousel-rating {
        font-size: 0.6rem;
        margin: 0;
        padding: 2px;
    }
}
@media screen and (max-width: 800px) {
    #reco-result .carousel-coverflow, .carousel-track {
        height: 550px;
    }
    .carousel-track .carousel-item {
        height: 250px;
    }
    .carousel-track .carousel-item.active {
        opacity: 1;
        transform: scale(1.7);
    }
     #reco-result .carousel-title {
        font-size: 0.6rem;
        margin: 0;
        padding-top: 2px;
    }
    #reco-result .carousel-rating {
        font-size: 0.5rem;
        margin: 0;
        padding: 2px;
    }
}
@media screen and (max-width: 670px) {
    .movie-container #movie-grid {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
    }
    .movie-container .movie-card {
        width: calc(100% - 20px);
    }
    .movie-card img {
        width: 100%;
        height: auto;
    }
    .movie-info {
        padding: 10px;
    }
    #reco-result .carousel-coverflow, .carousel-track {
        height: 550px;
    }
    .carousel-track .carousel-item {
        height: 200px;
    }
    .carousel-track .carousel-item.active {
        opacity: 1;
        transform: scale(2.0);
    }
     #reco-result .carousel-title {
        font-size: 0.5rem;
         margin: 0;
        padding-top: 2px;
    }
    #reco-result .carousel-rating {
        font-size: 0.4rem;
        margin: 0;
        padding: 2px;
    }
}

@media screen and (max-width: 600px) {
    #movie-project {
        padding: 20px;
    }
    #reco-result .carousel-coverflow, .carousel-track {
        height: 580px;
    }
    .carousel-track .carousel-item {
        height: 200px;
    }
    .carousel-track .carousel-item.active {
        opacity: 1;
        transform: scale(2.2);
    }
    #reco-result .carousel-title {
        font-size: 0.5rem;
        margin: 0;
        padding-top: 2px;
    }
    #reco-result .carousel-rating {
        font-size: 0.4rem;
        margin: 0;
        padding: 2px;
    }
}
@media screen and (max-width: 500px) {
    #movie-project {
        padding: 20px;
    }
    #reco-result .carousel-coverflow, .carousel-track {
        height: 580px;
    }
    .carousel-track .carousel-item {
        height: 150px;
    }
    .carousel-track .carousel-item.active {
        opacity: 1;
        transform: scale(2.8);
    }
    #reco-result .carousel-title {
        font-size: 0.4rem;
        margin: 0;
        padding-top: 2px;
    }
    #reco-result .carousel-rating {
        font-size: 0.3rem;
        margin: 0;
        padding: 2px;
    }
}
@media screen and (max-width: 400px) {
    #movie-project {
        padding: 20px;
    }
    #reco-result .carousel-coverflow, .carousel-track {
        height: 580px;
    }
    .carousel-track .carousel-item {
        height: 150px;
    }
    .carousel-track .carousel-item.active {
        opacity: 1;
        transform: scale(2.9);
    }
    #reco-result .carousel-title {
        font-size: 0.4rem;
        margin: 0;
        padding-top: 2px;
    }
    #reco-result .carousel-rating {
        font-size: 0.3rem;
        margin: 0px;
        padding: 2px;
    }
}
.movie-container {
    border-radius: 8px;
    padding: 15px 30px;
    height: 70vh;
    max-height: 80vh; /* pour éviter que le conteneur ne dépasse la hauteur de la fenêtre */
    overflow-y: auto;
    overflow-x: unset; /* pour éviter le débordement horizontal */
    scroll-behavior: smooth; /* pour un défilement fluide */
}
/* Animation shimmer améliorée */
@keyframes shimmer {
    0% { background-position: -100% 0 }
    100% { background-position: 100% 0 }
}

.skeleton {
    background: linear-gradient(90deg, 
                var(--dark-secondary-color) 25%, 
                var(--dark-primary-color) 37%, 
                var(--dark-secondary-color) 50%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite linear;
    border-radius: 4px;
}

/* Règles spécifiques pour le poster en loading */
.movie-card.loading .movie-poster {
    position: relative;
    background: var(--dark-secondary-color);
    overflow: hidden;
    z-index: 1; /* Annule le z-index négatif */
}

.movie-card.loading .movie-poster::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
                transparent 25%, 
                var(--dark-primary-color) 50%, 
                transparent 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

.movie-card.loading .movie-poster img {
    opacity: 0;
    height: 0;
}

/* Modifiez ces règles */
.loading .movie-poster {
    background: linear-gradient(90deg, 
                var(--dark-secondary-color) 25%, 
                var(--dark-primary-color) 50%, 
                var(--dark-secondary-color) 75%) !important;
    background-size: 200% 100% !important;
    animation: shimmer 1.5s infinite linear !important;
    border-radius: 6px 6px 0 0 !important;
    display: block !important;
    border-bottom: 2px solid var(--dark-secondary-color) !important;
    z-index: 1 !important; /* Important pour annuler le z-index négatif */
    object-fit: none !important; /* Désactivez object-fit pendant le loading */
}

/* Ajoutez cette règle pour les images en loading */
.loading .movie-poster img {
  opacity: 0; /* Cache l'image réelle pendant le chargement */
}

.skeleton {
    background: linear-gradient(90deg, 
                var(--dark-secondary-color) 25%, 
                var(--dark-primary-color) 50%, 
                var(--dark-secondary-color) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
    border-radius: 4px;
}

.loading .movie-poster {
    background: var(--dark-secondary-color);
}

.loading .movie-title,
.loading .movie-year,
.loading .movie-rating {
    color: transparent !important;
    position: relative;
    overflow: hidden;
}

.loading .movie-title::after,
.loading .movie-year::after,
.loading .movie-rating::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
                var(--dark-secondary-color) 25%, 
                var(--dark-primary-color) 50%, 
                var(--dark-secondary-color) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
}
hr {
    border: none;
    border-top: 3px solid var(--dark-secondary-color);
    box-shadow: 0px 0px 20px 10px rgba(255, 255, 255, 0.64);
    z-index: 2; /* pour s'assurer que la ligne est au-dessus des autres éléments */
}
#movie-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr); /* 5 colonnes égales */
    gap: 20px; /* ou la valeur d'espacement que tu veux */
    width: 100%;
    height: auto;
    padding: 20px;
    padding-right: 0px;
    overflow-y: auto;
    overflow-x: unset; /* pour éviter le débordement horizontal */
}
.movie-card {
    border: 1px solid var(--dark-secondary-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0; /* important pour éviter le débordement */
    max-height: 600px;
    cursor: pointer;
    transition: outline 0.2s, box-shadow 0.2s;
}
.movie-card.selected {
    outline: 2px solid var(--third-text-color);
    box-shadow: 0 0 10px var(--dark-primary-color);
}
.movie-poster {
    z-index: -1;
    width: max-content;           /* occupe toute la colonne */
    max-height: max-content;
    aspect-ratio: 2/3;     /* ou 3/4, selon les posters */
    object-fit: cover;   /* NE COUPE RIEN, tout est visible */
    background: #eee;      /* couleur de fond neutre pour les bandes */
    border-radius: 6px 6px 0 0; /* arrondir le haut */
    display: block;
    border-bottom: 2px solid var(--dark-secondary-color);
}
.movie-title {
    font-size: 1.1em;
    text-align: center;
    margin-top: 10px;
    font-weight: bold;
    padding: 0 10px 10px 10px;
    color: var(--dark-text-color);
    overflow: hidden;
    text-overflow: ellipsis; /* Pour couper le texte trop long */
    white-space: nowrap; /* Pour éviter le retour à la ligne */
    width: 100%;
}
.movie-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 5px 0;
    font-size: 0.95em;
    margin-top: 5px;
}
.movie-year {
    flex: 1 0 1;
    font-weight: bold;
    color: var(--third-text-color);
    border: 1px solid var(--dark-secondary-color);
    border-radius: 4px;
    padding: 2px 6px;
    margin: 0 8px 5px 8px;
    font-family: monospace;
}
.movie-year i {
    font-style: normal;
    color: var(--dark-text-color);
}
.movie-rating {
    flex: 1;
    color: var(--third-text-color);
    font-weight: bold;
    font-family: monospace;
    border: 1px solid var(--dark-secondary-color);
    border-radius: 4px;
    padding: 2px 6px;
    margin: 0 8px 5px 8px;
}
.movie-rating i {
    font-style: normal;
    color: var(--dark-text-color);
}
.events-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
}

#load-more {
    align-self: center;
    color: var(--dark-third-color);
    background-color: transparent;
    border: 1px solid var(--dark-secondary-color);
    width: max-content;
    border-radius: 6px;
    padding: 8px 24px;
    font-size: 1.1em;
    cursor: pointer;
    margin: 20px;
    font-size: 1em;
    transition: background-color 0.3s, color 0.3s;
}
#load-more:hover {
    background-color: var(--dark-secondary-color);
    color: var(--dark-text-color);
}
#load-more.no-hover:hover {
    background-color: transparent;
    color: var(--dark-third-color);
}
.reco-indication {
    border-bottom: 2px solid var(--dark-secondary-color);
    border-top: 2px solid var(--dark-secondary-color);
    padding: 16px;
    width: 100%;
    color: var(--dark-text-color);
    margin-bottom: 30px;
    text-align: center;
}
#recommend-btn {
    background-color: var(--third-text-color);
    color: var(--main-text-color);
    border: none;
    border-radius: 8px;
    padding: 10px 24px;
    font-size: 1.1em;
    cursor: pointer;
    z-index: 100;
    transition: background 0.3s, color 0.3s;
}
#recommend-btn:hover {
    background: var(--text-hover-color);
}
#reco-result {
    margin-top: 32px;
}
.carousel-coverflow {
    position: relative;
    width: 100vw;
    height: 650px;
    margin: 10px auto 0 auto;
    padding: 0;
    background: var(--main-text-color);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.carousel-track {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    position: relative;
    width: 100%;
    height: 650px;
    transition: transform 0.3s;
    overflow-x: scroll;
}
.carousel-item {
    position: relative;
    width: 320px;
    height: 440px;
    margin: 0 10px;
    border: 2px solid var(--dark-secondary-color);
    border-radius: 8px;
    box-shadow: 0 2px 8px #0001;
    opacity: 0.7;
    transform: scale(0.80);
    transition: transform 0.3s, opacity 0.3s, z-index 0.3s;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.carousel-item.active {
    opacity: 1;
    transform: scale(1.25);
    z-index: 3;
    background: var(--main-text-color);
    box-shadow: 0 4px 16px #0002;
}
.carousel-item.adjacent {
    opacity: 0.9;
    transform: scale(1);
    z-index: 2;
}
.carousel-img {
    height: 100%;
    width: 100%;
    object-fit: cover;
    border-top-right-radius: 6px;
    border-top-left-radius: 6px;
    border-bottom: 2px solid var(--dark-secondary-color);
}
.carousel-title {
    margin: 8px 0 0 0;
    font-weight: bold;
    font-size: 1rem;
    text-align: center;
}
.carousel-rating {
    font-size: 0.9em;
    color: var(--dark-text-color);
    margin: 5px 0;
}
.carousel-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 8px;
    gap: 16px;
}
.carousel-dot-container {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 10px 0;
    padding: 5px 0;
}
.carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--dark-primary-color);
    border: none;
    cursor: pointer;
    outline: none;
    transition: background 0.2s;
    padding: 2.5px;
}
.carousel-dot.active {
    background: var(--dark-third-color);
}
.carousel-btn {
    background: none;
    border: none;
    font-size: 1em;
    cursor: pointer;
    color: var(--dark-text-color);
    padding: 5px 15px;
    border-radius: 4px;
    transition: background 0.2s;
}
.carousel-btn:active {
    background: var(--text-hover-color);
}