/* --- Boutons --- */
.btn-buy { 
    width: 100%; 
    background: linear-gradient(to bottom, #3a3a3a, #2a2a2a); 
    color: var(--theme-accent); 
    border: 1px solid var(--theme-accent); 
    padding: 8px; cursor: pointer; margin-bottom: 5px; font-weight: bold; text-transform: uppercase; transition: all 0.2s; 
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), 0 2px 3px rgba(0,0,0,0.5);
    text-shadow: 0 1px 1px #000;
}
.btn-buy:hover { background: linear-gradient(to bottom, #4a4a4a, #3a3a3a); box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 2px 3px rgba(0,0,0,0.5), 0 0 8px var(--theme-glow); }
.btn-buy:active { transform: translateY(1px); box-shadow: inset 0 1px 2px rgba(0,0,0,0.8); }
.btn-buy.compact { width: auto; padding: 2px 8px; font-size: 0.8em; margin-bottom: 0; }

.toolbar-btn {
    flex: none; width: 100%; height: auto; min-height: 45px;
    background: transparent; border: none; border-bottom: 1px solid #333;
    color: #888; font-family: 'Orbitron', sans-serif; font-size: 0.85em; font-weight: bold; text-transform: uppercase;
    cursor: pointer; transition: all 0.2s; position: relative; white-space: nowrap; padding: 0 15px;
    text-align: left; display: flex; align-items: center;
}
.toolbar-btn:last-child { border-bottom: none; }
.toolbar-btn:hover { background: var(--theme-accent); color: #000; }
.toolbar-btn:active { transform: translateY(1px); }

/* Mobile Toolbar Button Style */
@media (max-width: 768px) {
    .toolbar-btn {
        flex: none; width: 100%; height: 45px;
        background: transparent; border: none; border-bottom: 1px solid #333;
        border-radius: 0; box-shadow: none;
        color: #888; font-size: 0.8em; white-space: nowrap; padding: 0 15px;
        text-align: left;
    }
    .toolbar-btn.active, .toolbar-btn:active { background: rgba(255,255,255,0.1); color: var(--theme-accent); border-color: var(--theme-accent); }
    .btn-buy { min-height: 40px; touch-action: manipulation; }
}

/* --- Modales --- */
.ui-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6); z-index: 5500;
    display: flex; justify-content: center; align-items: center;
}
.modal-content {
    background: #151515; border: 2px solid var(--theme-accent); padding: 15px;
    width: 90%; max-width: 800px; max-height: 80vh; overflow-y: auto; position: relative;
    box-shadow: 0 0 50px rgba(0,0,0,0.9); animation: modal-fade-in 0.3s ease-out;
}
.close-modal-btn {
    position: sticky; top: 5px; float: right; margin-right: 5px; margin-bottom: -30px;
    background: var(--theme-danger); border: 1px solid #fff; color: #fff;
    width: 25px; height: 25px; border-radius: 50%; cursor: pointer; font-weight: bold; z-index: 10;
}

/* --- Tooltips & Toasts --- */
.tooltip {
    position: absolute; background: rgba(10, 10, 15, 0.95); border: 1px solid var(--theme-accent);
    color: #fff; padding: 10px; pointer-events: none; z-index: 10000; font-size: 0.85em;
    max-width: 250px; box-shadow: 0 0 10px rgba(0,0,0,0.8);
}
.tooltip strong { color: var(--theme-accent); border-bottom: 1px solid #444; display: block; margin-bottom: 5px; padding-bottom: 5px; }

.toast-container {
    position: fixed; top: 80px; left: 50%; transform: translateX(-50%); z-index: 7000;
    display: flex; flex-direction: column; gap: 10px; pointer-events: none; width: 300px;
}
.toast {
    background: rgba(20, 20, 25, 0.95); border: 1px solid var(--theme-tech); color: #fff;
    padding: 15px; border-radius: 4px; box-shadow: 0 5px 15px rgba(0,0,0,0.8);
    display: flex; align-items: center; gap: 15px; animation: slideDownToast 0.3s ease-out; pointer-events: auto;
}

/* --- Badges --- */
.toolbar-btn.has-notification::after {
    content: ''; position: absolute; top: 8px; right: 15px; width: 8px; height: 8px;
    background-color: var(--theme-danger); border-radius: 50%; box-shadow: 0 0 5px #f00;
    animation: notif-pulse 1s infinite; pointer-events: none;
}
.toolbar-btn.has-badge::after {
    content: attr(data-badge); position: absolute; top: 5px; right: 5px;
    background-color: var(--theme-danger); color: #fff; font-size: 0.7em; padding: 2px 5px;
    border-radius: 10px; box-shadow: 0 0 5px var(--theme-danger);
    animation: notif-pulse 1s infinite; pointer-events: none; min-width: 12px; text-align: center;
}
@keyframes notif-pulse { 0% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.3); opacity: 0.8; } 100% { transform: scale(1); opacity: 1; } }

