/* =====================================================
   CARGO TRANSFER POPUP — OceanWar
   Retro green/cyan theme (matches fleet popup)
   ===================================================== */

/* ─── Overlay ─── */
.ctp-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 12000;
    align-items: center;
    justify-content: center;
    animation: ctpFadeIn 0.3s ease;
}
.ctp-overlay.closing { animation: ctpFadeOut 0.3s ease forwards; }
@keyframes ctpFadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes ctpFadeOut { from { opacity: 1; } to { opacity: 0; } }

/* ─── Popup container ─── */
.ctp-popup {
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid #00AAFF;
    border-radius: 4px;
    color: #e0e0e0;
    width: 720px;
    max-width: 95vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 170, 255, 0.4);
    font-family: 'Courier New', monospace;
    font-size: 13px;
    animation: ctpSlideIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes ctpSlideIn {
    from { transform: translateY(30px) scale(0.97); opacity: 0; }
    to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

/* ─── Header ─── */
.ctp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(180deg, #1a1a1a 0%, #0a0a0a 100%);
    border-bottom: 1px solid #00FF88;
    border-radius: 2px 2px 0 0;
}
.ctp-title {
    font-size: 13px;
    font-weight: bold;
    color: #00FF88;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.ctp-close-btn {
    background: transparent;
    border: 1px solid #00FF88;
    color: #00FF88;
    width: 24px;
    height: 24px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.ctp-close-btn:hover { background: #00FF88; color: #000; }
.ctp-body { padding: 12px 16px; }
.ctp-loading {
    padding: 40px;
    text-align: center;
    color: #888;
    font-size: 14px;
}

/* ─── Selectors row ─── */
.ctp-selectors {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 12px;
}
.ctp-selector-col { flex: 1; }
.ctp-swap-col {
    display: flex;
    align-items: center;
    padding-bottom: 2px;
}
.ctp-label {
    display: block;
    font-size: 11px;
    color: #00CCAA;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.ctp-select {
    width: 100%;
    padding: 6px 8px;
    background: #000;
    border: 1px solid #00FF88;
    color: #e0e0e0;
    border-radius: 2px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
}
.ctp-select option {
    background: #000;
    color: #e0e0e0;
}
.ctp-swap-btn {
    background: transparent;
    border: 1px solid #00FF88;
    color: #00FF88;
    font-size: 18px;
    cursor: pointer;
    width: 36px;
    height: 32px;
    border-radius: 2px;
    transition: all 0.2s;
}
.ctp-swap-btn:hover { background: #00FF88; color: #000; }

/* ─── Capacity row ─── */
.ctp-capacity-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}
.ctp-cap-box {
    flex: 1;
    background: linear-gradient(180deg, #1a1a1a 0%, #0a0a0a 100%);
    border: 1px solid #00FF88;
    border-radius: 2px;
    padding: 6px 10px;
    font-size: 11px;
}
.ctp-cap-label { color: #00CCAA; }
.ctp-cap-value { color: #e0e0e0; margin-left: 4px; }
.ctp-cap-bar {
    height: 4px;
    background: rgba(0, 255, 136, 0.15);
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}
.ctp-cap-bar-fill {
    height: 100%;
    background: #00FF88;
    border-radius: 2px;
    transition: width 0.3s;
}

/* ─── Transfer grid ─── */
.ctp-transfer-grid {
    border: 1px solid #00FF88;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 12px;
    background: rgba(0, 0, 0, 0.3);
}
.ctp-grid-header {
    display: grid;
    grid-template-columns: 100px 1fr 160px 1fr;
    background: linear-gradient(180deg, #1a1a1a 0%, #0a0a0a 100%);
    padding: 6px 10px;
    font-size: 10px;
    color: #00CCAA;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #00FF88;
}
.ctp-res-row {
    display: grid;
    grid-template-columns: 100px 1fr 160px 1fr;
    align-items: center;
    padding: 5px 10px;
    border-bottom: 1px solid rgba(0, 255, 136, 0.15);
}
.ctp-res-row:last-child { border-bottom: none; }
.ctp-res-row:hover { background: rgba(0, 255, 136, 0.08); }
.ctp-res-name {
    font-size: 12px;
    color: #00CCAA;
    white-space: nowrap;
}

/* ─── Source / Dest columns ─── */
.ctp-res-src, .ctp-res-dst {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 4px;
}
.ctp-res-val {
    font-size: 12px;
    font-weight: bold;
    color: #e0e0e0;
    text-align: center;
}
.ctp-mini-bar {
    height: 4px;
    background: rgba(0, 255, 136, 0.15);
    border-radius: 2px;
    overflow: hidden;
}
.ctp-mini-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s;
}
.ctp-mini-bar-fill.src-fill { background: #00AAFF; }
.ctp-mini-bar-fill.dst-fill { background: #00FF88; }

/* ─── Transfer column ─── */
.ctp-res-transfer {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
}
.ctp-max-btn {
    background: transparent;
    border: 1px solid #00FF88;
    color: #00FF88;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 2px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}
.ctp-max-btn:hover { background: #00FF88; color: #000; }
.ctp-transfer-input {
    width: 60px;
    padding: 3px 6px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #00FF88;
    color: #e0e0e0;
    border-radius: 2px;
    font-size: 12px;
    text-align: center;
    font-family: 'Courier New', monospace;
}
.ctp-transfer-input:focus { border-color: #00FFAA; outline: none; box-shadow: 0 0 6px rgba(0, 255, 136, 0.3); }
.ctp-transfer-input::-webkit-inner-spin-button,
.ctp-transfer-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.ctp-transfer-input { -moz-appearance: textfield; appearance: textfield; }
.ctp-transfer-input.ctp-input-error { border-color: #ff4444; background: rgba(255, 68, 68, 0.1); }
.ctp-arrow { color: #00FF88; font-size: 14px; }

/* ─── Actions ─── */
.ctp-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.ctp-btn {
    padding: 8px 20px;
    border-radius: 2px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    transition: all 0.2s;
    font-family: 'Courier New', monospace;
}
.ctp-btn-transfer {
    background: transparent;
    border: 2px solid #00FF88;
    color: #00FF88;
}
.ctp-btn-transfer:hover {
    background: #00FF88;
    color: #000;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.5);
}
.ctp-btn-transfer:disabled {
    background: transparent;
    color: #444;
    border-color: #444;
    cursor: not-allowed;
    box-shadow: none;
}
.ctp-btn-cancel {
    background: transparent;
    border: 2px solid #888;
    color: #888;
}
.ctp-btn-cancel:hover {
    background: #888;
    color: #000;
    box-shadow: 0 0 10px rgba(136, 136, 136, 0.3);
}

/* ─── Status ─── */
.ctp-status {
    margin-top: 8px;
    font-size: 12px;
    text-align: center;
    min-height: 18px;
    color: #888;
}
.ctp-status-error { color: #ff4444; }
.ctp-status-ok { color: #00FF88; }

/* ─── Responsive ─── */
@media (max-width: 700px) {
    .ctp-popup { max-width: 98vw; }
    .ctp-selectors { flex-direction: column; }
    .ctp-swap-col { justify-content: center; }
}
