@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&display=swap');

:root {
    --background-color: #0a0a0a;
    --card-background-color: #141414;
    --white-color: rgb(226, 226, 226);
    --border-color: #e509148a;
    --button-primary: #e50914;
    --button-hover: #b1060f;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --card-shadow: rgba(0, 0, 0, 0.2);
    --text : #e509148a;
    --text-gray: gray;
    --movie-title: #222222;
    --red-color: #e50914;
}

::-webkit-scrollbar {
    display: none;
}

body {
    color: var(--text);
    font-family: Arial, sans-serif;
    background-color: var(--background-color);
    text-align: center;
}

a {
    text-decoration: none;
}

.container {
    padding: 5px;
    border-radius: 10px;
    box-shadow: 0px 0px 10px var(--shadow-color);
}

.title {
    display: flex;
    justify-content: center;
    align-items: baseline;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 4rem;
    color: var(--red-color);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 5% 0 2% 0;
}

.title h1 {
    margin: 0 0 0 15px;
}

h2 {
    font-size: 2rem;
    margin: 0% 0 2% 0;
    text-transform: uppercase;
    font-family: 'Bebas Neue', sans-serif;
    letter-spacing: 5px;
    color: transparent; /* Rendre le texte transparent */
    -webkit-text-stroke: 1px var(--button-hover); /* Bordure des lettres en rouge */
}

/* Styles pour l'input de recherche avec un bouton de suppression */
.search-box {
    position: relative;
    margin-bottom: 5%;
    padding: 0 10% 0 10%;
}

#search-input {
    padding: 10px;
    width: 80%;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background-color: var(--card-background-color);
    color: var(--white-color);
}

#search-input:active, #search-input:focus {
    outline: none;
    border-color: var(--red-color);
}

.clear-button {
    position: absolute;
    right: 15%;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--red-color);
    font-size: 1.2rem;
    cursor: pointer;
    display: none;
}

#search-input:not(:placeholder-shown) + .clear-button {
    display: block;
}

input {
    padding: 10px;
    width: 80%;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background-color: var(--card-background-color);
    color: var(--white-color);
}

input:active, input:focus {
    outline: none;
    border-color: var(--red-color);
}

.imdb-rating {
    font-size: 14px;
    font-weight: bold;
    color: #f39c12;
    background: #222;
    display: inline-block;
    padding: 5px 10px;
    border-radius: 5px;
    margin-top: 5px;
}

#movie-popup {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgb(0,0,0);
    background-color: rgba(0,0,0,0.4);
}

.popup-content {
    background-color: var(--card-background-color);
    margin: 3% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 65%;
    height: 90%;
    overflow: auto;
    border-radius: 10px;
}

.popup-content p {
    color: var(--text-gray);
    font-size: 16px;
    padding: 0 100px 0 100px;
}

.popup-content h3 {
    color: var(--red-color);
    font-size: 50px;
    margin: 10px 0;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close:hover,
.close:focus {
    color: var(--red-color);
    text-decoration: none;
    cursor: pointer;
}

/* CAROUSEL */
.carousel {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 5%;
}

.popular-movies {
    overflow-x: auto;
    padding: 10px;
    white-space: nowrap;
    scroll-behavior: smooth;
    width: 80%;
    max-width: 100%;
}

.popular-movies .movie-card {
    margin-right: 10px;
    transition: transform 0.3s ease-in-out;
}

/* Effet de décalage */
.popular-movies.scrolling-right .movie-card {
    transform: translateX(-20px);
}

.popular-movies.scrolling-left .movie-card {
    transform: translateX(20px);
}

.popular-movies .movie-card:last-child {
    margin-right: 0;
}

.popular-movies .movie-card h3 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Positionnement des flèches */
.arrow {
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    color: var(--button-primary);
    padding: 10px;
    user-select: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    text-align: center;
    line-height: 40px;
    box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.2);
}

.arrow:hover {
    background: var(--button-hover);
}

.left, .right {
    cursor: pointer;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}
.left {
    left: 10px;
    display: none;
}
.right {
    right: 10px;
}

/* CARTES DE FILM */
.movie-card {
    background: var(--card-background-color);
    padding: 15px;
    border-radius: 10px;
    width: 200px;
    box-shadow: 0px 0px 5px var(--card-shadow);
    display: inline-block;
    cursor: pointer;
}

.movie-card img {
    width: 100%;
    height: 250px;
    border-radius: 5px;
}

.movie-card h3 {
    color: var(--white-color);
    font-size: 16px;
    margin: 10px 0;
}

.movie-card p {
    font-size: 14px;
    color: var(--text-gray);
}

/* SECTION TOUS LES FILMS */
#all-movies {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

/* Loader */
#loader {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 5% 0 5% 0;
}

.hidden {
    display: none;
}

.invisible {
    visibility: hidden;
}

/* Animation du spinner */
.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(0, 0, 0, 0.1);
    border-top: 5px solid var(--red-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Animation pour faire apparaître les films */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.movie-card {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Ajoutez ce code à la fin de votre fichier style.css */

/* Styles pour les écrans de taille inférieure à 768px (tablettes et mobiles) */
@media (max-width: 768px) {
    .title {
        font-size: 2rem;
    }
    .title img {
        width: 50px;
    }

    .title h1 {
        margin: 10px 0 0 0;
    }

    .search-box {
        padding: 0 5%;
    }

    input {
        width: 100%;
    }

    .carousel {
        flex-direction: column;
    }

    .arrow {
        display: none;
    }

    .popup-content {
        padding: 10px;
    }

    .popup-content p {
        padding: 0 20px;
    }

    .popup-content h3 {
        font-size: 30px;
    }
}

/* Styles pour les écrans de taille inférieure à 480px (mobiles) */
@media (max-width: 480px) {
    .title {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }

    .popup-content img {
        width: 80%;
    }

    .popup-content h3 {
        font-size: 24px;
    }
}