/* Variables de couleur pour la charte graphique */
:root {
    --primary-dark: #1a1a1a;
    --secondary-dark: #2d2d2d;
    --tertiary-dark: #404040;
    --light-gray: #6a6a6a;
    --medium-gray: #505050;
    --accent-orange: #ff8c00;
    --accent-orange-hover: #ff7700;
    --accent-orange-light: rgba(255, 140, 0, 0.1);
    --text-white: #ffffff;
    --text-light-gray: #e0e0e0;
    --text-medium-gray: #b0b0b0;
    --shadow-dark: rgba(0, 0, 0, 0.3);
    --shadow-darker: rgba(0, 0, 0, 0.6);
}

/* Reset et base */
html,
body {
    display: flex;
    flex-direction: column;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 300;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    /* background-color: var(--primary-dark); */
    color: var(--text-light-gray);
    min-height: 100vh;
}

/* Conteneur du fond d'écran flouté */
.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -10;
    background: url('../img/background.webp') no-repeat center center fixed;
    background-size: cover;
    filter: blur(var(--blur-intensity, 0px));
}

.background::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, 
        rgba(26, 26, 26, 0.1) 0%, 
        rgba(26, 26, 26, 0.3) 50%, 
        rgba(26, 26, 26, 0.5) 100%);
}

/* Section films récemment ajoutés */
.recently-added {
    padding: 2rem 1rem;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

.recently-added h2 {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--text-white);
    margin-bottom: 2rem;
    background: linear-gradient(135deg, var(--secondary-dark) 0%, var(--tertiary-dark) 100%);
    padding: 1rem;
    border-radius: 15px;
    border: 2px solid var(--accent-orange);
    box-shadow: 0 4px 15px var(--shadow-dark);
    text-shadow: 2px 2px 4px var(--shadow-dark);
}

/* Catégories */
.categorie-h4 {
    margin: 2rem 0 1rem 0;
}

.categorie-h4 h4 {
    background: linear-gradient(135deg, var(--accent-orange) 0%, var(--accent-orange-hover) 100%);
    color: var(--text-white);
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0;
    margin-bottom: -16px;
    padding: 12px 30px;
    border-radius: 25px 25px 0 0;
    text-align: center;
    box-shadow: 0 2px 10px var(--shadow-dark);
    text-shadow: 1px 1px 2px var(--shadow-dark);
}

/* Conteneur des films */
.film-container {
    background: linear-gradient(135deg, var(--secondary-dark) 0%, var(--tertiary-dark) 100%);
    border-radius: 0 0 15px 15px;
    padding: 0.75rem;
    box-shadow: 0 4px 20px var(--shadow-dark);
    border: 2px solid var(--accent-orange);
    border-top: none;
    margin-bottom: 2rem;
}

/* Carousel */
.carousel-container {
    position: relative;
    overflow: hidden;
    padding: 20px 20px;
}

.film-carousel {
    display: flex;
    gap: 20px;
    transition: transform 0.5s ease-in-out;
    will-change: transform;
    width: max-content;
    overflow: visible;
}

.carousel-btn {
    display: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, var(--accent-orange) 0%, var(--accent-orange-hover) 100%);
    color: var(--text-white);
    border: none;
    padding: 60px 15px;
    cursor: pointer;
    font-size: 1.8em;
    z-index: 10;
    border-radius: 10px;
    box-shadow: 0 4px 15px var(--shadow-dark);
    transition: all 0.3s ease;
}

.carousel-btn:hover {
    background: linear-gradient(135deg, var(--accent-orange-hover) 0%, var(--accent-orange) 100%);
    transform: translateY(-50%) scale(1.1);
}

.carousel-btn.left {
    left: 10px;
}

.carousel-btn.right {
    right: 10px;
}

/* Items de film */
.recent-film-item {
    position: relative;
    overflow: visible;
    background: linear-gradient(135deg, var(--light-gray) 0%, var(--medium-gray) 100%);
    border-radius: 12px;
    border: 2px solid var(--tertiary-dark);
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 4px 15px var(--shadow-dark);
}

.recent-film-item:hover {
    transform: scale(1.05) translateY(-5px);
    box-shadow: 0 8px 25px var(--shadow-darker);
    border-color: var(--accent-orange);
}

.film-carousel .recent-film-item:last-child {
    margin-right: 20px;
}

/* Images des films */
.recent-film-item .film-image {
    width: 220px;
    aspect-ratio: 2/3; /* Ratio cinéma standard pour les affiches */
    overflow: hidden;
    border-radius: 12px 12px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.recent-film-item .film-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
}

.recent-film-item:hover .film-image img {
    transform: scale(1.1);
}

/* Détails des films */
.recent-film-item .film-details {
    padding: 8px;
    padding-top: 5px;
    background: linear-gradient(135deg, var(--secondary-dark) 0%, var(--tertiary-dark) 100%);
    border-radius: 0 0 12px 12px;
    min-height: 105px;
    width: 204px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.recent-film-item h3 {
    color: var(--text-white);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 2.5px 0;
    text-align: center;
    line-height: 1.3;
    height: 2.6rem; /* Hauteur fixe pour exactement 2 lignes */
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limite à 2 lignes */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.recent-film-item .studio,
.recent-film-item .date-sortie {
    color: var(--text-medium-gray);
    font-size: 0.85rem;
    margin: 5px 0;
    line-height: 1.4;
    display: block;
}

.recent-film-item .studio strong,
.recent-film-item .date-sortie strong {
    color: var(--accent-orange);
    font-weight: 600;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* Media queries */
@media screen and (max-width: 768px) {
    .recently-added {
        padding: 1rem 0.5rem;
    }
    
    .recently-added h2 {
        font-size: 2rem;
        padding: 1rem;
    }
    
    .carousel-container {
        padding: 20px 10px;
    }
    
    .carousel-btn {
        display: none !important;
    }
    
    .film-carousel {
        gap: 15px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }
    
    .recent-film-item {
        scroll-snap-align: start;
        flex-shrink: 0;
    }
    
    .recent-film-item .film-image {
        width: 150px;
        height: 225px;
    }
}

@media screen and (max-width: 480px) {
    .recent-film-item .film-image {
        width: 130px;
        height: 195px;
    }
    
    .recent-film-item h3 {
        font-size: 1rem;
    }
    
    .categorie-h4 h4 {
        font-size: 1.2rem;
        padding: 10px 20px;
    }
}