/* --- Menus Repliables --- */
details { margin-bottom: 10px; border: 1px solid #333; background: #1a1a1a; }
summary { padding: 10px; cursor: pointer; background: #222; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary h2 { display: inline-block; margin: 0; font-size: 1.2em; }
summary:hover { background: #2a2a2a; }
summary::after { content: '+'; float: right; font-weight: bold; color: var(--theme-accent); }
details[open] summary::after { content: '-'; }
details[open] .upgrades-container { padding: 15px; }

/* --- Fenêtres Flottantes --- */
.floating-window {
    position: absolute; top: 100px; left: 20px; min-width: 320px; max-width: 400px;
    background: rgba(15, 15, 20, 0.95); border: 1px solid var(--theme-accent);
    box-shadow: 0 10px 30px rgba(0,0,0,0.8), 0 0 10px var(--theme-accent);
    z-index: 2000; display: flex; flex-direction: column; border-radius: 4px; overflow: hidden;
    font-family: 'Roboto Mono', monospace; backdrop-filter: blur(5px);
    animation: fadeInWindow 0.2s ease-out;
}
@keyframes fadeInWindow { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.window-header {
    background: linear-gradient(90deg, #222, #111); padding: 10px; cursor: move;
    border-bottom: 1px solid var(--theme-accent); display: flex; justify-content: space-between; align-items: center;
    font-family: 'Orbitron', sans-serif; color: var(--theme-accent); text-transform: uppercase; font-size: 0.9em;
}
.window-tabs { display: flex; background: #1a1a1a; border-bottom: 1px solid #444; }
.window-tab { flex: 1; padding: 8px; text-align: center; cursor: pointer; color: #888; font-size: 0.9em; border-right: 1px solid #333; transition: all 0.2s; }
.window-tab:hover { background: #2a2a2a; color: #fff; }
.window-tab.active { background: #333; color: var(--theme-accent); font-weight: bold; border-bottom: 2px solid var(--theme-accent); }
.window-content { padding: 15px; max-height: 400px; overflow-y: auto; font-size: 0.9em; color: #ddd; }

@media (max-width: 768px) {
    .floating-window {
        left: 50% !important; top: 50% !important; transform: translate(-50%, -50%) !important;
        width: 95% !important; max-width: 95% !important; max-height: 80dvh !important;
        border-radius: 8px; box-shadow: 0 0 50px rgba(0,0,0,0.9);
    }
    .modal-content { width: 95%; padding: 10px; max-height: 85dvh; }
}

/* --- Grille d'Améliorations --- */
.upgrades-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.upgrade-item {
    background: #222; border: 1px solid #333; border-left: 3px solid #555; padding: 10px;
    display: flex; flex-direction: column; justify-content: space-between; cursor: pointer; transition: all 0.2s ease; min-height: 90px;
}
.upgrade-item:hover { background: #2a2a2a; border-color: var(--theme-accent); border-left-color: var(--theme-accent); transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0,0,0,0.5); }
.upgrade-item.disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(0.8); }
.item-info h3 { margin: 0 0 5px 0; font-size: 0.95em; color: #fff; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 3px; }
.item-cost { font-weight: bold; color: var(--theme-accent); text-align: right; font-size: 0.85em; margin-top: 8px; padding-top: 5px; border-top: 1px dashed #444; }

.hidden { display: none !important; }

/* --- Crusade Fleet Visuals --- */
.fleet-visual-grid .ship-icon {
    transition: transform 0.2s;
}
.fleet-visual-grid .ship-icon:hover {
    transform: scale(1.2);
    z-index: 10;
}

/* --- Stats Table --- */
.stats-table { width: 100%; border-collapse: collapse; font-size: 0.9em; }
.stats-table th { text-align: left; border-bottom: 1px solid var(--theme-accent); padding: 5px; color: #888; }
.stats-table td { padding: 8px 5px; border-bottom: 1px solid #333; vertical-align: top; }
.stats-table tr:last-child td { border-bottom: none; }
.stat-bonus { font-size: 0.85em; margin-bottom: 2px; }
.stat-bonus.flat { color: #aaddff; }
.stat-bonus.mult { color: #ffffaa; }