/**
 * Composant Infobulle - Styles
 *
 * Structure CSS :
 * - Conteneur principal et positionnement
 * - Flèche et bouton fermer
 * - Contenu interne (titre, body)
 * - Variantes thématiques (failles, planètes, etc.)
 * - Infobulles auto-générées (items avec/sans stats)
 */

/* ========================================
   CONTENEUR PRINCIPAL
   ======================================== */

.infobulle {
    position: absolute;
    z-index: 1000;
    max-width: 350px;
    min-width: 250px;
    background: linear-gradient(135deg, rgba(20, 25, 40, 0.98), rgba(30, 35, 50, 0.98));
    border: 1px solid rgba(100, 150, 255, 0.3);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(100, 150, 255, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
    pointer-events: none;
}

.infobulle.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.infobulle.above {
    transform: translateY(-10px);
}

.infobulle.above.visible {
    transform: translateY(0);
}

/* ========================================
   FLÈCHE
   ======================================== */

.infobulle-arrow {
    position: absolute;
    top: -8px;
    left: 50%;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, rgba(20, 25, 40, 0.98), rgba(30, 35, 50, 0.98));
    border-left: 1px solid rgba(100, 150, 255, 0.3);
    border-top: 1px solid rgba(100, 150, 255, 0.3);
    transform: rotate(45deg);
    margin-left: -8px;
}

.infobulle.above .infobulle-arrow {
    top: auto;
    bottom: -8px;
    border-left: none;
    border-top: none;
    border-right: 1px solid rgba(100, 150, 255, 0.3);
    border-bottom: 1px solid rgba(100, 150, 255, 0.3);
}

/* ========================================
   BOUTON FERMER
   ======================================== */

.infobulle-close {
    display: none;
}


/* ========================================
   CONTENU INTERNE
   ======================================== */

.infobulle-inner {
    padding: 15px;
}

.infobulle-title {
    font-size: 14px;
    font-weight: bold;
    color: #7cb3ff;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(100, 150, 255, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
}

.infobulle-title i {
    font-size: 16px;
}

.infobulle-title img {
    filter:
        drop-shadow(0.5px 0 0 currentColor)
        drop-shadow(-0.5px 0 0 currentColor)
        drop-shadow(0 0.5px 0 currentColor)
        drop-shadow(0 -0.5px 0 currentColor);
}

.infobulle-body {
    font-size: 12px;
    color: #c0c8d8;
    line-height: 1.6;
}

.infobulle-body p {
    margin: 0 0 10px 0;
}

.infobulle-body p:last-child {
    margin-bottom: 0;
}

/* ========================================
   VARIANTES THÉMATIQUES (contenu personnalisé)
   ======================================== */

/* Failles dimensionnelles */
.infobulle-faille .infobulle-title {
    color: #c87cff;
}

.infobulle-faille-1 .infobulle-title {
    color: #9c7cff;
}

.infobulle-faille-2 .infobulle-title {
    color: #c87cff;
}

.infobulle-faille-3 .infobulle-title {
    color: #ff7c9c;
}

/* Astéroïdes */
.infobulle-asteroid .infobulle-title {
    color: #d4a853;
}

/* Stations commerciales */
.infobulle-commercial .infobulle-title {
    color: #5ce1e6;
}

/* Planètes */
.infobulle-planet .infobulle-title {
    color: #7cb3ff;
}

.infobulle-planet-t .infobulle-title {
    color: #4caf50;
}

/* Terrestre */
.infobulle-planet-d .infobulle-title {
    color: #e6a23c;
}

/* Désertique */
.infobulle-planet-i .infobulle-title {
    color: #67c5dc;
}

/* Glacée */
.infobulle-planet-g .infobulle-title {
    color: #e580c2;
}

/* Gazeuse */
.infobulle-planet-r .infobulle-title {
    color: #a0826d;
}

/* Roc */
.infobulle-planet-l .infobulle-title {
    color: var(--infobulle-planet-l-color);
}

/* Magma */

/* ========================================
   BLOCS SPÉCIAUX
   ======================================== */

