/**
 * Discord Full Info - Styles complets
 * Version 3.2 avec tooltips au clic + scroll
 */

/* ============================================
   CONTENEUR PRINCIPAL
   ============================================ */
.discord-guilds-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 20px 0;
    margin: 20px 0;
}

/* ============================================
   CARTE DE GUILDE
   ============================================ */
.discord-guild-card {
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    overflow: visible;
    z-index: 1;
}

.discord-guild-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

/* Carte active (cliquée) passe au premier plan */
.discord-guild-card.active {
    z-index: 9999 !important;
}

/* ============================================
   ICÔNE DE GUILDE
   ============================================ */
.discord-guild-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.discord-guild-icon-default {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ============================================
   NOM DE GUILDE
   ============================================ */
.discord-guild-name {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    line-height: 1.3;
    word-break: break-word;
}

/* ============================================
   BADGES DE RÔLE
   ============================================ */
.discord-role {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* Couleurs par rôle */
.discord-role.admin {
    background: linear-gradient(135deg, #ff4b4b, #cc0000);
    color: #ffffff;
}

.discord-role.staff {
    background: linear-gradient(135deg, #ffa500, #ff6b00);
    color: #ffffff;
}

.discord-role.moderator {
    background: linear-gradient(135deg, #4a9eff, #0066cc);
    color: #ffffff;
}

.discord-role.member {
    background: linear-gradient(135deg, #43b581, #2d7d57);
    color: #ffffff;
}

/* ============================================
   BADGE OWNER
   ============================================ */
.discord-owner {
    display: inline-block;
    padding: 4px 10px;
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #000;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(255, 215, 0, 0.4);
}

/* ============================================
   BADGE PERMISSIONS
   ============================================ */
.discord-permissions-badge {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

/* ============================================
   TOOLTIP DES PERMISSIONS - VERSION CLIC
   ============================================ */
.discord-permissions-tooltip {
    position: absolute;
    top: 50%;
    left: 110%;
    transform: translateY(-50%);
    
    /* Apparence */
    background: #2c2f33;
    color: #ffffff;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    
    /* Dimensions augmentées */
    min-width: 320px;
    max-width: 450px;
    max-height: 500px;
    width: max-content;
    
    /* 🔥 CRITIQUE : Caché par défaut, ouvert au CLIC uniquement */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 1000;
    
    /* Scroll à l'intérieur */
    overflow-y: auto;
    overflow-x: hidden;
    
    /* Typographie */
    font-size: 13px;
    line-height: 1.5;
}

/* 🔥 SUPPRESSION DU HOVER - Le tooltip ne s'ouvre QUE au clic */
/* .discord-guild-card:hover .discord-permissions-tooltip {} <- SUPPRIMÉ */

/* ✅ Le tooltip s'affiche UNIQUEMENT quand la carte a la classe "active" */
.discord-guild-card.active .discord-permissions-tooltip {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Flèche du tooltip */
.discord-permissions-tooltip::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -8px;
    transform: translateY(-50%);
    border: 8px solid transparent;
    border-right-color: #2c2f33;
}

/* Scrollbar personnalisée pour le tooltip */
.discord-permissions-tooltip::-webkit-scrollbar {
    width: 8px;
}

.discord-permissions-tooltip::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.discord-permissions-tooltip::-webkit-scrollbar-thumb {
    background: rgba(114, 137, 218, 0.5);
    border-radius: 4px;
}

.discord-permissions-tooltip::-webkit-scrollbar-thumb:hover {
    background: rgba(114, 137, 218, 0.7);
}

/* Bouton de fermeture */
.discord-tooltip-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #ffffff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.discord-tooltip-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Titre du tooltip */
.discord-permissions-tooltip strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #7289da;
    margin-bottom: 12px;
    padding-bottom: 8px;
    padding-right: 30px; /* Espace pour le bouton de fermeture */
    border-bottom: 2px solid rgba(114, 137, 218, 0.3);
}

/* Liste des permissions */
.discord-permissions-tooltip ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.discord-permissions-tooltip li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    transition: background 0.2s ease;
    font-size: 13px;
}

.discord-permissions-tooltip li:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ============================================
   RESPONSIVE - TOOLTIP EN BAS SUR MOBILE
   ============================================ */
@media (max-width: 768px) {
    .discord-guilds-wrapper {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .discord-permissions-tooltip {
        /* Sur mobile, tooltip devient un modal en bas */
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        transform: none;
        max-width: 100%;
        max-height: 70vh;
        min-width: auto;
        border-radius: 16px 16px 0 0;
        z-index: 9999;
    }
    
    .discord-permissions-tooltip::before {
        display: none; /* Pas de flèche sur mobile */
    }
    
    .discord-tooltip-close {
        top: 12px;
        right: 12px;
        width: 32px;
        height: 32px;
        font-size: 20px;
    }
}

/* ============================================
   OVERLAY DE FERMETURE
   ============================================ */
.discord-tooltip-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    backdrop-filter: blur(2px);
}

.discord-tooltip-overlay.active {
    display: block;
}

/* ============================================
   ÉTAT VIDE
   ============================================ */
.discord-empty-state {
    text-align: center;
    padding: 60px 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
    border-radius: 12px;
    margin: 20px 0;
}

.discord-empty-state p {
    color: #495057;
    font-size: 16px;
    margin: 10px 0;
}

.discord-hint {
    color: #6c757d !important;
    font-size: 14px !important;
    font-style: italic;
}

/* ============================================
   VERSION SIMPLE (shortcode alternatif)
   ============================================ */
.discord-guilds-simple {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.discord-guilds-simple li {
    padding: 12px 16px;
    background: #f8f9fa;
    border-left: 4px solid #7289da;
    margin-bottom: 8px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.discord-guilds-simple .role {
    color: #6c757d;
    font-size: 13px;
    font-style: italic;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.discord-guild-card {
    animation: fadeIn 0.4s ease forwards;
}

/* Délai progressif pour chaque carte */
.discord-guild-card:nth-child(1) { animation-delay: 0.1s; }
.discord-guild-card:nth-child(2) { animation-delay: 0.2s; }
.discord-guild-card:nth-child(3) { animation-delay: 0.3s; }
.discord-guild-card:nth-child(4) { animation-delay: 0.4s; }
.discord-guild-card:nth-child(5) { animation-delay: 0.5s; }

/* Animation d'ouverture du tooltip */
.discord-guild-card.active .discord-permissions-tooltip {
    animation: tooltipSlideIn 0.3s ease forwards;
}

@keyframes tooltipSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

@media (max-width: 768px) {
    @keyframes tooltipSlideIn {
        from {
            opacity: 0;
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* ============================================
   MODE SOMBRE (si détecté)
   ============================================ */
@media (prefers-color-scheme: dark) {
    .discord-empty-state {
        background: linear-gradient(135deg, #2c2f33 0%, #23272a 100%);
    }
    
    .discord-empty-state p {
        color: #dcddde;
    }
    
    .discord-guilds-simple li {
        background: #2c2f33;
        color: #dcddde;
    }
}