:root {
    --glow-color: #00e5ff;
    --dark-bg: #030814;
    --text-color: #e6f7ff;
    --border-color: rgba(0, 229, 255, 0.3);
    --border-glow: 0 0 5px var(--glow-color), 0 0 10px var(--glow-color), 0 0 15px var(--glow-color);
    --text-glow: 0 0 3px var(--glow-color);
    --progress-bar-color: #ff2a6d;
}

@keyframes flash {
    0% { box-shadow: var(--border-glow), inset 0 0 15px rgba(0, 229, 255, 0.2); }
    50% { box-shadow: 0 0 25px #fff, inset 0 0 40px #fff; background: rgba(255,255,255,0.3); }
    100% { box-shadow: var(--border-glow), inset 0 0 15px rgba(0, 229, 255, 0.2); }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--dark-bg);
    font-family: 'Orbitron', sans-serif;
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
    background-image: url('ui_background.png');
    background-size: cover;
}

#app-container {
    position: relative;
    width: 95vw;
    height: 95vh;
    max-width: 1200px;
    max-height: 800px;
    border: 2px solid var(--border-color);
    box-shadow: var(--border-glow), inset 0 0 15px rgba(0, 229, 255, 0.2);
    background: rgba(10, 25, 47, 0.3);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

#visualizer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 5px;
    background-color: var(--progress-bar-color);
    box-shadow: 0 0 5px var(--progress-bar-color), 0 0 10px var(--progress-bar-color);
    z-index: 10;
    transition: width 0.1s linear;
}

.ui-overlay {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 20px;
    pointer-events: none; /* Allow clicks to pass through to canvas if needed, but re-enable on controls */
    gap: 15px;
}

.ui-overlay > * {
    pointer-events: all;
}

.main-header, .main-footer {
    padding: 10px;
    border: 1px solid var(--border-color);
    background: rgba(0, 229, 255, 0.05);
    flex-shrink: 0;
}

.main-header {
    text-align: center;
    text-transform: uppercase;
}

.main-header h1 {
    font-size: 1.5rem;
    text-shadow: var(--text-glow);
    letter-spacing: 2px;
}

.header-bars {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 5px;
}
.header-bars span {
    height: 2px;
    background-color: var(--glow-color);
    box-shadow: var(--text-glow);
}
.header-bars span:nth-child(1) { width: 40px; }
.header-bars span:nth-child(2) { width: 10px; }
.header-bars span:nth-child(3) { width: 25px; }
.header-bars span:nth-child(4) { width: 10px; }
.header-bars span:nth-child(5) { width: 40px; }

.controls {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 0 20px;
    gap: 30px;
    height: 100%;
    overflow-y: auto;
}

.control-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 48%; /* Adjust width to create space */
    max-width: 450px;
}

.control-group {
    width: 100%;
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.8rem;
    color: var(--glow-color);
    text-shadow: var(--text-glow);
    letter-spacing: 1px;
}

input, textarea, select {
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 10px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2300e5ff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 1em;
    padding-right: 2rem;
}

select option {
    background: var(--dark-bg);
    color: var(--text-color);
}

select optgroup {
    background-color: var(--dark-bg);
    font-weight: bold;
    color: var(--glow-color);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--glow-color);
    box-shadow: var(--border-glow);
}

textarea {
    resize: none;
    min-height: 100px;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

#soi-value {
    font-size: 0.9rem;
    color: var(--glow-color);
    width: 50px; /* fixed width to prevent layout shift */
    text-align: right;
    flex-shrink: 0;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 5px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

input[type="range"]:focus {
    border-color: var(--glow-color);
    box-shadow: var(--border-glow);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--glow-color);
    border-radius: 50%;
    border: 2px solid var(--dark-bg);
    box-shadow: var(--border-glow);
    margin-top: -8px; /* Center thumb on track */
    transition: all 0.3s ease;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--glow-color);
    border-radius: 50%;
    border: 2px solid var(--dark-bg);
    box-shadow: var(--border-glow);
    cursor: pointer;
}

input[type="range"]::-moz-range-track {
    width: 100%;
    height: 5px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    cursor: pointer;
}

input[type="file"] {
    display: none;
}
.file-upload-label {
    display: block;
    width: 100%;
    padding: 10px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}
.file-upload-label:hover {
    border-color: var(--glow-color);
    color: var(--glow-color);
    box-shadow: var(--border-glow);
}

.control-group-horizontal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    border: 1px solid var(--border-color);
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 3px;
    background-color: var(--glow-color);
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--glow-color);
    box-shadow: var(--border-glow);
}

input:checked + .slider:before {
    transform: translateX(26px);
    background-color: var(--dark-bg);
}

/* Red Switch for Hyper Omega */
.red-switch .slider:before {
    background-color: var(--progress-bar-color);
    box-shadow: 0 0 5px var(--progress-bar-color);
}