.infobulle-warning {
    background: rgba(255, 150, 50, 0.15);
    border-left: 3px solid #ff9632;
    padding: 8px 10px;
    margin: 10px 0;
    border-radius: 0 4px 4px 0;
    font-size: 11px;
    color: #ffb870;
}

.infobulle-info {
    background: rgba(100, 150, 255, 0.1);
    border-left: 3px solid #6496ff;
    padding: 8px 10px;
    margin: 10px 0;
    border-radius: 0 4px 4px 0;
    font-size: 11px;
    color: #90b8ff;
}

.infobulle-list {
    list-style: none;
    padding: 0;
    margin: 10px 0 0 0;
}

.infobulle-list li {
    padding: 4px 0 4px 18px;
    position: relative;
    font-size: 11px;
}

.infobulle-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    width: 8px;
    height: 8px;
    background: rgba(100, 150, 255, 0.5);
    border-radius: 50%;
}

.infobulle-body .picto_ressource {
    width: 14px;
    height: 14px;
    vertical-align: middle;
    margin-right: 2px;
}

/* ========================================
   ÉLÉMENTS CLIQUABLES (indicateur visuel)
   ======================================== */

[data-infobulle],
[data-infobulle-item] {
    cursor: help;
    transition: filter 0.2s ease;
}

[data-infobulle]:hover,
[data-infobulle-item]:hover {
    filter: brightness(1.2) drop-shadow(0 0 5px rgba(100, 150, 255, 0.5));
}

/* ========================================
   INFOBULLES AUTO-GÉNÉRÉES (items)
   ======================================== */

/* Variante compacte (sans stats) */
.infobulle.infobulle-compact {
    min-width: 120px;
    max-width: 200px;
}

.infobulle.infobulle-compact .infobulle-close {
    display: none;
}

.infobulle.infobulle-compact .infobulle-inner {
    padding: 10px 12px;
}

/* Variante avec stats */
.infobulle.infobulle-with-stats {
    min-width: 160px;
    max-width: 220px;
}

.infobulle.infobulle-with-stats .infobulle-close {
    display: none;
}

.infobulle.infobulle-with-stats .infobulle-inner {
    padding: 12px 14px;
}

/* Contenu des items */
.infobulle-item-content {
    text-align: center;
}

.infobulle-item-name {
    font-size: 14px;
    font-weight: bold;
    color: #7cb3ff;
    margin-bottom: 8px;
}

/* Nom avec séparateur quand il y a des stats */
.infobulle-with-stats .infobulle-item-name {
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(100, 150, 255, 0.2);
    margin-bottom: 10px;
}

/* Stats des items */
.infobulle-item-stats {
    margin-bottom: 10px;
}

.infobulle-item-stat {
    font-size: 12px;
    padding: 3px 0;
    display: flex;
    justify-content: space-between;
}

.infobulle-item-stat .stat-label {
    color: #8896b0;
}

.infobulle-item-stat .stat-value {
    color: #c0c8d8;
    font-weight: bold;
}

