/* =====================================================
   HARBOR MASTER POPUP — OceanWar
   Retro green/cyan theme (matches fleet popup)
   ===================================================== */

/* ─── Overlay ─── */
.harbor-resupply-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 11000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: harborFadeIn 0.3s ease;
}
.harbor-resupply-overlay.closing {
    animation: harborFadeOut 0.3s ease forwards;
}
@keyframes harborFadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes harborFadeOut { from { opacity: 1; } to { opacity: 0; } }

/* ─── Container ─── */
.harbor-resupply-container {
    width: 920px;
    max-width: 95vw;
    max-height: 85vh;
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid #00AAFF;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 170, 255, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #e0e0e0;
    font-family: 'Courier New', monospace;
    animation: harborSlideIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes harborSlideIn {
    from { transform: translateY(30px) scale(0.97); opacity: 0; }
    to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

/* ─── Header ─── */
.harbor-resupply-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(180deg, #1a1a1a 0%, #0a0a0a 100%);
    border-bottom: 1px solid #00FF88;
    flex-shrink: 0;
}
.harbor-resupply-header-icon {
    font-size: 28px;
    filter: drop-shadow(0 0 6px rgba(0, 255, 136, 0.5));
}
.harbor-resupply-header-text {
    flex: 1;
    min-width: 0;
}
.harbor-resupply-header-text h2 {
    margin: 0;
    font-size: 13px;
    font-weight: bold;
    color: #00FF88;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.harbor-resupply-subtitle {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}
.harbor-resupply-resources {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
    max-width: 380px;
    justify-content: flex-end;
}
.harbor-res-item {
    font-size: 10px;
    color: #00CCAA;
    background: rgba(0, 255, 136, 0.06);
    padding: 2px 6px;
    border-radius: 2px;
    white-space: nowrap;
    border: 1px solid rgba(0, 255, 136, 0.15);
}
.harbor-resupply-close {
    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;
}
.harbor-resupply-close:hover { background: #00FF88; color: #000; }

/* ─── Body (scrollable) ─── */
.harbor-resupply-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
}

/* ─── Fleet section ─── */
.harbor-fleet-section {
    margin-bottom: 20px;
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 2px;
    background: rgba(0, 0, 0, 0.3);
    overflow: hidden;
}
.harbor-fleet-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: linear-gradient(180deg, #1a1a1a 0%, #0a0a0a 100%);
    border-bottom: 1px solid rgba(0, 255, 136, 0.3);
}
.harbor-fleet-icon { font-size: 22px; }
.harbor-fleet-info { flex: 1; }
.harbor-fleet-name {
    font-size: 14px;
    font-weight: bold;
    color: #00FF88;
}
.harbor-fleet-island {
    display: block;
    font-size: 11px;
    color: #888;
}
.harbor-fleet-count {
    font-size: 11px;
    color: #666;
}

/* ─── Select-all checkbox in fleet header ─── */
.harbor-select-all {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    flex-shrink: 0;
}
.harbor-select-all-cb {
    width: 16px;
    height: 16px;
    accent-color: #00FF88;
    cursor: pointer;
}
.harbor-select-all-label {
    font-size: 10px;
    color: #00CCAA;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ─── Unit table ─── */
.harbor-unit-table {
    padding: 4px 0;
}
.harbor-table-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #00CCAA;
    border-bottom: 1px solid rgba(0, 255, 136, 0.15);
}
.harbor-unit-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-bottom: 1px solid rgba(0, 255, 136, 0.08);
    transition: background 0.15s;
}
.harbor-unit-row:hover {
    background: rgba(0, 255, 136, 0.06);
}
.harbor-unit-row.harbor-row-queued {
    background: rgba(0, 255, 136, 0.08);
    border-left: 2px solid #00FF88;
}

/* Column widths */
.harbor-col-check   { width: 28px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.harbor-col-name    { flex: 2.5; display: flex; align-items: center; gap: 6px; min-width: 0; }
.harbor-col-hp      { flex: 1.3; display: flex; align-items: center; gap: 4px; }
.harbor-col-fuel    { flex: 1.3; display: flex; align-items: center; gap: 4px; }
.harbor-col-sup     { flex: 1.3; display: flex; align-items: center; gap: 4px; }
.harbor-col-status  { flex: 1.8; display: flex; gap: 3px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }

/* Checkbox */
.harbor-unit-cb {
    width: 15px;
    height: 15px;
    accent-color: #00FF88;
    cursor: pointer;
}

.harbor-unit-icon { font-size: 16px; flex-shrink: 0; }
.harbor-unit-label {
    font-size: 12px;
    font-weight: 500;
    color: #e0e0e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.harbor-unit-type {
    font-size: 9px;
    color: #666;
    margin-left: auto;
    flex-shrink: 0;
}

/* ─── Status tags ─── */
.harbor-status-tag {
    font-size: 8px;
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 600;
    white-space: nowrap;
}
.harbor-status-tag.fuel {
    color: #f39c12;
    background: rgba(243, 156, 18, 0.15);
    border: 1px solid rgba(243, 156, 18, 0.3);
}
.harbor-status-tag.sup {
    color: #00AAFF;
    background: rgba(0, 170, 255, 0.15);
    border: 1px solid rgba(0, 170, 255, 0.3);
}
.harbor-status-tag.repair {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.15);
    border: 1px solid rgba(231, 76, 60, 0.3);
}
.harbor-status-tag.ok {
    color: #4caf50;
    background: rgba(76, 175, 80, 0.12);
    border: 1px solid rgba(76, 175, 80, 0.25);
}
.harbor-status-tag.destroyed {
    color: #ff4444;
    background: rgba(255, 68, 68, 0.2);
    border: 1px solid rgba(255, 68, 68, 0.5);
    font-weight: 700;
    animation: harbor-destroyed-pulse 2s ease-in-out infinite;
}
@keyframes harbor-destroyed-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ─── Destroyed unit rows ─── */
.harbor-destroyed-row {
    opacity: 0.6;
    background: rgba(255, 40, 40, 0.04);
}
.harbor-destroyed-label {
    text-decoration: line-through;
    color: #888;
}
.harbor-destroyed-text {
    color: #555;
}
.harbor-destroyed-section .harbor-section-label {
    color: #ff6666;
}
.harbor-btn-remove {
    font-size: 8px !important;
    padding: 1px 6px !important;
    color: #ff6666 !important;
    border-color: rgba(255, 68, 68, 0.4) !important;
    background: rgba(255, 40, 40, 0.1) !important;
    cursor: pointer;
    margin-left: 4px;
}
.harbor-btn-remove:hover {
    background: rgba(255, 40, 40, 0.25) !important;
    border-color: rgba(255, 68, 68, 0.7) !important;
}
.hp-destroyed {
    background: #ff4444;
}

/* ─── Auto Resupply Toggle Bar ─── */
.harbor-auto-resupply-bar {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 16px;
    background: rgba(0, 255, 136, 0.04);
    border-bottom: 1px solid rgba(0, 255, 136, 0.15);
}
.harbor-auto-master-row {
    border-bottom: 1px solid rgba(0, 255, 136, 0.08);
    padding-bottom: 5px;
    margin-bottom: 2px;
}
.harbor-auto-toggle-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 280px;
}
.harbor-auto-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #00CCAA;
    font-weight: 600;
}
.harbor-auto-fleet-name {
    font-size: 11px;
    color: #888;
}
/* Toggle switch */
.harbor-toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 18px;
    flex-shrink: 0;
}
.harbor-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.harbor-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(60, 60, 80, 0.6);
    border: 1px solid rgba(100, 100, 130, 0.4);
    border-radius: 18px;
    transition: background 0.3s, border-color 0.3s;
}
.harbor-toggle-slider::before {
    content: '';
    position: absolute;
    height: 12px;
    width: 12px;
    left: 2px;
    bottom: 2px;
    background: #8a8a9a;
    border-radius: 50%;
    transition: transform 0.3s, background 0.3s;
}
.harbor-toggle-switch input:checked + .harbor-toggle-slider {
    background: rgba(46, 204, 113, 0.25);
    border-color: rgba(46, 204, 113, 0.6);
}
.harbor-toggle-switch input:checked + .harbor-toggle-slider::before {
    transform: translateX(18px);
    background: #2ecc71;
    box-shadow: 0 0 6px rgba(46, 204, 113, 0.5);
}

