/* Couleurs */
:root {
    --orange: #fb8c00;
    --bleu: #1e88e5;
    --vert: #689f38;
    --dark: #2d3748;
    --light: #f7fafc;
	--dark-color: #2d3748; /* même que --dark */
    /* Ajoutez ces variables manquantes */
    --primary-color: #1e88e5; /* même que --bleu */
    --secondary-color: #fb8c00; /* même que --orange */
    --text-color: #2d3748; /* même que --dark */
    --text-light: #a0aec0;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

.ad-container {
    flex: 1;
    min-width: 300px;
    margin: 0 20px;
    text-align: center;
}

/* Boutons de catégories */
.categories-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0;
	overflow-x: auto; /* Permet le scroll horizontal si nécessaire */
    -webkit-overflow-scrolling: touch; /* Smooth scroll sur iOS */
}

.category-btn, .search-button {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    white-space: nowrap;
    font-size: 1.5rem;
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    transition: var(--transition);
    display: inline-block;
    text-align: center;
	flex-shrink: 0; /* Empêche le rétrécissement */
}

.category-btn {
    background: var(--orange);
    color: white;
}

.category-btn:hover, 
.category-btn.active,
.search-button:hover {
    background: var(--bleu);
	color: white;
    transform: translateY(-2px);
}

.titre_jeu {
	color:white;
	font-weight: 500;
	font-family: 'Poppins', sans-serif;
    font-size: 1.5rem;
	white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Section hero simplifiée */
.hero {
    background: var(--bleu);
    color: white;
    padding: 40px 20px;
    text-align: center;
    border-radius: 8px;
    margin: 20px 0;
}

.hero h1 {
	font-family: 'Poppins', sans-serif;
    font-size: 2rem;
    margin-bottom: 10px;
}

.section-title {
    margin: 40px 0 20px;
    font-size: 1.8rem;
    color: var(--dark-color);
    position: relative;
    padding-bottom: 10px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background-color: var(--secondary-color);
}

.games-grid {
	overflow: visible !important;
    display: grid;
	position: relative; /* Important pour le z-index */
    z-index: 1;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
    margin: 30px 0;
}

.game-card {
	border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    height: 320px; /* Hauteur totale fixe */
    display: flex;
    flex-direction: column;
}

/* Désactive l'animation pendant le chargement */
.game-card.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Highlight des jeux favoris */
.game-card.favorite {
    border: 2px solid #ff4081;
    order: -1; /* Place au début dans le flux flex/grid */
}

.game-card:hover {
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
    transform: translateY(-5px);
}

.game-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.game-card-flip {
	border-radius: 0 0 12px 12px; /* Arrondi seulement en bas */
    position: relative;
	height: 220px; /* Augmentation de la hauteur de la zone d'image */
	flex-grow: 1; /* Prend tout l'espace disponible */
    margin: 0; /* Suppression des marges */
    perspective: 1000px;
}

/* Header */
.game-card-header {
	border-radius: 12px 12px 0 0;
    background: #1e88e5;
	border-top-left-radius: 12px; /* Conserve l'arrondi en haut */
    border-top-right-radius: 12px;
    color: white;
	padding: 10px 12px; /* Légère réduction */
    text-align: center;
}

.game-card-footer {
    border-radius: 0 0 12px 12px;
    display: flex;
	height: 45px;
	padding: 5px 10px; /* réduire le padding */ 
	background: white;
    border-top: 1px solid #eee;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease; /* Animation fluide */
	margin-top: auto; /* Force le footer à rester en bas */
}

.game-card:hover .game-card-footer {
    background: #f9f9f9; /* Léger changement au survol */
}

.game-card:hover .game-card-front {
    transform: rotateY(180deg);
}

.game-card:hover .game-card-back {
    transform: rotateY(0deg);
}

.game-card-front, 
.game-card-back {
	border-radius: 0; /* Désactive l'arrondi pour les faces internes */
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.game-card-front {
    transform: rotateY(0deg);
}

.game-card-back {
    font-size: 1.3rem;
    transform: rotateY(180deg);
    background: #f8f9fa;
	padding: 10px; /* Réduction du padding */
    overflow-y: auto; /* Scroll si contenu trop long */
}

/* Image */
.game-card-front img {
	width: 100%;
    height: 100%;
    object-fit: contain; /* ou 'cover' selon l'effet souhaité */
    display: block;
    margin: 0 auto;
	padding: 5px;
    box-sizing: border-box;
}

.game-stats {
    margin: 5px 0;
    font-size: 1.3rem;
    color: #333;
}


.play-button {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    flex: 1; /* Ne pas occuper tout l'espace disponible */
    background: #fb8c00;
    color: white;
    text-align: center;
	padding: 5px 10px; /* réduire le padding */ 
	text-decoration: none;
    transition: all 0.3s;
    font-size: 1.5rem; /* Taille de police légèrement réduite */
    min-width: 80px; /* Largeur minimale */
    margin-right: 10px; /* Espace avec le bouton favori */
}

/* Version hover améliorée */
.play-button:hover {
	background: #1e88e5; /* Bleu au survol */
    transform: scale(1.05);
	box-shadow: 0 2px 5px rgba(0,0,0,0.2);
	color: white;
}

.popular-games {
    margin: 50px 0;
}

.games-slider {
    display: flex;
    overflow-x: auto;
    gap: 20px;
    padding: 20px 0;
    scroll-snap-type: x mandatory;
}

.game-slide {
    min-width: 300px;
    scroll-snap-align: start;
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    display: flex;
    flex-direction: column;
}

.game-slide img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.game-slide .play-button {
    margin: 0 15px 15px;
}

.game-container {
    margin-top: 30px;
}

.game-header {
    margin-bottom: 30px;
}

.game-header h1 {
    font-size: 2rem;
    color: var(--dark-color);
}

.game-meta {
    color: var(--text-light);
    font-size: 0.9rem;
}

.game-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 50px;
}

.game-iframe-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.game-iframe-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.game-info h2 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: var(--dark-color);
}

