/* ── Loadout Selection Panel ─────────────────────────────────────── */
.lsp-backdrop {
    position: fixed;
    inset: 0;
    z-index: var(--z-loadout-backdrop);
    background: rgba(0, 0, 0, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
}
.lsp-panel {
    width: min(380px, 94vw);
    max-height: 82vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.lsp-body {
    overflow-y: auto;
    flex: 1;
    padding: 0 0 4px;
}
/* Diverges intentionally from .panel-section-title - tiny compact label inside loadout selector, no border, no gold. */
.lsp-section-label {
    font-size: var(--font-size-xs);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.28);
    padding: 12px 16px 6px;
}

/* Cannon selection grid - same style as smithing requires grid */
.lsp-cannon-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0 16px 12px;
}
.lsp-cannon-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 88px;
    padding: 10px 6px 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    cursor: pointer;
    transition:
        border-color 0.12s,
        background 0.12s;
    position: relative;
}
.lsp-cannon-card:hover {
    border-color: rgba(197, 160, 89, 0.5);
    background: rgba(197, 160, 89, 0.07);
}
.lsp-cannon-card-icon {
    width: 52px;
    height: 52px;
}
.lsp-cannon-card-icon .item-icon__img {
    width: 52px;
    height: 52px;
    margin-bottom: 0;
}
.lsp-cannon-card-name {
    font-size: var(--font-size-xs);
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    line-height: 1.2;
    word-break: break-word;
}
.lsp-cannon-card-stat {
    font-size: var(--font-size-xs);
    color: rgba(197, 160, 89, 0.65);
    text-align: center;
}

.lsp-cannon-card--locked {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
}

.lsp-cannon-card--locked:hover {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
}

.lsp-cannon-card-stat--locked {
    color: var(--text-danger);
}

/* Unequip section - help text + primary-style button */
.lsp-unequip-section {
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    padding-top: 4px;
    margin-top: 4px;
}
.lsp-unequip-hint {
    font-size: var(--font-size-sm);
    color: rgba(255, 255, 255, 0.35);
    text-align: center;
    margin: 10px 16px 4px;
    font-style: italic;
}
.lsp-unequip-primary-btn {
    background: rgba(200, 60, 60, 0.12) !important;
    color: rgba(230, 120, 120, 0.9) !important;
    box-shadow: none !important;
    border: 1px solid rgba(200, 60, 60, 0.25) !important;
}
.lsp-unequip-primary-btn:hover {
    background: rgba(200, 60, 60, 0.22) !important;
    box-shadow: 0 4px 16px rgba(200, 60, 60, 0.2) !important;
}