/* ─── Transfer dropdown ─── */
.harbor-transfer-select {
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 2px;
    border: 1px solid rgba(0, 255, 136, 0.3);
    background: rgba(0, 0, 0, 0.6);
    color: #00CCAA;
    cursor: pointer;
    max-width: 110px;
    flex-shrink: 0;
    outline: none;
    font-family: 'Courier New', monospace;
}
.harbor-transfer-select:hover,
.harbor-transfer-select:focus {
    border-color: #00FF88;
    color: #e0e0e0;
}

/* ─── Support Fuel Hold line ─── */
.harbor-support-fuel-line {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 3px;
}
.harbor-sf-label {
    font-size: 9px;
    color: #f39c12;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ─── Bars ─── */
.harbor-bar {
    width: 55px;
    height: 6px;
    background: rgba(0, 255, 136, 0.1);
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
}
.harbor-bar-sm { width: 40px; height: 5px; }
.harbor-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.4s ease;
}
.harbor-bar-fill.hp-high { background: #4caf50; }
.harbor-bar-fill.hp-mid  { background: #ff9800; }
.harbor-bar-fill.hp-low  { background: #ff5252; }
.harbor-bar-fill.fuel-bar { background: #f39c12; }
.harbor-bar-fill.sup-bar  { background: #00AAFF; }

.harbor-bar-text {
    font-size: 9px;
    color: #888;
    white-space: nowrap;
}

/* ─── Action buttons (transfer, cargo) ─── */
.harbor-action-btn {
    width: 28px; height: 28px;
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 2px;
    background: transparent;
    color: #00CCAA;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    padding: 0;
}
.harbor-action-btn:hover:not(.disabled) {
    background: rgba(0, 255, 136, 0.15);
    color: #00FF88;
}
.harbor-action-btn.active {
    background: rgba(0, 255, 136, 0.2);
    border-color: #00FF88;
    color: #00FF88;
    box-shadow: 0 0 6px rgba(0, 255, 136, 0.3);
}
.harbor-action-btn.disabled {
    opacity: 0.25;
    cursor: default;
    pointer-events: none;
}

/* ─── Aircraft rows ─── */
.harbor-section-label {
    font-size: 11px;
    font-weight: 600;
    color: #ffd700;
    padding: 8px 12px 4px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.1);
}
.harbor-aircraft-row,
.harbor-transfer-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    font-size: 11px;
    border-bottom: 1px solid rgba(0, 255, 136, 0.08);
}
.harbor-ac-icon { font-size: 14px; flex-shrink: 0; }
.harbor-ac-name { color: #e0e0e0; font-weight: 500; flex: 1; }
.harbor-ac-type { color: #666; font-size: 10px; flex-shrink: 0; width: 90px; }
.harbor-ac-hp   { flex-shrink: 0; }
.harbor-ac-fuel { color: #888; font-size: 10px; flex-shrink: 0; width: 60px; text-align: right; }

/* Transfer controls */
.harbor-transfer-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}
.harbor-carrier-select {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 2px;
    color: #ccc;
    font-size: 10px;
    padding: 3px 6px;
    max-width: 140px;
    font-family: 'Courier New', monospace;
}
.harbor-carrier-select option {
    background: #0a0a0a;
    color: #e0e0e0;
}
.transfer-btn {
    width: auto !important;
    padding: 3px 10px !important;
    font-size: 11px !important;
    white-space: nowrap;
}

/* ─── Island aircraft section ─── */
.harbor-island-aircraft-section {
    border-top: 1px solid rgba(255, 215, 0, 0.15);
}

/* ─── Cargo Management Section ─── */
.harbor-cargo-section {
    border-top: 1px solid rgba(0, 255, 136, 0.15);
}
.harbor-cargo-row {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(0, 255, 136, 0.08);
}
.harbor-cargo-ship-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.harbor-cargo-summary {
    font-size: 10px;
    color: #888;
    margin-left: auto;
}
.harbor-cargo-bar {
    width: 80px;
}
.harbor-cargo-detail {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 6px;
}
.harbor-cargo-res-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
}
.harbor-cargo-res-icon {
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}
.harbor-cargo-res-label {
    width: 70px;
    color: #00CCAA;
    flex-shrink: 0;
    font-size: 10px;
}
.harbor-cargo-res-current {
    width: 110px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    color: #e0e0e0;
    font-weight: 500;
    flex-shrink: 0;
    font-size: 11px;
    position: relative;
}
.harbor-cargo-res-current .harbor-bar {
    height: 14px;
    width: 100%;
}
.harbor-cargo-res-current .harbor-bar-text {
    font-size: 9px;
    text-align: center;
}
.harbor-cargo-input {
    width: 55px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 2px;
    color: #e0e0e0;
    font-size: 10px;
    padding: 2px 4px;
    text-align: center;
    font-family: 'Courier New', monospace;
}
.harbor-cargo-input:focus {
    outline: none;
    border-color: #00FF88;
    box-shadow: 0 0 6px rgba(0, 255, 136, 0.3);
}
.harbor-cargo-load-btn,
.harbor-cargo-unload-btn {
    width: 26px !important;
    height: 24px !important;
    font-size: 12px !important;
}
.harbor-cargo-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}
.harbor-btn-sm {
    padding: 4px 12px !important;
    font-size: 10px !important;
}
.btn-colony-kit {
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.2), rgba(155, 89, 182, 0.35)) !important;
    color: #bb8fce !important;
    border-color: rgba(155, 89, 182, 0.4) !important;
}
.btn-colony-kit:hover {
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.3), rgba(155, 89, 182, 0.5)) !important;
}
.btn-unload-all {
    background: linear-gradient(135deg, rgba(230, 126, 34, 0.2), rgba(230, 126, 34, 0.35)) !important;
    color: #e67e22 !important;
    border-color: rgba(230, 126, 34, 0.4) !important;
}
.btn-unload-all:hover {
    background: linear-gradient(135deg, rgba(230, 126, 34, 0.3), rgba(230, 126, 34, 0.5)) !important;
}