.game-description-container {
    flex-grow: 1;
    overflow: hidden;
    margin: 10px 0;
    max-height: 120px; /* Limite la hauteur */
}

.game-description-container p {
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.game-description, .game-desc, .game-instructions, .game-impact {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 20px;
}

.game-impact {
    background: linear-gradient(135deg, var(--primary-color), var(--dark-color));
    color: white;
}

.game-impact h2 {
    color: white;
}

.similar-games {
    margin-top: 50px;
}

/* Responsive */
@media (max-width: 768px) {
	.game-card {
        border-radius: 8px;
		height: 280px;
    }
	.game-card-flip {
        height: 180px;
    }
    
    .game-card-footer {
        height: 40px;
    }
	
    .game-content {
        grid-template-columns: 1fr;
    }
    
    header .container {
        flex-direction: column;
    }
    
    nav ul {
        margin-top: 15px;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
	
	.play-button {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .games-grid {
        grid-template-columns: 1fr;
    }
    
    nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    nav ul li {
        margin: 5px 10px;
    }
}

.pagination {
	display: flex;
    justify-content: center;
    gap: 8px;
    margin: 30px 0;
    flex-wrap: wrap;
    align-items: center;
    font-size: 1.5rem;
}

.page-btn {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    background: var(--orange);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: var(--transition);
    min-width: 36px;
    height: 36px;
}

.page-btn:hover, .page-btn.active {
    background: var(--bleu);
    transform: translateY(-2px);
	color: white;
}

.page-btn.active {
    font-weight: bold;
    transform: scale(1.1);
}

.page-btn.prev-next {
    background: rgba(251, 140, 0, 0.85);
}

.page-btn.first-last:hover, 
.page-btn.prev-next:hover {
    background: var(--bleu);
}

.per-page-selector {
    text-align: center;
    margin: 20px 0;
    font-size: 0.9rem;
}

.per-page-selector label {
    font-size: 1.5rem;
    margin-right: 10px;
    color: #000000;
}

.per-page-selector select {
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid var(--orange);
    background: white;
    color: #000000;
    cursor: pointer;
    transition: var(--transition);
}

.per-page-selector select:hover {
    border-color: var(--bleu);
}

.search-container {
	padding: 0 10px;
    margin: 15px auto;
	max-width: 100%; /* Ajout important */
}

/* Ajustement du formulaire */
.search-container form {
    display: flex;
    align-items: center;
    max-width: 600px;
    margin: 20px auto;
}

.search-input {
    flex: 1;
	min-width: 200px; /* Corrige le débordement */
	margin-right: 12px; /* Espace supplémentaire à droite */
    padding: 10px 15px;
    border: 2px solid var(--orange);
    border-radius: 4px;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    outline: none;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--bleu);
}

.search-button {
    background: var(--orange);
    color: white;
    border: none;
    cursor: pointer;
    white-space: nowrap;
	padding: 10px 20px; /* Padding horizontal augmenté */
    white-space: nowrap; /* Empêche le retour à la ligne du texte */
}


.search-clear {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    text-decoration: none;
    font-size: 1.2rem;
    padding: 0 10px;
}

.search-clear:hover {
    color: var(--orange);
}

.search-group {
    display: flex;
	flex-wrap: nowrap; /* Problème potentiel sur mobile */
	gap: 12px; /* Augmentation de l'espacement */
    align-items: center; /* Alignement vertical */
}

.search-form {
	position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@media (max-width: 480px) {
    .search-input, .search-button {
        padding: 8px 12px;
        font-size: 1rem;
    }
	.search-group {
        flex-direction: column;
    }
    .search-button {
        flex: 1; /* Prend toute la largeur */
    }
	.categories-container {
        gap: 6px;
        padding-bottom: 10px; /* Espace pour le scroll */
    }
    
    .category-btn {
        padding: 6px 10px;
        font-size: 1rem;
    }
}

/* Sur desktop */
@media (min-width: 768px) {
    .search-form {
        flex-direction: row;
        align-items: center;
    }
	.search-input {
        margin-right: 0; /* Retrait de la marge en mobile */
        min-width: calc(100% - 110px); /* Ajustement pour le bouton */
    }
    .search-group {
        flex: 1;
        margin-right: 10px;
		gap: 8px;
    }
	.game-card {
        height: 300px;
    }
    
    .game-card-flip {
        height: 150px;
    }
    
	.search-clear {
        position: static;
        transform: none;
        margin-top: 8px;
        text-align: center;
    }
}

/* Ajustement pour mobile */
@media (max-width: 600px) {
	.search-group {
        flex-direction: column; /* Empilement vertical */
        gap: 10px;
    }
    .search-container form {
        flex-direction: column;
    }
    
    .search-input {
        border-radius: 30px;
        margin-bottom: 10px;
		width: 100%; /* Pleine largeur */
    }
    
    .search-button {
        border-radius: 30px;
		width: 100%; /* Pleine largeur */
    }
    
    .search-clear {
        right: 20px;
        top: 15px;
        transform: none;
    }
}

.favorite-btn {
	position: relative;
    color: #a0aec0;
    background: none;
    border: none;
    font-size: 1.8rem; /* Taille augmentée */
    cursor: pointer;
    transition: all 0.3s ease;
    width: 40px; /* Légèrement plus large */
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 0.8; /* Légère transparence */
	z-index: 10; /* Au-dessus de la carte */
}

.favorite-btn i {
    position: absolute;
    transition: all 0.3s ease;
}

.favorite-btn .far {
    opacity: 0.8;
}

.favorite-btn .fas {
    color: #e53e3e;
    opacity: 0;
    transform: scale(0.5);
}

.favorite-btn.active .far {
    opacity: 0;
}

.favorite-btn.active .fas {
    opacity: 1;
    transform: scale(1);
}

/* Tooltip pour les cartes du bas */
.game-card:nth-last-child(-n+4) .favorite-btn .tooltip {
    bottom: auto;
    top: 100%;
    margin-top: 10px;
    margin-bottom: 0;
}

.game-card:nth-last-child(-n+4) .favorite-btn .tooltip::after {
    top: auto;
    bottom: 100%;
    border-color: transparent transparent #2d3748 transparent;
}

.favorite-btn:hover {
    color: #e53e3e; /* Rouge au survol pour indiquer l'action */
    transform: scale(1.1);
    opacity: 1;
}

.favorite-btn.active {
    color: #e53e3e !important; /* Rouge quand actif */
    opacity: 1;
    animation: pulse 0.5s ease;
}

/* Style pendant le traitement */
.favorite-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.favorites-info {
    font-size: 1.5rem;
    text-align: center;
    margin: 10px 0;
    color: #333; /* Remplace var(--text-light) */
}

.games-info  {
    font-size: 1.5rem;
    margin: 10px 0;
    color: #333; /* Remplace var(--text-light) */

}
.tooltip {
    --bs-tooltip-bg: #2d3748;
    --bs-tooltip-color: white;
    --bs-tooltip-font-size: 0.8rem;
}

.tooltip-inner {
    max-width: 200px;
    padding: 0.5rem 1rem;
}