/* =====================================================
   Air Defense Popup — OceanWar
   Overlay for managing island Home Air Wing defense
   settings: enable/disable, defense range, aircraft list.
   ===================================================== */

.air-defense-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 11000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.air-defense-container {
    width: 700px;
    max-width: 95vw;
    max-height: 85vh;
    background: linear-gradient(135deg, #0a1a0a 0%, #0d2818 50%, #0a1a0a 100%);
    border: 2px solid #00cc66;
    border-radius: 12px;
    box-shadow: 0 0 40px rgba(0, 204, 102, 0.3), inset 0 0 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Courier New', monospace;
    color: #00ff88;
}

/* ── Header ── */
.air-defense-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(180deg, #0d2818, #0a1a0a);
    border-bottom: 1px solid #00cc66;
}

.air-defense-header-icon {
    font-size: 28px;
}

.air-defense-header-text h2 {
    margin: 0;
    font-size: 18px;
    color: #00ff88;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.air-defense-subtitle {
    font-size: 11px;
    color: #448866;
    margin-top: 2px;
}

.air-defense-close {
    margin-left: auto;
    background: none;
    border: 1px solid #445;
    color: #889;
    font-size: 22px;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}
.air-defense-close:hover {
    color: #ff4444;
    border-color: #ff4444;
}

/* ── Body ── */
.air-defense-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

/* ── Settings Section ── */
.air-defense-settings {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.air-defense-setting-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: rgba(0, 40, 20, 0.5);
    border: 1px solid #1a3a2a;
    border-radius: 8px;
}

.air-defense-setting-label {
    font-size: 13px;
    color: #88ccaa;
    min-width: 160px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.air-defense-setting-value {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Toggle switch */
.air-defense-toggle {
    position: relative;
    width: 48px;
    height: 24px;
    cursor: pointer;
}
.air-defense-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}
.air-defense-toggle .toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #1a1a2e;
    border: 1px solid #333;
    border-radius: 12px;
    transition: 0.3s;
}
.air-defense-toggle .toggle-slider:before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background: #666;
    border-radius: 50%;
    transition: 0.3s;
}
.air-defense-toggle input:checked + .toggle-slider {
    background: #004d26;
    border-color: #00cc66;
}
.air-defense-toggle input:checked + .toggle-slider:before {
    transform: translateX(24px);
    background: #00ff88;
}

.toggle-status {
    font-size: 12px;
    font-weight: bold;
}
.toggle-status.enabled { color: #00ff88; }
.toggle-status.disabled { color: #ff6644; }

/* Range slider */
.air-defense-range-slider {
    width: 200px;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #1a1a2e;
    border: 1px solid #333;
    border-radius: 3px;
    outline: none;
}
.air-defense-range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #00cc66;
    border-radius: 50%;
    cursor: pointer;
}
.air-defense-range-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #00cc66;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}
.air-defense-range-value {
    font-size: 16px;
    font-weight: bold;
    color: #00ff88;
    min-width: 55px;
    text-align: center;
}

/* ── Aircraft List ── */
.air-defense-aircraft-header {
    font-size: 14px;
    font-weight: bold;
    color: #00bfff;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #1a3a5a;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.air-defense-aircraft-table {
    width: 100%;
}

.air-defense-table-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    padding: 6px 10px;
    font-size: 10px;
    color: #667;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid #1a2a40;
}

.air-defense-aircraft-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    align-items: center;
    padding: 8px 10px;
    font-size: 12px;
    border-bottom: 1px solid #0d1a2a;
    transition: background 0.15s;
}
.air-defense-aircraft-row:hover {
    background: rgba(0, 60, 30, 0.3);
}

