/**
 * Workstation Layout - First-Person View
 * 40% Radio Transceiver (Left) | 60% CRT Monitor (Right)
 */

/* Main Workstation Container */
#workstation-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(180deg, #1a1a1a 0%, #0a0a0a 100%);
    overflow: hidden;
    position: relative;
}

/* Left Side: Radio Transceiver Panel (40%) */
#radio-transceiver {
    width: 40%;
    height: 100%;
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    border-right: 3px solid #333;
    box-shadow: 
        inset -5px 0 15px rgba(0, 0, 0, 0.5),
        5px 0 20px rgba(0, 0, 0, 0.7);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    
    /* Subtle perspective for depth */
    transform: perspective(1500px) rotateY(2deg);
    transform-origin: right center;
}

/* Radio panel inner container */
#radio-transceiver::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        repeating-linear-gradient(
            0deg,
            rgba(255, 255, 255, 0.02) 0px,
            transparent 1px,
            transparent 2px,
            rgba(255, 255, 255, 0.02) 3px
        );
    pointer-events: none;
    z-index: 1;
}

/* Right Side: CRT Monitor Container (60%) */
#crt-monitor-container {
    width: 60%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    box-sizing: border-box;
    position: relative;
    
    /* Subtle perspective for depth */
    transform: perspective(1500px) rotateY(-1deg);
    transform-origin: left center;
}

/* Monitor Frame (CRT Bezel) */
#monitor-frame {
    width: 100%;
    max-width: 1200px;
    height: 90%;
    background: linear-gradient(145deg, #3a3a3a 0%, #1a1a1a 100%);
    border-radius: 12px;
    padding: 30px;
    box-sizing: border-box;
    position: relative;
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.9),
        inset 0 2px 5px rgba(255, 255, 255, 0.1),
        inset 0 -2px 5px rgba(0, 0, 0, 0.5);
}

/* Monitor bezel details */
#monitor-frame::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    bottom: 15px;
    border: 2px solid #444;
    border-radius: 8px;
    pointer-events: none;
}

/* Monitor Screen */
#monitor-screen {
    width: 100%;
    height: 100%;
    background: #000;
    border-radius: 6px;
    position: relative;
    overflow: hidden;
    box-shadow:
        inset 0 0 20px rgba(0, 0, 0, 0.9),
        inset 0 0 40px rgba(0, 255, 100, 0.05);
}

/* Game Canvas */
#monitor-screen canvas#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 1;
}

/* Radio Mode Display Overlay */
#radio-mode-display {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    display: none; /* Shown when in radio mode */
    background: #000;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    padding: 20px;
    box-sizing: border-box;
}

#radio-mode-display.active {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 15px;
}

/* Morse Code Reference (Top-Left) */
#morse-reference {
    grid-column: 1;
    grid-row: 1 / 3;
    border: 3px solid #00ff00;
    padding: 20px;
    overflow-y: auto;
    background: rgba(0, 30, 0, 0.9);
    box-shadow: 0 0 30px rgba(0, 255, 0, 0.4), inset 0 0 40px rgba(0, 255, 0, 0.15);
}

#morse-reference h3 {
    margin: 0 0 20px 0;
    font-size: 22px;
    font-weight: bold;
    text-align: center;
    color: #00ff00;
    border-bottom: 3px solid #00ff00;
    padding-bottom: 12px;
}

.morse-columns {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    font-size: 16px;
    line-height: 1.6;
}

.morse-column {
    display: flex;
    flex-direction: column;
}

.morse-entry {
    display: flex;
    justify-content: space-between;
    padding: 6px 10px;
    margin-bottom: 4px;
    border: 1px solid rgba(0, 255, 0, 0.3);
    background: rgba(0, 0, 0, 0.95);
    border-radius: 4px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
}

.morse-entry:hover {
    background: rgba(0, 50, 0, 0.95);
    border-color: rgba(0, 255, 0, 0.5);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.3), inset 0 0 10px rgba(0, 0, 0, 0.8);
}

.morse-char {
    font-weight: bold;
    color: #00ff00 !important;
    font-size: 18px;
    min-width: 25px;
}

.morse-code {
    color: #00ff00 !important;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    font-size: 18px;
    font-weight: bold;
}