/* Lien vers info.php */
.infobulle-item-link {
    display: inline-block;
    font-size: 11px;
    color: #90b8ff;
    text-decoration: none;
    padding: 4px 8px;
    background: rgba(100, 150, 255, 0.1);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.infobulle-item-link:hover {
    background: rgba(100, 150, 255, 0.25);
    color: #fff;
}

.infobulle-item-link i {
    margin-right: 4px;
}

/* ========================================
   ICÔNES DE VAISSEAUX - SYSTÈME UNIFIÉ
   ======================================== */

/**
 * 3 tailles disponibles :
 * - ship-icon-sm : 32px (messages, affichage compact)
 * - ship-icon-md : 48px (taille intermédiaire)
 * - ship-icon-lg : 60px (rapports de combat, sélection)
 */

.ship-icon-sm,
.ship-icon-md,
.ship-icon-lg {
    border-radius: 4px;
    border: 1px solid rgba(100, 150, 255, 0.3);
    vertical-align: middle;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.ship-icon-sm {
    width: 32px;
    height: 32px;
}

.ship-icon-md {
    width: 48px;
    height: 48px;
}

.ship-icon-lg {
    width: 60px;
    height: 60px;
}

/* ========================================
   COMPOSANT UNIFIÉ : VAISSEAU + QUANTITÉ
   ======================================== */

/**
 * Structure HTML :
 * <div class="ship-display">
 *     <div class="ship-item">
 *         <img class="ship-icon-sm|md|lg" ... />
 *         <span class="ship-item-qty">123</span>
 *     </div>
 *     ...
 * </div>
 */

/* Conteneur pour groupe de vaisseaux */
.ship-display {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

/* Item vaisseau : icône + quantité en colonne */
.ship-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
}

/* Quantité sous l'icône */
.ship-item-qty {
    font-size: 12px;
    font-weight: bold;
    color: #c0c8d8;
}

/* Nom du propriétaire de la flotte */
.fleet-owner {
    font-weight: bold;
    font-size: 13px;
    margin-bottom: 6px;
    text-align: center;
}

/* Ressources transportées par une flotte */
.fleet-resources {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
    font-size: 12px;
    justify-content: center;
}

/* Attaques groupées */
.grouped-attack-fleets {
    margin-top: 8px;
}

/* ========================================
   TABLEAU DES MOUVEMENTS DE FLOTTE
   ======================================== */

.fleet-movements-table {
    font-size: 12px;
}

.fleet-movements-table th {
    white-space: nowrap;
}

/* Colonnes du tableau */
.fleet-composition {
    min-width: 150px;
}

.fleet-mission {
    min-width: 60px;
}

.fleet-aller,
.fleet-retour {
    min-width: 120px;
}

/* Icône de mission */
.mission-icon-container {
    display: inline-block;
    padding: 8px;
    background: rgba(100, 150, 255, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(100, 150, 255, 0.2);
}

.mission-icon-container .picto_mission {
    width: 28px;
    height: 28px;
    filter: brightness(0) saturate(100%) invert(66%) sepia(19%) saturate(1168%) hue-rotate(178deg) brightness(95%) contrast(88%);
}

/* Coordonnées */
.fleet-coords {
    font-family: monospace;
    font-size: 13px;
    font-weight: bold;
    color: #7cb3ff;
    margin-bottom: 2px;
}

/* Nom de la planète */
.fleet-planet-name {
    font-size: 11px;
    color: #8896b0;
    margin-bottom: 4px;
}

.fleet-planet-name a {
    color: inherit;
    text-decoration: none;
}

.fleet-planet-name a:hover {
    color: #7cb3ff;
}

/* Timer */
.fleet-timer {
    margin-top: 4px;
}

/* Route de la flotte (origine → destination) */
.fleet-route {
    font-family: monospace;
    font-size: 12px;
    font-weight: bold;
    color: #7cb3ff;
    margin-bottom: 6px;
    white-space: nowrap;
}

.fleet-route .route-arrow {
    color: #8896b0;
    margin: 0 4px;
}

/* ========================================
   MASQUAGE DES CONTENUS SOURCES
   ======================================== */

.infobulle-data {
    display: none !important;
}

/* ========================================
   RESPONSIVE
   ======================================== */

/* @media (max-width: 768px) {
    .infobulle {
        max-width: calc(100vw - 20px);
        min-width: 200px;
        left: 10px !important;
        right: 10px;
    }
} */

/* ========================================
   STATS DE FLOTTE (infobulle)
   ======================================== */

.fleet-stats-icon {
    font-size: 12px;
    color: rgba(124, 179, 255, 0.7);
    cursor: help;
    margin-left: 4px;
    transition: color 0.2s ease;
}

.fleet-stats-icon:hover {
    color: #7cb3ff;
}

.fleet-stats-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.fleet-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid rgba(100, 150, 255, 0.1);
}

.fleet-stat-row:last-child {
    border-bottom: none;
}

.fleet-stat-row .stat-label {
    color: #8896b0;
    font-size: 11px;
}

.fleet-stat-row .stat-value {
    color: #c0c8d8;
    font-weight: bold;
    font-size: 12px;
}