.air-defense-unit-name {
    display: flex;
    align-items: center;
    gap: 6px;
}
.air-defense-unit-icon { font-size: 14px; }
.air-defense-unit-label { color: #aaffcc; font-weight: bold; }
.air-defense-unit-type { color: #667; font-size: 10px; margin-left: 4px; }

.air-defense-bar {
    width: 60px;
    height: 6px;
    background: #1a1a2e;
    border-radius: 3px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
}
.air-defense-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}
.air-defense-bar-fill.hp-high { background: #00cc66; }
.air-defense-bar-fill.hp-mid { background: #ccaa00; }
.air-defense-bar-fill.hp-low { background: #cc3333; }
.air-defense-bar-fill.fuel-bar { background: #3399ff; }
.air-defense-bar-text {
    font-size: 10px;
    color: #889;
    margin-left: 4px;
}

.air-defense-status-tag {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: bold;
}
.air-defense-status-tag.ready { background: #003d1a; color: #00ff88; }
.air-defense-status-tag.damaged { background: #3d1a00; color: #ff6644; }
.air-defense-status-tag.low-fuel { background: #1a2a3d; color: #6699ff; }

.air-defense-no-aircraft {
    text-align: center;
    padding: 30px;
    color: #556;
    font-size: 13px;
}

/* ── Carrier Wings ── */
.air-defense-carrier-wings {
    margin-top: 8px;
}
.air-defense-carrier-section {
    border: 1px solid #1a3a2a;
    border-radius: 6px;
    margin-bottom: 8px;
    overflow: hidden;
}
.air-defense-carrier-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: linear-gradient(90deg, #0d1a2d, #0a1520);
    border-bottom: 1px solid #1a3a2a;
    font-size: 13px;
    color: #8ab4f8;
}
.air-defense-carrier-icon { font-size: 16px; }
.air-defense-carrier-name { font-weight: bold; color: #cde; }
.air-defense-carrier-type { color: #6a8a9a; font-size: 11px; }
.air-defense-carrier-fleet { color: #556; font-size: 11px; flex: 1; }
.air-defense-carrier-cap {
    background: #0a2a40;
    border: 1px solid #1a4a5a;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 11px;
    color: #6ac;
}
.air-defense-wing-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 16px;
    font-size: 12px;
    border-bottom: 1px solid #0d1a10;
    color: #9ab;
}
.air-defense-wing-name { color: #bcd; flex: 1; }
.air-defense-wing-type { color: #6a8a6a; font-size: 11px; }
.air-defense-wing-count { color: #8ab4f8; font-size: 11px; }
.air-defense-wing-status {
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 3px;
    background: #003d1a;
    color: #00ff88;
}
.air-defense-wing-section {
    margin-bottom: 2px;
}
.air-defense-wing-aircraft {
    margin-left: 16px;
    border-top: none !important;
    border-left: 2px solid #1a3a2a;
}
.air-defense-carrier-section .air-defense-aircraft-table {
    border-top: none;
}
.air-defense-carrier-section .air-defense-no-aircraft {
    padding: 12px;
    font-size: 12px;
}

/* ── Footer ── */
.air-defense-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 20px;
    background: linear-gradient(180deg, #0a1a0a, #0d2818);
    border-top: 1px solid #1a3a2a;
}

.air-defense-btn {
    padding: 8px 20px;
    border: 1px solid #333;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s;
}
.air-defense-btn.btn-save {
    background: linear-gradient(180deg, #004d26, #003319);
    color: #00ff88;
    border-color: #00cc66;
}
.air-defense-btn.btn-save:hover {
    background: linear-gradient(180deg, #006633, #004d26);
    box-shadow: 0 0 10px rgba(0, 204, 102, 0.3);
}
.air-defense-btn.btn-close {
    background: linear-gradient(180deg, #1a1a2e, #12122a);
    color: #889;
    border-color: #445;
}
.air-defense-btn.btn-close:hover {
    color: #aab;
    border-color: #667;
}

/* ── Capacity info ── */
.air-defense-capacity {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    margin-bottom: 12px;
    background: rgba(0, 30, 60, 0.4);
    border: 1px solid #1a3a5a;
    border-radius: 6px;
    font-size: 12px;
    color: #88aacc;
}
.air-defense-capacity-value {
    font-weight: bold;
    color: #00bfff;
    font-size: 14px;
}