/* Decode Input Box (Bottom-Left) */
#decode-input {
    grid-column: 1;
    grid-row: 2;
    border: 2px solid #00ff00;
    padding: 15px;
    background: rgba(0, 20, 0, 0.8);
    box-shadow: inset 0 0 20px rgba(0, 255, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#decode-input label {
    font-size: 12px;
    margin-bottom: 0;
    color: #00ff00;
    text-shadow: 0 0 3px #00ff00;
}

.decode-input-row {
    display: flex;
    gap: 10px;
}

#decode-input input {
    flex: 1;
    background: #000;
    border: 1px solid #00ff00;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    padding: 8px;
    outline: none;
}

#decode-input input:focus {
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

.decode-submit-btn {
    background: #001100;
    border: 2px solid #00ff00;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    padding: 8px 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.decode-submit-btn:hover {
    background: #003300;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
}

.decode-submit-btn:active {
    background: #005500;
}

.decode-feedback {
    font-size: 14px;
    padding: 5px;
    text-align: center;
    min-height: 20px;
}

.decode-feedback.success {
    color: #00ff00;
    text-shadow: 0 0 5px #00ff00;
}

.decode-feedback.partial {
    color: #ffff00;
}

.decode-feedback.error {
    color: #ff0000;
}

.decoded-history {
    margin-top: 10px;
    border: 1px solid rgba(0, 255, 0, 0.3);
    background: #000;
    padding: 8px;
    max-height: 120px;
    overflow-y: auto;
}

.history-label {
    font-size: 11px;
    color: #00ff00;
    margin-bottom: 5px;
    border-bottom: 1px solid rgba(0, 255, 0, 0.3);
    padding-bottom: 3px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.history-entry {
    font-size: 12px;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    padding: 3px;
    background: rgba(0, 255, 0, 0.05);
    border-left: 2px solid #00ff00;
    padding-left: 5px;
}

.history-time {
    color: #00aa00;
    margin-right: 5px;
}

.history-text {
    color: #00ff00;
}

.signal-label {
    color: #00ff00;
    font-weight: bold;
    margin-bottom: 5px;
}

.morse-display {
    color: #00aa00;
    font-family: monospace;
    font-size: 14px;
    letter-spacing: 2px;
    margin: 5px 0;
}

.signal-strength {
    color: #00aa00;
    font-size: 11px;
    margin-top: 5px;
}

/* Radar Map Container (Right Side) */
#radar-map-container {
    grid-column: 2;
    grid-row: 1 / 3;
    border: 2px solid #00ff00;
    background: rgba(0, 20, 0, 0.8);
    position: relative;
    box-shadow: inset 0 0 20px rgba(0, 255, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.radar-header {
    background: rgba(0, 255, 0, 0.1);
    border-bottom: 2px solid #00ff00;
    padding: 8px;
    text-align: center;
    color: #00ff00;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 2px;
}

#radar-canvas {
    flex: 1;
    width: 100%;
    height: 100%;
    display: block;
}

/* Power Indicator */
.power-indicator {
    position: absolute;
    bottom: 15px;
    right: 20px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #333;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.power-indicator.on {
    background: #00ff00;
    box-shadow: 
        0 0 10px #00ff00,
        0 0 20px rgba(0, 255, 0, 0.5),
        inset 0 1px 2px rgba(255, 255, 255, 0.3);
}

.power-indicator.off {
    background: #1a1a1a;
}

/* CRT Effects (applied to monitor only) */
.crt-glare {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.05) 0%,
        transparent 40%,
        transparent 100%
    );
    pointer-events: none;
    z-index: 100;
}

.crt-phosphor {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.1) 0px,
        transparent 1px,
        transparent 2px,
        rgba(0, 0, 0, 0.1) 3px
    );
    pointer-events: none;
    z-index: 101;
    animation: scanline 8s linear infinite;
}

@keyframes scanline {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(100%);
    }
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    #radio-transceiver {
        width: 35%;
    }
    
    #crt-monitor-container {
        width: 65%;
        padding: 20px;
    }
}

/* Ensure UI containers work with new layout */
#world-ui-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

/* Allow child elements to receive pointer events */
#world-ui-container > * {
    pointer-events: auto;
}

#inventory-container > * {
    pointer-events: auto;
}

#edge-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 300;
}

