:root {
    --card-bg: #e2e9ff;
    /* Zone de texte légèrement transparente pour voir l'effet du fond */
    --text-area-bg: rgba(203, 214, 255, 0.85); 
    --accent-dark: #3a4256;
    --white: #ffffff;
}

/* --- STRUCTURE 3D --- */
.card-wrapper {
    perspective: 1200px;
}

.card-3d {
    width: 90vw;        /* Utilise 90% de la largeur de l'écran sur mobile */
    max-width: 340px;   /* Mais ne dépasse jamais 340px sur PC */
    height: 500px;
    background-color: var(--card-bg); /* Couleur de secours */
    border-radius: 25px;
    border: 5px solid var(--white);
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.1s ease;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    margin: auto;       /* Sécurité pour le centrage */
    touch-action: none; /* Empêche le scroll natif pendant qu'on touche la carte */
    z-index: 1;         /* Indispensable pour que le fond flouté reste derrière */
}

/* --- FOND GALACTIQUE FLOUTÉ --- */
.card-3d::before {
    content: "";
    position: absolute;
    /* Valeurs négatives pour cacher les bords imparfaits du flou */
    top: -15px; 
    left: -15px;
    right: -15px;
    bottom: -15px;
    
    background-image: url('../media/SetNexus/CardBackground.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    
    /* Modifie cette valeur pour augmenter ou diminuer le flou de l'image */
    filter: blur(4px); 
    
    z-index: -1; /* Place l'image tout au fond de la carte */
}

.card-content {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 2;
    transform-style: preserve-3d;
    display: flex;
    flex-direction: column;
    padding: 15px;
}

/* --- EFFET HOLOGRAPHIQUE --- */
.holo-layer {
    position: absolute;
    inset: -100%; /* Déborde pour couvrir lors des rotations */
    background: linear-gradient(
            110deg,
            rgba(255, 255, 255, 0.0) 30%,
            rgba(255, 0, 13, 0.6) 45%,
            rgba(0, 255, 55, 0.8) 50%,
            rgba(13, 0, 255, 0.8) 55%,
            rgba(255, 0, 234, 0.8) 70%
        );
    z-index: 5;
    mix-blend-mode: color-dodge;
    opacity: 0.5;
    pointer-events: none;
    transform: translateZ(20px);
}

/* --- PERSONNAGE (EFFET DE PROFONDEUR) --- */
.character-container {
    height: 280px;
    display: flex;
    justify-content: center;
    align-items: center;
    transform-style: preserve-3d;
}

.character {
    width: 90%;
    z-index: 3;
    filter: drop-shadow(0 10px 15px rgba(0,0,0,0.3));
    /* Le transform est géré par JS pour le translateZ */
}

/* --- ÉLÉMENTS VISUELS (UI) --- */
.level-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: #d63384;
    color: white;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 3px solid var(--accent-dark);
    transform: translateZ(40px); /* Flotte au dessus */
}

/* --- RECTANGLES GRIS BISEAUTÉS --- */
.stat-column {
    position: absolute;
    top: 15px;
    right: 0px; 
    display: flex;
    flex-direction: column;
    gap: 8px;
    transform: translateZ(40px);
}

.stat-tab {
    background: var(--accent-dark);
    color: white;
    width: 50px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
    /* Forme biseautée sur la gauche */
    clip-path: polygon(20% 0%, 100% 0%, 100% 100%, 0% 100%);
}

/* --- ZONE DE TEXTE --- */
.effect-box {
    background-color: var(--text-area-bg);
    margin: 10px 0;
    padding: 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    color: #334155;
    transform: translateZ(30px);
    text-align: center;
    /* Léger flou derrière la boîte de texte pour la lisibilité */
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

/* --- PIED DE CARTE --- */
.card-footer-custom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    transform: translateZ(50px);
}

.dice-stat {
    background: var(--accent-dark);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.card-name {
    font-size: 1.5rem;
    font-weight: 900;
    /* --- NOUVEAU STYLE EN CADRE --- */
    color: var(--white); 
    background-color: var(--accent-dark); 
    border-radius: 8px; 
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4); 
    /* Le margin et padding sont gérés en HTML via Bootstrap (m-0, px-4, py-1) */
}


/* =========================================
   NOUVELLES CLASSES (Remplacement du Inline & Thème)
   ========================================= */

.dropdown-custom-nexus {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.divider-custom-nexus {
    border-color: var(--border-color);
}

.letter-spacing-1 {
    letter-spacing: 1px;
}

/* --- BOUTON DÉTAILS (Thème Dynamique) --- */
.btn-details-nexus {
    color: var(--text-primary) !important; 
    border-color: var(--text-primary) !important; /* La bordure change avec le thème */
    background-color: transparent; /* Fond transparent par défaut */
    transition: color 0.4s ease, border-color 0.4s ease, background-color 0.4s ease;
}

.btn-details-nexus:hover,
.btn-details-nexus:focus {
    background-color: var(--text-primary);
    color: var(--bg-card) !important;
}

/* =========================================
   MENUS DÉROULANTS PERSONNALISÉS (Nexus Select)
   ========================================= */

.nexus-select {
    background-color: rgba(30, 35, 50, 0.6) !important; /* Fond sombre translucide */
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    cursor: pointer;
    /* Flèche blanche personnalisée pour coller au thème sombre */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
}

.nexus-select:hover {
    border-color: rgba(255, 255, 255, 0.4) !important;
    background-color: rgba(40, 45, 60, 0.8) !important;
}

.nexus-select:focus {
    border-color: #00f2fe !important; /* Glow Cyan holographique au clic */
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.3) !important;
    outline: none;
}

/* Le fond des options une fois le menu ouvert */
.nexus-select option {
    background-color: #1e2332; /* Fond uni très sombre */
    color: #ffffff;
    font-weight: 500;
    padding: 12px;
}

/* =========================================
   BARRE DE RECHERCHE PERSONNALISÉE
   ========================================= */

.nexus-input {
    background-color: rgba(30, 35, 50, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.nexus-input:focus {
    border-color: #00f2fe !important; 
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.3) !important;
    outline: none;
}

/* =========================================
   REMPLACEMENT DES STYLES INLINE
   ========================================= */

/* Arrondis asymétriques pour la barre de recherche */
.nexus-search-icon {
    border-radius: 12px 0 0 12px;
    border-right: none;
}

.nexus-search-field {
    border-radius: 0 12px 12px 0;
    border-left: none;
}

/* Taille fixe pour les boutons du filtre */
.btn-filter-nexus {
    border-radius: 12px;
    height: 46px;
}

/* Limites de largeur pour la carte */
.card-name-limit {
    max-width: 170px;
}

.btn-details-wrapper {
    max-width: 340px;
}

/* --- Classes spécifiques pour detail.php --- */
.detail-card-container {
    max-width: 400px;
}

.legal-text-tiny {
    font-size: 0.75rem;
}

.avatar-comment {
    width: 50px;
    height: 50px;
}

.border-dashed {
    border-style: dashed !important;
}

.rating-select-width {
    width: auto;
}