.red-switch input:checked + .slider {
    background-color: var(--progress-bar-color);
    box-shadow: 0 0 5px var(--progress-bar-color), 0 0 10px var(--progress-bar-color), 0 0 15px var(--progress-bar-color);
}

.red-switch input:checked + .slider:before {
    background-color: var(--dark-bg);
}

.launch-sequence {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

#activate-button {
    width: 60%;
    max-width: 500px;
    padding: 15px;
    background: transparent;
    border: 2px solid var(--glow-color);
    color: var(--glow-color);
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: color 0.3s, box-shadow 0.3s;
}

#activate-button:hover {
    color: var(--dark-bg);
    box-shadow: var(--border-glow);
    text-shadow: none;
}

#activate-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--glow-color);
    transition: left 0.4s ease;
    z-index: -1;
}

#activate-button:hover::before {
    left: 0;
}

#activate-button:disabled {
    color: #666;
    border-color: #444;
    cursor: not-allowed;
    text-shadow: none;
    box-shadow: none;
}
#activate-button:disabled:hover::before {
    left: -100%;
}

#activate-button:disabled .button-text {
    animation: pulse-text 1.5s infinite;
}

@keyframes pulse-text {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

#manual-button {
    position: absolute;
    top: 15px;
    right: 20px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--glow-color);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-bottom: 2px; /* Optical alignment */
}

#manual-button:hover {
    box-shadow: var(--border-glow);
    background-color: var(--glow-color);
    color: var(--dark-bg);
}

.main-footer {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-light {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background-color: #ffd700; /* Gold for standby */
    box-shadow: 0 0 5px #ffd700, 0 0 10px #ffd700;
    transition: all 0.5s ease;
}
.status-light.active {
    background-color: var(--glow-color);
    box-shadow: var(--border-glow);
}
.status-light.complete {
    background-color: #39ff14; /* Neon green for complete */
    box-shadow: 0 0 5px #39ff14, 0 0 10px #39ff14;
}

/* Modal Styles */
#manual-modal.modal-hidden {
    display: none;
}

#manual-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(3, 8, 20, 0.7);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    width: 90%;
    height: 85%;
    max-width: 900px;
    background: rgba(10, 25, 47, 0.8);
    border: 2px solid var(--border-color);
    box-shadow: var(--border-glow);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 229, 255, 0.1);
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: var(--text-glow);
}

.modal-header div {
    display: flex;
    gap: 10px;
}

.modal-header button {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 5px 15px;
    cursor: pointer;
    font-family: 'Orbitron', sans-serif;
    transition: all 0.3s ease;
}

.modal-header button:hover {
    color: var(--glow-color);
    border-color: var(--glow-color);
    box-shadow: 0 0 5px var(--glow-color);
}

#close-manual-button {
    font-size: 1.5rem;
    padding: 0px 10px;
    line-height: 1;
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    font-size: 0.95rem;
}

.modal-body h2 {
    color: var(--glow-color);
    text-shadow: var(--text-glow);
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.modal-body h4 {
    color: var(--text-color);
    font-weight: 700;
    margin-bottom: 8px;
}

.modal-body p {
    line-height: 1.6;
    margin-bottom: 10px;
    opacity: 0.9;
}

.modal-body ol {
    margin-left: 20px;
    margin-bottom: 20px;
}
.modal-body li {
    margin-bottom: 10px;
}

.modal-body strong {
    color: var(--glow-color);
    font-weight: 400;
}

.manual-entry {
    margin-bottom: 25px;
    padding-left: 15px;
    border-left: 2px solid rgba(0, 229, 255, 0.3);
}
.page-break {
    break-before: page;
    page-break-before: always;
}

/* Print Styles */
@media print {
    body, #app-container {
        background: #fff !important;
        color: #000 !important;
        box-shadow: none !important;
        border: none !important;
    }

    .ui-overlay, #manual-modal .modal-header {
        display: none !important;
    }
    
    #manual-modal {
        position: static;
        background: transparent;
        backdrop-filter: none;
        display: block;
    }

    .modal-content {
        width: 100%;
        height: auto;
        border: none;
        box-shadow: none;
        color: #000;
    }

    .modal-body {
        padding: 1in;
        font-size: 11pt;
        overflow: visible;
    }

    .modal-body h2, .modal-body h4, .modal-body strong {
        color: #000 !important;
        text-shadow: none !important;
    }

    .manual-entry {
        border-left: 2px solid #ccc;
    }
    
    .print-header { display: block; text-align: center; margin-bottom: 2rem; }
    .print-header h1 { font-size: 24pt; }
    .print-header p { font-size: 12pt; font-style: italic; }
    .print-footer { display: block; text-align: center; margin-top: 2rem; font-size: 9pt; font-style: italic;}
}

.print-header, .print-footer {
    display: none;
}