/* --- Conteneur Croisade --- */
.crusade-container {
    height: 600px; /* Hauteur fixe pour permettre le scroll de la page */
    background: radial-gradient(ellipse at bottom, #1b2735 0%, #090a0f 100%);
    border: 2px solid var(--theme-accent); position: relative; display: block; flex-direction: column;
    overflow: hidden; box-shadow: inset 0 0 50px #000; border-radius: 4px; padding: 15px; box-sizing: border-box;
}
@media (max-width: 768px) { .crusade-container { height: 50vh; } }

/* Calques de fond Parallaxe */
.crusade-bg-layer { position: absolute; top: 50%; left: 50%; width: 1px; height: 1px; z-index: 0; pointer-events: none; border-radius: 50%; }
.trade-route-line { stroke: var(--theme-tech); stroke-width: 2; stroke-dasharray: 5; animation: dash 20s linear infinite; opacity: 0.6; }
.transit-line {
    stroke-width: 3px;
    stroke-dasharray: 8 4;
    animation: dash 1s linear infinite;
    opacity: 0.8;
    stroke: var(--stroke-color);
    filter: drop-shadow(0 0 3px var(--stroke-color));
}
.transit-ship {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 16px solid var(--stroke-color); /* Crée un triangle pointant vers le haut */
    transform-origin: center 75%; /* Pivote autour d'un point plus bas pour un meilleur rendu */
    filter: drop-shadow(0 0 5px var(--stroke-color));
    animation: pulse-ship 1.5s infinite ease-in-out;
    z-index: 50;
}

@keyframes dash { to { stroke-dashoffset: -1000; } }

/* --- Carte Hexagonale --- */
.hex-grid { position: absolute; top: 0; left: 0; width: 100%; height: 100%; transform-origin: center center; cursor: grab; z-index: 1; }
.hex-grid:active { cursor: grabbing; }

.hex {
    position: absolute; width: 100px; height: 100px; background: rgba(10, 10, 15, 0.9);
    display: flex; justify-content: center; align-items: center; cursor: pointer; transition: all 0.2s;
    border: 2px solid #444; box-shadow: 0 0 5px rgba(0,0,0,0.5); border-radius: 4px;
}
.hex::before { content: ''; position: absolute; inset: 1px; background: #111; z-index: 0; transition: background 0.3s; }
.hex-content { position: relative; z-index: 2; text-align: center; font-size: 2em; pointer-events: none; line-height: 1; }
.hex:hover { transform: scale(1.1); z-index: 10; background: var(--theme-accent); }
.hex.locked { opacity: 0.3; filter: grayscale(1); }
.hex.scoutable { opacity: 0.6; cursor: pointer; filter: grayscale(0.5); box-shadow: inset 0 0 5px var(--theme-accent); }
.hex.conquered::before { background: #1a331a; }
.hex.contested::before { background: #330000; animation: pulse-red 1s infinite; }
.hex.scouted::before { background: #333; }
.hex.active { background: #fff; }

/* Animations Hex */
.hex.scanning::before { background: repeating-radial-gradient(circle, var(--theme-accent), var(--theme-accent) 2px, #222 4px, #222 10px); animation: scan-pulse 0.5s infinite linear; }
@keyframes scan-pulse { 0% { opacity: 0.5; } 50% { opacity: 1; } 100% { opacity: 0.5; } }
@keyframes pulse-red { 0% { opacity: 0.8; } 50% { opacity: 1; box-shadow: inset 0 0 15px red; } 100% { opacity: 0.8; } }
@keyframes conquest-flash { 0% { box-shadow: 0 0 0 0 rgba(0, 255, 0, 0.7); background-color: rgba(0, 255, 0, 0.5); transform: scale(1); z-index: 100; } 50% { box-shadow: 0 0 50px 20px rgba(0, 255, 0, 0); background-color: rgba(0, 255, 0, 0); transform: scale(1.3); z-index: 100; } 100% { transform: scale(1); z-index: 1; } }
.hex.conquest-anim { animation: conquest-flash 1.5s ease-out; }

/* Indicateurs Hex */
.imminent-attack-icon { position: absolute; top: 5px; left: 50%; transform: translateX(-50%); font-size: 1.5em; z-index: 25; animation: bounce-alert 0.5s infinite alternate; text-shadow: 0 0 5px red; pointer-events: none; }
@keyframes bounce-alert { from { transform: translateX(-50%) scale(1); } to { transform: translateX(-50%) scale(1.3); } }
.hex.imminent-threat::before { animation: pulse-red-bg 0.5s infinite alternate !important; }
@keyframes pulse-red-bg { from { background: #300; } to { background: #800; } }

.mission-markers { position: absolute; top: 25%; right: 5px; display: flex; flex-direction: column; gap: 3px; pointer-events: none; z-index: 5; }
.mission-marker { width: 10px; height: 10px; border-radius: 50%; border: 1px solid #000; }
.mission-marker.available { background: var(--theme-danger); box-shadow: 0 0 5px var(--theme-danger); }
.mission-marker.completed { background: var(--theme-success); }
.mission-marker.in-progress { background: #ff9800; box-shadow: 0 0 8px #ff9800; animation: pulse 1s infinite; }
.mission-marker.boss { width: 14px; height: 14px; background: var(--theme-special-2); box-shadow: 0 0 8px var(--theme-special-2); animation: map-pulse 1.5s infinite; }
.mission-marker.boss.completed { background: #0f0; animation: none; box-shadow: none; }
@keyframes map-pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4); } 70% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); } }

.sector-timer { position: absolute; top: 15%; left: 50%; transform: translateX(-50%); font-size: 0.7em; color: #ff9800; font-weight: bold; text-shadow: 1px 1px 2px #000; background: rgba(0,0,0,0.7); padding: 1px 4px; border-radius: 3px; pointer-events: none; z-index: 20; }
.garrison-badge { position: absolute; bottom: 15%; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.8); border: 1px solid var(--theme-accent); color: var(--theme-accent); font-size: 0.7em; padding: 0 4px; border-radius: 4px; z-index: 5; }
.threat-badge { position: absolute; top: 5px; right: 5px; background: rgba(0,0,0,0.8); border: 1px solid #0f0; font-size: 0.7em; font-weight: bold; padding: 1px 4px; border-radius: 3px; z-index: 20; pointer-events: none; font-family: 'Orbitron', sans-serif; }

.hex-threat-container { position: absolute; bottom: 5px; left: 20%; width: 60%; height: 4px; background: rgba(0,0,0,0.8); border-radius: 2px; overflow: hidden; z-index: 20; pointer-events: none; }
.hex-threat-bar { height: 100%; background: linear-gradient(90deg, #ff8800, #ff0000); width: 0%; transition: width 0.5s ease-out; box-shadow: 0 0 4px #ff0000; }

.governor-action-badge {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 30, 40, 0.9);
    color: #ffd700;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7em;
    white-space: nowrap;
    z-index: 30;
    border: 1px solid #ffd700;
    box-shadow: 0 0 8px #ffd700;
    animation: fadeInAndOut 10s ease-in-out forwards;
}

.governor-icon-badge {
    position: absolute;
    bottom: 5px;
    left: 5px;
    width: 24px;
    height: 24px;
    background: rgba(0,0,0,0.7);
    border: 1px solid #ffd700;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1em;
    z-index: 25;
}

@keyframes fadeInAndOut {
    0% { opacity: 0; transform: translate(-50%, 10px); }
    10% { opacity: 1; transform: translate(-50%, 0); }
    90% { opacity: 1; transform: translate(-50%, 0); }
    100% { opacity: 0; transform: translate(-50%, -10px); }
}

@keyframes pulse-ship {
    0% { filter: drop-shadow(0 0 3px var(--stroke-color)); }
    50% { filter: drop-shadow(0 0 10px var(--stroke-color)); }
    100% { filter: drop-shadow(0 0 3px var(--stroke-color)); }
}

/* --- Décisions en Attente --- */
#decisions-container {
    position: fixed;
    bottom: 70px; /* Au dessus de la barre d'outils */
    left: 20px;
    z-index: 9500;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.decision-card {
    width: 300px;
    background: rgba(30, 30, 40, 0.95);
    border: 1px solid var(--theme-accent);
    border-left: 4px solid var(--theme-accent);
    border-radius: 4px;
    padding: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    animation: slideInFromLeft 0.3s ease-out;
}

.decision-title { font-weight: bold; color: var(--theme-accent); margin-bottom: 8px; font-size: 1.1em; }
.decision-desc { font-size: 0.9em; color: #ccc; margin-bottom: 15px; }
.decision-actions { display: flex; justify-content: flex-end; gap: 10px; }
.decision-actions .btn-buy.success { border-color: var(--theme-success); color: var(--theme-success); }
.decision-actions .btn-buy.danger { border-color: var(--theme-danger); color: var(--theme-danger); }

@keyframes slideInFromLeft {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 768px) {
    .hex { width: 64px; height: 64px; }
    .hex-content { font-size: 1.5em; }
    .garrison-badge { font-size: 0.6em; bottom: 2px; }
    .sector-timer { font-size: 0.6em; top: 2px; }
    .threat-badge { font-size: 0.6em; top: -5px; right: -5px; }
    .mission-markers { right: 0; gap: 1px; }
    .mission-marker { width: 6px; height: 6px; }
    .mission-marker.boss { width: 10px; height: 10px; }
}

/* --- Panneaux Croisade --- */
.crusade-details-pane {
    position: fixed; top: 0; right: 0; width: 350px; height: 100%;
    background: rgba(15, 15, 20, 0.98); border-left: 2px solid var(--theme-accent);
    z-index: 7000; transform: translateX(100%); transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    display: flex; flex-direction: column; box-shadow: -5px 0 30px rgba(0,0,0,0.9);
}
.crusade-details-pane.active { transform: translateX(0); }
.crusade-details-pane .window-content { flex: 1; overflow-y: auto; padding: 15px; }

@media (max-width: 768px) {
    .crusade-details-pane {
        width: 100%; height: 70dvh; top: auto; bottom: 50px; right: 0; left: 0;
        border-left: none; border-top: 2px solid var(--theme-accent); transform: translateY(105%);
        border-radius: 15px 15px 0 0;
    }
    .crusade-details-pane.active { transform: translateY(0); }
}

.sector-details-area {
    background: #1a1a1a; border: 1px solid var(--theme-accent); margin: 0 10px 10px 10px;
    border-radius: 4px; box-shadow: 0 0 15px rgba(0,0,0,0.5); display: flex; flex-direction: column; z-index: 10;
}

/* --- Planificateur de Mission --- */
.mission-planner {
    position: fixed; top: auto; bottom: 70px; right: 20px; left: auto; transform: none;
    background: rgba(20, 20, 25, 0.95); border: 2px solid var(--theme-accent); padding: 15px;
    z-index: 9000; width: 320px; box-shadow: -5px -5px 30px rgba(0,0,0,0.8);
    font-family: 'Orbitron', sans-serif; border-radius: 8px; animation: slideUpPlanner 0.3s ease-out;
}
@keyframes slideUpPlanner { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.mission-planner h2 { font-size: 1.1em; margin-top: 0; border-bottom: 1px solid #444; padding-bottom: 10px; margin-bottom: 15px; color: var(--theme-accent); }
.planner-row { margin-bottom: 15px; display: flex; justify-content: space-between; align-items: center; }
.planner-stats { background: #222; padding: 10px; margin-bottom: 15px; border: 1px solid #444; font-size: 0.9em; }
.planner-actions { display: flex; gap: 10px; }

@media (max-width: 768px) {
    .mission-planner { top: auto; bottom: 70px; left: 50%; right: auto; transform: translateX(-50%); width: 95%; box-sizing: border-box; }
}

/* --- Fenêtres Flottantes (Générique) --- */
.floating-window {
    position: fixed;
    background: rgba(20, 20, 25, 0.95);
    border: 2px solid var(--theme-accent);
    padding: 10px;
    z-index: 6000;
    width: 320px;
    box-shadow: -5px 5px 30px rgba(0,0,0,0.8);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
}
.floating-window .window-header { display: flex; justify-content: space-between; align-items: center; cursor: move; padding-bottom: 10px; border-bottom: 1px solid #444; margin-bottom: 10px; }
.floating-window .window-controls { display: flex; gap: 5px; }
.floating-window.minimized { height: auto !important; width: 250px !important; bottom: 55px !important; top: auto !important; left: 20px !important; right: auto !important; }
.floating-window.minimized .window-content-body { display: none; }

/* --- Gouverneurs --- */
.governor-list { display: flex; flex-direction: column; gap: 10px; }
.governor-card {
    background: #2a2a2a;
    border: 1px solid #444;
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}
.governor-card:hover { background: #3a3a3a; border-color: var(--theme-accent); }
.governor-card.selected { border-color: var(--theme-success); box-shadow: 0 0 10px var(--theme-success); }
.governor-card h4 { margin: 0 0 5px 0; color: var(--theme-accent); }
.governor-card p { margin: 0; font-size: 0.9em; color: #ccc; }


/* --- Rapport de Mission --- */
.mission-report {
    position: fixed; top: 20%; left: 50%; transform: translateX(-50%); width: 400px; max-width: 95%; max-height: 80vh;
    overflow-y: auto; background: rgba(0, 0, 0, 0.9); border: 4px solid; z-index: 4000; padding: 20px;
    text-align: center; animation: slideDown 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); box-shadow: 0 10px 50px rgba(0,0,0,1);
    display: flex; flex-direction: column; align-items: center;
}
.mission-report.success { border-color: var(--theme-success); box-shadow: 0 0 30px var(--theme-success); }
.mission-report.failure { border-color: var(--theme-danger); box-shadow: 0 0 30px var(--theme-danger); }
@keyframes slideDown { from { top: -50%; opacity: 0; } to { top: 20%; opacity: 1; } }

.stamp-animation {
    font-size: 3em; margin: 0; text-transform: uppercase; border: 5px solid; display: inline-block;
    padding: 5px 20px; transform: rotate(-10deg); opacity: 0; animation: stamp 0.3s 0.5s forwards;
}
.stamp-animation.success { color: var(--theme-success); border-color: var(--theme-success); }
.stamp-animation.failure { color: var(--theme-danger); border-color: var(--theme-danger); }
@keyframes stamp { 0% { transform: scale(3) rotate(-10deg); opacity: 0; } 100% { transform: scale(1) rotate(-10deg); opacity: 1; } }

.report-details { margin-top: 20px; font-family: 'Roboto Mono', monospace; }
.report-rewards { font-size: 1.2em; color: #fff; margin: 10px 0; }
.artifact-found { margin-top: 15px; color: var(--theme-special-2); font-weight: bold; border-top: 1px solid #444; padding-top: 10px; animation: pulse 1s infinite; width: 100%; word-wrap: break-word; }

/* --- Listes Missions --- */
.active-missions-list { display: flex; gap: 5px; flex: 1; overflow-x: auto; padding-bottom: 5px; }
.mission-card {
    position: relative; width: 50px; height: 50px; background: #222; border: 1px solid #444;
    display: flex; justify-content: center; align-items: center; font-size: 0.7em; overflow: hidden; color: #fff; flex-shrink: 0;
}
.mission-card-progress { position: absolute; bottom: 0; left: 0; width: 100%; background: rgba(0, 188, 212, 0.4); transition: height 0.1s linear; z-index: 0; }
.mission-card-content { position: relative; z-index: 1; text-align: center; font-weight: bold; }
.mission-card.supported { border-color: var(--theme-success); box-shadow: 0 0 10px var(--theme-success); }
.btn-support {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); color: var(--theme-success);
    display: flex; justify-content: center; align-items: center; opacity: 0; transition: opacity 0.2s; cursor: pointer; font-weight: bold;
}
.mission-card:hover .btn-support { opacity: 1; }

.sector-mission-list { list-style: none; padding: 0; margin: 0; }
.sector-mission-item { background: #222; padding: 8px; margin-bottom: 5px; border-left: 3px solid #444; display: flex; justify-content: space-between; align-items: center; }
.sector-mission-item.completed { border-left-color: var(--theme-success); opacity: 0.6; }
.sector-mission-item.boss { border-left-color: var(--theme-special-2); }
.sector-mission-item.locked { border-left-color: #888; opacity: 0.4; }

.garrison-control { margin-top: 15px; border-top: 1px solid #444; padding-top: 10px; }
.garrison-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; background: #1a1a1a; padding: 5px; border-radius: 4px; }
.garrison-actions { display: flex; align-items: center; gap: 5px; }
.btn-tiny { background: #333; border: 1px solid #555; color: #fff; width: 24px; height: 24px; cursor: pointer; }
.btn-tiny:hover { background: #555; border-color: var(--theme-accent); }
.garrison-count { width: 30px; text-align: center; font-weight: bold; color: var(--theme-accent); }
.fleet-avail { color: #666; font-size: 0.8em; margin-left: 10px; width: 60px; text-align: right; }