/* Game Dropdown Menus for Pokemon and Magic */
.game-dropdown {
    position: relative;
    display: inline-block;
    min-width: 90px; /* Largeur minimale pour éviter le décalage */
}

/* Prévenir le flash du contenu au chargement */
.game-dropdown-content {
    display: none;
    opacity: 0;
    visibility: hidden;
}

.game-dropdown-content.initialized {
    display: block;
}

/* Cacher le dropdown content jusqu'à ce qu'il soit actif */
.game-dropdown:not(.active) .game-dropdown-content {
    display: none !important;
}


/* Éviter le flash au chargement */
.game-dropdown-toggle span {
    display: inline-block;
    min-width: 60px;
}

.game-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: var(--text-primary, #fff);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    border-radius: 8px;
    white-space: nowrap; /* Empêcher le retour à la ligne */
}

.game-dropdown-toggle:hover {
    background: rgba(99, 91, 255, 0.1);
    color: var(--primary-color, #635bff);
}

.game-dropdown-toggle.active {
    background: rgba(99, 91, 255, 0.15);
    color: var(--primary-color, #635bff);
}

/* Logo dans le dropdown */
.game-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
    margin-right: 8px;
    vertical-align: middle;
}

/* Dropdown content */
.game-dropdown-content {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a !important;
    background-color: #1a1a1a !important;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    min-width: 250px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1000;
    overflow: hidden;
    border: 1px solid var(--border-color, #333);
}

.game-dropdown.active .game-dropdown-content {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Logo du dropdown */
.game-dropdown-logo {
    width: 100%;
    max-width: 200px;
    height: auto;
    display: block;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

/* Menu items */
.game-dropdown-menu {
    padding: 8px;
}

.game-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary, #fff);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.game-dropdown-item:hover {
    background: rgba(99, 91, 255, 0.1);
    color: var(--primary-color, #635bff);
    transform: translateX(4px);
}

.game-dropdown-item i {
    width: 20px;
    text-align: center;
    color: #666;
}

.game-dropdown-item:hover i {
    color: var(--primary-color, #635bff);
}

/* Divider */
.game-dropdown-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 8px 16px;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .game-dropdown-toggle {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .game-logo {
        height: 20px;
    }
    
    /* Normal dropdown dans le menu desktop sur mobile */
    .game-dropdown-content {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        transform: none;
        border-radius: 20px 20px 0 0;
        max-height: 70vh;
        overflow-y: auto;
        width: 100%;
        min-width: unset;
    }
    
    /* Dropdown dans le menu mobile - position normale */
    .nav.nav-open .game-dropdown-content {
        position: absolute;
        top: 100%;
        bottom: auto;
        left: 0;
        right: auto;
        width: 250px;
        max-height: 300px;
        border-radius: 12px;
        margin-top: 8px;
        transform: none;
        background: #0a0a0a !important;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 1);
        z-index: 10000;
    }
    
    .game-dropdown.active .game-dropdown-content {
        animation: slideUpMobile 0.3s ease;
    }
    
    /* Animation différente pour le menu mobile */
    .nav.nav-open .game-dropdown.active .game-dropdown-content {
        animation: fadeIn 0.3s ease;
    }
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(10px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

@keyframes slideUpMobile {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Badge nouveautés */
.game-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #ff4757;
    color: white;
    font-size: 11px;
    font-weight: bold;
    border-radius: 12px;
    margin-left: auto;
    text-transform: uppercase;
}

/* Overlay pour mobile */
.game-dropdown-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.game-dropdown.active .game-dropdown-overlay {
    display: block;
}

@media (max-width: 768px) {
    .game-dropdown-overlay {
        display: none;
    }
    
    .game-dropdown.active .game-dropdown-overlay {
        display: block;
    }
    
    /* Overlay dans le menu mobile pour masquer le contenu en dessous */
    .nav.nav-open .game-dropdown.active .game-dropdown-overlay {
        display: block !important;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: #0a0a0a;
        z-index: 9999;
    }
}

/* Animation fadeIn pour le menu mobile */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}