/* ============================================================
   Attack Prep — Combat v2
   ============================================================ */

.ap-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
}
.ap-modal {
    background: var(--surface, #1a2236);
    border: 1px solid var(--border, #2a3656);
    border-radius: 4px;
    width: 100%;
    max-width: 1100px;
    margin: auto;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.ap-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1rem 1.4rem;
    border-bottom: 1px solid var(--border, #2a3656);
}
.ap-head h2 { margin: 0; color: var(--text, #f4f1e8); font-size: 1.1rem; }
.ap-sub {
    margin: 0.3rem 0 0;
    color: var(--text-dim, #9aa0a6);
    font-size: 0.85rem;
}
.ap-close {
    background: none;
    border: 1px solid var(--border, #2a3656);
    color: var(--text-dim, #9aa0a6);
    font-size: 1.4rem;
    line-height: 1;
    width: 32px;
    height: 32px;
    cursor: pointer;
    border-radius: 4px;
}
.ap-close:hover { color: var(--text, #f4f1e8); border-color: var(--rust, #9b3d2e); }

.ap-body {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 1rem;
    padding: 1.2rem 1.4rem;
}
@media (max-width: 800px) {
    .ap-body { grid-template-columns: 1fr; }
}
.ap-col h3 {
    margin: 0 0 0.3rem;
    color: var(--text, #f4f1e8);
    font-size: 0.9rem;
    letter-spacing: 1px;
}
.ap-col h3::before { content: '◆ '; color: var(--rust, #9b3d2e); }
.ap-col-sub {
    color: var(--text-dim, #9aa0a6);
    font-size: 0.78rem;
    margin: 0 0 0.8rem;
}

/* Défenseurs adverses */
.ap-enemy {
    border: 1px solid var(--border, #2a3656);
    background: var(--surface-dark, #0e1525);
    padding: 0.7rem;
    border-radius: 4px;
    margin-bottom: 0.6rem;
}
.ap-enemy-head {
    display: flex;
    align-items: baseline;
    gap: 0.7rem;
    margin-bottom: 0.4rem;
}
.ap-pos {
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.6rem;
    letter-spacing: 1.5px;
    color: var(--blue-glow, #8ec5ff);
    border: 1px solid var(--blue-glow, #8ec5ff);
    padding: 0.1rem 0.4rem;
    border-radius: 2px;
}
.ap-enemy-name { font-weight: 700; color: var(--text-light, #e6e8ee); }
.ap-enemy-equip {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.2rem 0.6rem;
    font-size: 0.75rem;
}
.ap-enemy-equip .lbl {
    color: var(--text-light-dim, #98a0b0);
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.65rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.ap-enemy-equip .val { color: var(--text-light-dim, #98a0b0); }

/* Ma ligne d'attaque */
.ap-line {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.6rem;
}
.ap-slot {
    border: 1px dashed var(--border, #2a3656);
    background: var(--surface-dark, #0e1525);
    border-radius: 4px;
    padding: 0.6rem;
    min-height: 140px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    transition: border-color 0.12s, background 0.12s;
}
.ap-slot.filled { border-style: solid; border-color: var(--rust, #9b3d2e); }
.ap-slot.drop-target {
    border-color: var(--blue-glow, #8ec5ff);
    background: rgba(142, 197, 255, 0.08);
}
.ap-slot-label {
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.6rem;
    letter-spacing: 1.5px;
    color: var(--text-light-dim, #98a0b0);
}
.ap-slot-content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.ap-slot-empty { color: var(--text-light-dim, #98a0b0); font-size: 0.78rem; margin: auto; }
.ap-slot-mecha { cursor: grab; display: flex; flex-direction: column; gap: 0.15rem; }
.ap-slot-mecha:active { cursor: grabbing; }
.ap-slot-name { font-weight: 700; color: var(--text-light, #e6e8ee); }
.ap-slot-chassis { font-size: 0.75rem; color: var(--text-light-dim, #98a0b0); }
.ap-slot-stats {
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.7rem;
    color: var(--text-light-dim, #98a0b0);
}
.ap-slot-actions {
    display: flex;
    gap: 0.3rem;
    margin-top: 0.2rem;
}
.ap-slot-actions button {
    flex: 1;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border, #2a3656);
    color: var(--text-light-dim, #98a0b0);
    padding: 0.3rem 0.4rem;
    font-size: 0.72rem;
    cursor: pointer;
    border-radius: 3px;
}
.ap-slot-actions button:hover { color: var(--text-light, #e6e8ee); border-color: var(--rust, #9b3d2e); }

/* Roster (pour drag) */
.ap-roster {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
    max-height: 280px;
    overflow-y: auto;
    padding: 0.4rem;
    border: 1px solid var(--border, #2a3656);
    border-radius: 4px;
    background: var(--surface-dark, #0e1525);
}
.ap-roster-card {
    border: 1px solid var(--border, #2a3656);
    background: var(--surface, #1a2236);
    border-radius: 3px;
    padding: 0.5rem;
    cursor: grab;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.ap-roster-card:active { cursor: grabbing; }
.ap-roster-card.placed { opacity: 0.35; pointer-events: none; }
.ap-roster-name { font-weight: 700; color: var(--text, #f4f1e8); font-size: 0.8rem; }
.ap-roster-chassis { color: var(--text-dim, #9aa0a6); font-size: 0.72rem; }
.ap-roster-stats {
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.68rem;
    color: var(--text-dim, #9aa0a6);
}

/* Footer */
.ap-footer {
    padding: 1rem 1.4rem;
    border-top: 1px solid var(--border, #2a3656);
    display: flex;
    justify-content: flex-end;
}

/* Sub-modal (target editor) */
.ap-sub-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1010;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.ap-sub-modal {
    background: var(--surface, #1a2236);
    border: 1px solid var(--border, #2a3656);
    border-radius: 4px;
    padding: 1.2rem 1.4rem;
    width: 100%;
    max-width: 520px;
}
.ap-sub-modal h3 { margin: 0 0 0.3rem; color: var(--text, #f4f1e8); }
.ap-sub-modal p { color: var(--text-dim, #9aa0a6); font-size: 0.85rem; margin: 0 0 1rem; }
.ap-target-grid { display: flex; flex-direction: column; gap: 0.6rem; }
.ap-target-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.ap-target-row-label {
    flex: 0 0 130px;
    font-weight: 700;
    color: var(--text, #f4f1e8);
    font-size: 0.85rem;
}
.ap-target-row-label span { color: var(--text-dim, #9aa0a6); font-weight: 400; }
.ap-target-btn {
    background: var(--surface-alt, #232c45);
    border: 1px solid var(--border, #2a3656);
    color: var(--text-dim, #9aa0a6);
    padding: 0.4rem 0.7rem;
    cursor: pointer;
    border-radius: 3px;
    font-size: 0.78rem;
}
.ap-target-btn:hover { color: var(--text, #f4f1e8); border-color: var(--rust, #9b3d2e); }
.ap-target-btn.active {
    color: var(--text, #f4f1e8);
    border-color: var(--rust, #9b3d2e);
    background: var(--rust-bg, #2a1a18);
}
.ap-sub-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1.2rem; }
.ap-sub-actions button {
    background: var(--surface-alt, #232c45);
    border: 1px solid var(--border, #2a3656);
    color: var(--text-dim, #9aa0a6);
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-radius: 3px;
}
.ap-sub-actions button.primary {
    color: var(--text, #f4f1e8);
    border-color: var(--rust, #9b3d2e);
    background: var(--rust-bg, #2a1a18);
}

/* ============================================================
   Sélecteur de pilote par mecha de l'escouade (V0.4a tranche 3)
   ============================================================ */
.ap-pilot-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.4rem;
    font-size: 0.75rem;
    min-width: 0;
}
.ap-pilot-label {
    color: var(--text-dim, #9aa0a6);
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.6rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    flex: 0 0 auto;
}
.ap-pilot-select {
    flex: 1 1 0;
    min-width: 0;
    max-width: 100%;
    background: var(--surface-alt, #232c45);
    border: 1px solid var(--border, #2a3656);
    color: var(--text, #f4f1e8);
    padding: 0.3rem 0.4rem;
    border-radius: 3px;
    font-family: inherit;
    font-size: 0.72rem;
    cursor: pointer;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}
.ap-pilot-select:hover { border-color: var(--rust, #9b3d2e); }