/* Legacy row styles kept for backwards compat */
.lsp-cannon-state {
    font-size: var(--font-size-xs);
    margin-left: 4px;
    padding: 1px 5px;
    border-radius: 3px;
}
.lsp-cannon-state--damaged {
    color: rgba(220, 130, 50, 0.9);
    background: rgba(220, 130, 50, 0.1);
}
.lsp-cannon-state--destroyed {
    color: rgba(210, 70, 70, 0.9);
    background: rgba(210, 70, 70, 0.1);
}
.lsp-empty {
    padding: 20px 16px;
    color: var(--text-muted);
    font-size: var(--font-size-base);
    font-style: italic;
    line-height: 1.5;
}
.sp-cannon-summary {
    font-size: var(--font-size-md);
    color: rgba(255, 255, 255, 0.38);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 3px;
}
.sp-cannon-summary span {
    white-space: nowrap;
}
.sp-cannon-summary .csm-op {
    color: rgba(197, 160, 89, 0.85);
}
.sp-cannon-summary .csm-dmg {
    color: rgba(230, 150, 80, 0.85);
}
.sp-cannon-summary .csm-dest {
    color: rgba(200, 60, 60, 0.8);
}
.sp-cannon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 15px;
}
/* Base mount slot */
.sp-cannon-slot {
    background: rgba(20, 15, 10, 0.6);
    border: 1px solid rgba(197, 160, 89, 0.18);
    border-radius: 5px;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: default;
    transition:
        border-color 0.15s,
        box-shadow 0.15s;
    padding: 5px 4px 4px;
    position: relative;
    overflow: hidden;
}
.sp-cannon-slot:hover {
    border-color: rgba(197, 160, 89, 0.45);
}
/* Empty mount */
.sp-cannon-slot--empty {
    background: rgba(255, 255, 255, 0.012);
    border-style: dashed;
    border-color: rgba(255, 255, 255, 0.1);
    cursor: pointer;
}
.sp-cannon-slot--empty:hover {
    border-color: rgba(197, 160, 89, 0.45);
    background: rgba(197, 160, 89, 0.04);
}
.sp-cannon-slot--drop-target {
    border-color: rgba(197, 160, 89, 0.7) !important;
    background: rgba(197, 160, 89, 0.08) !important;
}
.sp-cannon-slot--empty .sp-cannon-slot-icon {
    opacity: 0.18;
}
/* Intact cannon */
.sp-cannon-slot--intact {
    background: rgba(197, 160, 89, 0.07);
    border-color: rgba(197, 160, 89, 0.3);
    cursor: pointer;
}
.sp-cannon-slot--intact:hover {
    border-color: rgba(197, 160, 89, 0.6);
    box-shadow: 0 0 8px rgba(197, 160, 89, 0.15);
}
/* Damaged cannon */
.sp-cannon-slot--damaged {
    background: rgba(220, 130, 40, 0.1);
    border-color: rgba(220, 130, 40, 0.45);
    cursor: pointer;
}
.sp-cannon-slot--damaged:hover {
    border-color: rgba(220, 130, 40, 0.7);
    box-shadow: 0 0 8px rgba(220, 130, 40, 0.2);
}
/* Destroyed cannon */
.sp-cannon-slot--destroyed {
    background: rgba(150, 40, 40, 0.1);
    border-color: rgba(180, 60, 60, 0.35);
    cursor: pointer;
    opacity: 0.8;
}
.sp-cannon-slot--destroyed:hover {
    border-color: rgba(200, 60, 60, 0.55);
}
.sp-cannon-slot-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-2xl);
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
    margin-top: -20px;
}
.sp-cannon-slot-icon img {
    width: 55px;
    height: 55px;
    object-fit: contain;
    margin-top: 25px;
}
.sp-cannon-slot--damaged .sp-cannon-slot-icon {
    filter: sepia(0.6) saturate(1.5) drop-shadow(0 0 3px rgba(220, 130, 40, 0.4));
}
.sp-cannon-slot--destroyed .sp-cannon-slot-icon {
    filter: grayscale(0.9) brightness(0.5);
}
.sp-cannon-slot-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    font-size: var(--font-size-xs);
    color: rgba(200, 212, 224, 0.85);
    text-align: center;
    line-height: 1.2;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    background: rgba(0, 0, 0, 0.62);
    padding: 4px 4px 5px;
    border-radius: 0 0 4px 4px;
}
.sp-cannon-slot--empty .sp-cannon-slot-name {
    position: static;
    background: none;
    padding: 0;
    border-radius: 0;
    color: rgba(255, 255, 255, 0.22);
    margin-top: -20px;
}
.sp-cannon-slot-state {
    font-size: var(--font-size-xs);
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.sp-cannon-slot--intact .sp-cannon-slot-state {
    color: rgba(197, 160, 89, 0.7);
    display: none;
}
.sp-cannon-slot--damaged .sp-cannon-slot-state {
    color: rgba(230, 140, 50, 0.95);
}
.sp-cannon-slot--destroyed .sp-cannon-slot-state {
    color: rgba(210, 70, 70, 0.95);
}
/* State badge animation when a cannon changes state */
@keyframes cannonHitDamaged {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 130, 40, 0.8);
    }
    40% {
        box-shadow: 0 0 0 12px rgba(220, 130, 40, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(220, 130, 40, 0);
    }
}
@keyframes cannonHitDestroyed {
    0% {
        box-shadow: 0 0 0 0 rgba(200, 50, 50, 0.9);
    }
    40% {
        box-shadow: 0 0 0 14px rgba(200, 50, 50, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(200, 50, 50, 0);
    }
}
.sp-cannon-slot--anim-damaged {
    animation: cannonHitDamaged 0.6s ease-out;
}
.sp-cannon-slot--anim-destroyed {
    animation: cannonHitDestroyed 0.6s ease-out;
}
/* Cargo cannon items in hold panel */
.sp-hold-slot--cannon-cargo {
    border-color: rgba(197, 160, 89, 0.2);
    cursor: pointer;
}
.sp-hold-slot--cannon-cargo:hover {
    border-color: rgba(197, 160, 89, 0.5);
}

/* ── Ship Hold ──────────────────────────────────────────────── */
.sp-hold-section {
    margin-top: 24px;
}
.sp-hold-meta {
    font-size: var(--font-size-lg);
    color: var(--text-secondary);
    margin-bottom: 10px;
}
/* Keep capacity count + expand control on one line in section headers */
.rp-orders-header .sp-hold-meta {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    white-space: nowrap;
    margin-bottom: 0;
}
.sp-hold-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 8rem), 1fr));
    gap: 15px;
    /* Prevent the browser triggering native drag/selection on touch */
    user-select: none;
    -webkit-user-select: none;
}
.sp-hold-grid.drag-over-target {
    outline: 1px dashed rgba(197, 160, 89, 0.5);
    border-radius: 3px;
}
.sp-hold-empty {
    grid-column: 1/-1;
    text-align: center;
    padding: 22px 0;
    font-size: var(--font-size-lg);
    color: rgba(255, 255, 255, 0.25);
    font-style: italic;
}
