/* ==========================================================================
   INTERFACE GACHA (MACHINE)
   ========================================================================== */
.gacha-wrapper {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

/* --- EN-TÊTE : PORTEFEUILLE --- */
.gacha-wallet {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap; /* Ajout pour que les badges s'empilent si l'écran est trop petit */
    gap: 15px;
    margin-bottom: 20px;
}

.currency-badge {
    background-color: var(--bg-main); /* S'adapte au mode jour/nuit */
    border: 1px solid var(--border-color); /* S'adapte au mode jour/nuit */
    border-radius: 20px;
    padding: 8px 16px;
    font-weight: bold;
    color: var(--text-primary); /* Texte noir/blanc selon le thème */
    display: flex;
    align-items: center;
    gap: 8px;
}

.currency-badge i.fa-ticket { color: #0dcaf0; }
.currency-badge i.fa-coins { color: #ffc107; }

/* --- BARRE LATÉRALE : BANNIÈRES --- */
.banner-sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
}

.banner-title-box {
    background: linear-gradient(135deg, var(--gacha), #4f46e5);
    color: white;
    text-align: center;
    padding: 16px;
    border-radius: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.banner-btn {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 14px 20px;
    border-radius: 12px;
    text-align: left;
    font-weight: bold;
    transition: all 0.3s ease;
    cursor: pointer;
}

.banner-btn.active {
    border-color: var(--gacha);
    background-color: rgba(139, 92, 246, 0.1);
    color: var(--gacha);
    box-shadow: inset 4px 0 0 var(--gacha);
}

.banner-btn:hover:not(.active) {
    border-color: var(--text-secondary); /* S'adapte au thème */
    background-color: var(--bg-main); /* S'adapte au thème */
}

/* --- VITRINE PRINCIPALE (FOND COMÈTE) --- */
.banner-showcase {
    background-image: url('../media/SetNexus/BGSpaceV2.webp'); 
    background-size: cover;
    background-position: center;
    border-radius: 16px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    background-clip: padding-box; /* Anti-débordement du fond sur les bordures */
    min-height: 400px; /* Plus petit sur mobile */
}

/* Ombre interne */
.banner-showcase::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, transparent 30%, rgba(0, 0, 0, 0.7) 100%);
    z-index: 0;
}

/* S'assure que la carte passe au dessus de l'ombre interne */
.banner-showcase .card-wrapper {
    z-index: 1;
}

/* --- RESPONSIVITÉ DE LA CARTE SHOWCASE --- */
.showcase-card-container {
    transform: scale(0.75); /* Réduit la carte sur mobile */
    transform-origin: center;
}

/* Retour à la normale sur grand écran */
@media (min-width: 992px) {
    .banner-showcase { 
        min-height: 550px; 
    }
    .showcase-card-container {
        transform: scale(1);
    }
}

/* --- COULEURS DES BOUTONS DE TIRAGE --- */
.pull-x1 {
    background-color: var(--bg-main); /* Remplace le #1f2937 fixe */
    color: var(--text-primary); /* Remplace le texte blanc fixe */
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.pull-x1:hover {
    background-color: var(--border-color);
    transform: translateY(-2px);
    color: var(--text-primary);
}

.pull-x10 {
    background: linear-gradient(to right, #bf953f, #fcf6ba, #b38728);
    color: #000;
    border: none;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.2);
    transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
}

.pull-x10:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(212, 175, 55, 0.4);
    color: #000;
}

/* ==========================================================================
   SECTION INVENTAIRE
   ========================================================================== */
.inventory-section {
    margin-top: 80px;
    border-top: 1px solid var(--border-color);
    padding-top: 60px;
}

/* ==========================================================================
   MODALES (DÉTAILS ET HISTORIQUE)
   ========================================================================== */
.modal-custom-nexus {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.table-custom-nexus {
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

.table-custom-nexus th {
    background-color: rgba(139, 92, 246, 0.1) !important; /* Léger violet sur l'en-tête */
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

.table-custom-nexus td {
    background-color: transparent !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

.table-custom-nexus.table-hover tbody tr:hover td {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

/* ==========================================================================
   CLASSES UTILITAIRES (MODALES ET RARETÉS)
   ========================================================================== */
/* Gère l'inversion de couleur de la croix selon le mode jour/nuit */
.btn-close-custom {
    filter: var(--invert-close-btn);
}

/* Couleur violette pour le rang SR */
.text-purple-nexus {
    color: #9c27b0 !important;
}

.bg-purple-nexus {
    background-color: #9c27b0 !important;
    color: #ffffff !important;
}

/* Hauteur minimum pour éviter les sauts de pagination dans l'historique */
.history-table-container {
    min-height: 250px;
}

/* ==========================================================================
   OVERLAY GACHA (ANIMATION ET AFFICHAGE STABLE)
   ========================================================================== */
.gacha-overlay {
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1050; /* Au-dessus des modales Bootstrap */
    
    /* CORRECTIONS POUR DÉBLOQUER LE SCROLL MOBILE */
    overflow-y: auto !important;
    overflow-x: hidden;
    justify-content: flex-start !important; /* Annule le centrage absolu qui bloquait l'écran */
    padding: 20px 0;
}

#gacha-result-header {
    margin-top: auto; /* Pousse vers le centre s'il y a de la place sur PC */
}

#gacha-result-footer {
    margin-bottom: auto; /* Pousse vers le centre s'il y a de la place sur PC */
}

.gacha-fade-in {
    transition: opacity 0.5s ease;
}

.gacha-perspective {
    perspective: 1000px;
}

.container-max-1200 {
    max-width: 1200px;
    margin: 0 auto;
}

/* On s'assure que l'espacement s'adapte aussi entre le mobile et le PC */
#gacha-cards-container {
    gap: clamp(15px, 3vw, 30px) !important;
}

/* --- ANIMATION DES CARTES --- */
.gacha-result-card {
    /* La largeur et la hauteur s'adaptent dynamiquement entre la taille mobile (100x150) et PC (160x240) */
    width: clamp(100px, 20vw, 160px);
    height: clamp(150px, 30vw, 240px);
    border-radius: 12px;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateY(180deg) scale(0.5);
    opacity: 0;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.6s ease;
    background-color: #1e1e24; /* Dos de la carte par défaut */
    overflow: hidden;
}

/* Classe ajoutée par le JS pour retourner la carte */
.gacha-result-card.revealed {
    transform: rotateY(0deg) scale(1);
    opacity: 1;
}

.gacha-result-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Badges sur les cartes */
.gacha-result-badge {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    /* Les textes et espacements s'adaptent aussi fluidement */
    font-size: clamp(0.6rem, 2vw, 0.8rem);
    padding: clamp(2px, 0.5vw, 4px) clamp(8px, 2vw, 12px);
    border-radius: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.2);
    font-weight: bold;
    white-space: nowrap; /* Empêche le texte de sauter à la ligne */
}

.gacha-dupe-tag {
    position: absolute;
    /* Placement et taille dynamiques */
    top: clamp(10px, 2vw, 15px);
    right: clamp(-35px, -5vw, -30px);
    padding: clamp(2px, 0.5vw, 4px) clamp(30px, 5vw, 40px);
    font-size: clamp(0.5rem, 1.5vw, 0.7rem);
    background: rgba(0,0,0,0.85);
    color: #fef08a;
    font-weight: bold;
    transform: rotate(45deg);
    border: 1px solid #d97706;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
    white-space: nowrap;
}

/* Couleurs de rareté (Bordures et Lueurs) */
.gacha-card-SR { border: 2px solid #8b5cf6; box-shadow: 0 0 15px rgba(139, 92, 246, 0.5); }
.gacha-card-S { border: 2px solid #f59e0b; box-shadow: 0 0 15px rgba(245, 158, 11, 0.5); }
.gacha-card-SS { border: 2px solid #ef4444; box-shadow: 0 0 20px rgba(239, 68, 68, 0.7); }
.gacha-card-SSS { 
    border: 2px solid #06b6d4; 
    box-shadow: 0 0 25px rgba(6, 182, 212, 0.8), inset 0 0 15px rgba(6, 182, 212, 0.5); 
}

/* --- BARRE DE PROGRESSION PITY --- */
.pity-progress-bg {
    height: 6px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    width: 100%; /* S'assure qu'elle remplit son parent col-12 */
    max-width: 100%; /* On enlève le 300px si on veut que ce soit grand */
}

#pity-progress-bar {
    /* Écoute la variable modifiée par le JS, 0% par défaut */
    width: var(--pity-width, 0%); 
    transition: width 0.5s ease, background-color 0.3s ease;
}


/* --- COMPTEUR D'INVENTAIRE THÈME-READY --- */
.text-main-nexus {
    color: var(--text-primary) !important; /* Noir en jour, blanc en nuit */
}

.inventory-badge-clean {
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    padding: 4px 15px; /* Légèrement plus large pour le confort */
    border-radius: 8px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.text-main-nexus {
    color: var(--text-primary) !important;
}

.fs-x-small {
    font-size: 0.75rem;
}