/**
 * Conning Tower Build UI - Shared theme for Ship & Aircraft builders
 * Green phosphor CRT / EGA monitor aesthetic
 */

/* ============================================================
   MODAL OVERLAY
   ============================================================ */
.conning-tower-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.88);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Courier New', monospace;
}

/* ============================================================
   MAIN PANEL - CRT monitor frame
   ============================================================ */
.conning-tower-panel {
    background: linear-gradient(180deg, #0a140a 0%, #050d05 40%, #081008 100%);
    border: 3px solid #2a8a2a;
    border-radius: 4px;
    width: 960px;
    max-width: 95vw;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow:
        0 0 30px rgba(0, 255, 0, 0.15),
        0 0 60px rgba(0, 200, 0, 0.08),
        inset 0 1px 0 rgba(0, 255, 0, 0.05),
        inset 0 -1px 0 rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

/* Scanline overlay */
.conning-tower-panel::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 255, 0, 0.015) 2px,
        rgba(0, 255, 0, 0.015) 4px
    );
    pointer-events: none;
    z-index: 3;
}

/* ============================================================
   HEADER BAR
   ============================================================ */
.conning-tower-header {
    background: linear-gradient(180deg, #0d1a0d 0%, #081208 50%, #060e06 100%);
    border-bottom: 2px solid #2a8a2a;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 2;
}

.conning-tower-header::after {
    content: '';
    position: absolute;
    bottom: -2px; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 0, 0.3), transparent);
}

.conning-tower-title {
    color: #00ff00;
    font-size: 18px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 3px;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
    margin: 0;
}

.conning-tower-subtitle {
    color: #4CAF50;
    font-size: 12px;
    letter-spacing: 1px;
    margin-top: 2px;
}

.conning-tower-close {
    background: none;
    border: 1px solid #2a8a2a;
    color: #00ff00;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    border-radius: 2px;
    z-index: 2;
}

.conning-tower-close:hover {
    background: rgba(0, 255, 0, 0.15);
    border-color: #00ff00;
    box-shadow: 0 0 8px rgba(0, 255, 0, 0.3);
}

/* ============================================================
   BODY LAYOUT
   ============================================================ */
.conning-tower-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative;
    z-index: 2;
}

/* ============================================================
   LEFT COLUMN - ANNUNCIATOR DIAL
   ============================================================ */