/* ─── Footer ─── */
.harbor-resupply-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid #00FF88;
    flex-shrink: 0;
}
.harbor-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;
}
.harbor-btn.btn-skip {
    background: transparent;
    color: #888;
    border: 2px solid #888;
    margin-right: auto;
}
.harbor-btn.btn-skip:hover {
    background: #888;
    color: #000;
    box-shadow: 0 0 10px rgba(136, 136, 136, 0.3);
}
.harbor-btn.btn-resupply-all {
    background: transparent;
    color: #f39c12;
    border: 2px solid #f39c12;
}
.harbor-btn.btn-resupply-all:hover {
    background: #f39c12;
    color: #000;
    box-shadow: 0 0 15px rgba(243, 156, 18, 0.5);
}
.harbor-btn.btn-repair-all {
    background: transparent;
    color: #4caf50;
    border: 2px solid #4caf50;
}
.harbor-btn.btn-repair-all:hover {
    background: #4caf50;
    color: #000;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.5);
}
.harbor-btn.btn-apply {
    background: transparent;
    color: #00FF88;
    border: 2px solid #00FF88;
}
.harbor-btn.btn-apply:hover {
    background: #00FF88;
    color: #000;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.5);
}

/* ─── Responsive ─── */
@media (max-width: 700px) {
    .harbor-resupply-container { max-width: 98vw; }
    .harbor-unit-row { flex-wrap: wrap; }
    .harbor-col-status { flex: auto; width: 100%; justify-content: flex-start; margin-top: 4px; }
    .harbor-resupply-resources { display: none; }
}