.conning-tower-dial-column {
    width: 220px;
    min-width: 220px;
    background: linear-gradient(180deg, #081008 0%, #040804 100%);
    border-right: 2px solid #2a8a2a;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.dial-section-label {
    color: #4CAF50;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
    padding: 10px 0 6px 0;
    border-bottom: 1px solid rgba(0, 170, 0, 0.25);
}

/* Type selector - the annunciator */
.annunciator {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 4px 10px;
    overflow-y: auto;
}

.annunciator-slot {
    padding: 10px 12px;
    color: #3a7a3a;
    font-size: 13px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    border-left: 4px solid transparent;
    transition: all 0.2s;
    position: relative;
    margin: 2px 0;
    background: transparent;
    border-right: none;
    border-top: none;
    border-bottom: none;
    text-align: left;
    font-family: 'Courier New', monospace;
    display: block;
    width: 100%;
}

.annunciator-slot:hover {
    color: #66cc66;
    background: rgba(0, 255, 0, 0.05);
    border-left-color: #2a8a2a;
}

.annunciator-slot.active {
    color: #00ff00;
    background: linear-gradient(90deg, rgba(0, 255, 0, 0.1), transparent);
    border-left-color: #00ff00;
    text-shadow: 0 0 8px rgba(0, 255, 0, 0.4);
}

.annunciator-slot.active::after {
    content: '▸';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #00ff00;
    font-size: 12px;
}

/* Tech level selector */
.tech-selector {
    border-top: 2px solid #2a8a2a;
    padding: 10px;
}

.tech-selector-label {
    color: #4CAF50;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
    margin-bottom: 8px;
}

.tech-buttons {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.tech-btn {
    width: 42px;
    height: 36px;
    background: linear-gradient(180deg, #0a140a 0%, #050d05 100%);
    border: 1px solid #2a5a2a;
    color: #3a7a3a;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tech-btn:hover {
    border-color: #2a8a2a;
    color: #66cc66;
}

.tech-btn.active {
    background: linear-gradient(180deg, #0d2a0d 0%, #081a08 100%);
    border-color: #00ff00;
    color: #00ff00;
    box-shadow: 0 0 8px rgba(0, 255, 0, 0.3);
    text-shadow: 0 0 6px rgba(0, 255, 0, 0.5);
}

.tech-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ============================================================
   CENTER COLUMN - UNIT DETAIL
   ============================================================ */
.conning-tower-detail-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 16px 20px;
    min-width: 0;
}

/* Unit header area */
.ct-unit-header {
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0, 170, 0, 0.3);
}

.ct-unit-name {
    color: #00ff00;
    font-size: 22px;
    font-weight: bold;
    margin: 0 0 4px 0;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.4);
}

.ct-unit-class {
    color: #4CAF50;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Narrative section */
.ct-narrative {
    color: #88cc88;
    font-size: 13px;
    line-height: 1.7;
    margin-bottom: 16px;
    padding: 12px 14px;
    background: rgba(0, 255, 0, 0.03);
    border-left: 3px solid #2a8a2a;
    border-radius: 0 2px 2px 0;
    font-style: italic;
    max-height: 120px;
    overflow-y: auto;
}

/* Stats grid */
.ct-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.ct-stat-box {
    background: linear-gradient(180deg, rgba(0, 20, 0, 0.8) 0%, rgba(0, 10, 0, 0.8) 100%);
    border: 1px solid rgba(0, 170, 0, 0.3);
    border-radius: 2px;
    padding: 8px 10px;
    text-align: center;
}

.ct-stat-label {
    color: #4CAF50;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 3px;
}

.ct-stat-value {
    color: #00ff00;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 0 0 6px rgba(0, 255, 0, 0.4);
}

/* Cost section */
.ct-cost-section {
    margin-bottom: 16px;
}

.ct-cost-label {
    color: #4CAF50;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.ct-cost-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.ct-cost-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 8px;
    background: rgba(0, 15, 0, 0.6);
    border: 1px solid rgba(0, 170, 0, 0.15);
    border-radius: 2px;
    font-size: 12px;
}

.ct-cost-name {
    color: #5a8a5a;
}

.ct-cost-amount {
    color: #00ff00;
    font-weight: bold;
}

/* Build button */
.ct-build-button {
    width: 100%;
    padding: 14px;
    background: linear-gradient(180deg, #0d2a0d 0%, #081a08 50%, #060e06 100%);
    border: 2px solid #2a8a2a;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 3px;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 2px;
    margin-top: auto;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.4);
}

.ct-build-button:hover {
    background: linear-gradient(180deg, #103510 0%, #0d2a0d 50%, #081a08 100%);
    border-color: #00ff00;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.4);
    text-shadow: 0 0 8px rgba(0, 255, 0, 0.6);
}

.ct-build-button:active {
    transform: scale(0.98);
    box-shadow: 0 0 8px rgba(0, 255, 0, 0.2);
}

/* No unit selected placeholder */
.ct-placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2a5a2a;
    font-size: 14px;
    font-style: italic;
    text-align: center;
    padding: 40px;
}

/* ============================================================
   SCROLLBAR STYLING
   ============================================================ */
.conning-tower-detail-column::-webkit-scrollbar,
.annunciator::-webkit-scrollbar,
.ct-narrative::-webkit-scrollbar {
    width: 6px;
}

.conning-tower-detail-column::-webkit-scrollbar-track,
.annunciator::-webkit-scrollbar-track,
.ct-narrative::-webkit-scrollbar-track {
    background: #040804;
}

.conning-tower-detail-column::-webkit-scrollbar-thumb,
.annunciator::-webkit-scrollbar-thumb,
.ct-narrative::-webkit-scrollbar-thumb {
    background: #2a8a2a;
    border-radius: 3px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .conning-tower-panel {
        width: 100vw;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .conning-tower-body {
        flex-direction: column;
    }
    
    .conning-tower-dial-column {
        width: 100%;
        min-width: auto;
        border-right: none;
        border-bottom: 2px solid #2a8a2a;
        max-height: 200px;
    }
    
    .ct-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .ct-cost-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
