/* BASIC Mode - QBASIC-style Retro Terminal Theme */
/* "BASIC taught a generation to code. This is BASIC for theirs." */

/* ============================================
   MODE TOGGLE (Base - Subtle for home page)
   ============================================ */
.mode-toggle-container {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.mode-toggle {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: transparent;
    border-radius: 4px;
    padding: 2px;
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #999;
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mode-btn:hover {
    color: #666;
}

.mode-btn.active {
    color: #333;
    font-weight: 600;
}

.mode-btn[data-mode="basic"].active {
    color: #0000AA;
}

.mode-icon {
    font-size: 0.8rem;
}

.mode-separator {
    color: #ccc;
    font-size: 0.7rem;
    user-select: none;
}

/* ============================================
   MODE TOGGLE (Prominent - for create page)
   ============================================ */
.mode-toggle-prominent {
    margin-bottom: 12px;
}

.mode-toggle-prominent .mode-toggle {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
}

.mode-toggle-prominent .mode-btn {
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: 6px;
}

.mode-toggle-prominent .mode-btn.active {
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.mode-toggle-prominent .mode-btn[data-mode="basic"].active {
    background: #0000AA;
    color: #FFFF55;
}

/* ============================================
   MODE TOGGLE (Bottom - for home page form)
   ============================================ */
.mode-toggle-bottom {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

.sound-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 4px;
    background: transparent;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #999;
}

.sound-toggle:hover {
    color: #666;
}

.sound-toggle.muted {
    opacity: 0.4;
}

/* ============================================
   BASIC TERMINAL
   ============================================ */
.basic-terminal {
    background: #0000AA;
    color: #FFFF55;
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 16px;
    line-height: 1.5;
    padding: 20px;
    border-radius: 8px;
    border: 4px solid #555555;
    position: relative;
    min-height: 350px;
    max-height: 500px;
    overflow-y: auto;
    overflow-x: hidden;
    max-width: 100%;
    box-sizing: border-box;
    box-shadow:
        inset 0 0 50px rgba(0, 0, 0, 0.3),
        0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Scanline effect */
.basic-terminal::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        transparent 0px,
        transparent 2px,
        rgba(0, 0, 0, 0.03) 2px,
        rgba(0, 0, 0, 0.03) 4px
    );
    pointer-events: none;
    z-index: 1;
}

/* CRT curvature effect (subtle) */
.basic-terminal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(
        ellipse at center,
        transparent 0%,
        transparent 70%,
        rgba(0, 0, 0, 0.15) 100%
    );
    pointer-events: none;
    z-index: 2;
}

.basic-terminal.hidden {
    display: none;
}

/* Terminal output area */
#terminalOutput {
    position: relative;
    z-index: 3;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* System text (white) */
.basic-terminal .system-text {
    color: #FFFFFF;
}

/* Line numbers (cyan) */
.basic-terminal .line-number {
    color: #55FFFF;
}

/* Error messages (bright red) */
.basic-terminal .error-text {
    color: #FF5555;
}

/* Success messages (bright green) */
.basic-terminal .success-text {
    color: #55FF55;
}

/* Input line container */
.basic-terminal .input-line {
    display: flex;
    align-items: center;
    position: relative;
    z-index: 3;
    margin-top: 4px;
}

.basic-terminal .prompt-char {
    color: #FFFF55;
    margin-right: 4px;
}

/* Hidden text input for capturing keystrokes */
.basic-terminal .terminal-input {
    position: absolute;
    left: -9999px;
    opacity: 0;
}

/* Displayed input text */
.basic-terminal .input-display {
    color: #FFFF55;
    white-space: pre;
}

/* Blinking cursor */
.cursor-blink {
    display: inline-block;
    width: 10px;
    height: 18px;
    background: #FFFF55;
    animation: blink 0.6s step-end infinite;
    vertical-align: text-bottom;
    margin-left: 1px;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Boot screen box drawing */
.boot-box {
    color: #FFFFFF;
    margin-bottom: 16px;
}

.boot-title {
    color: #55FFFF;
    font-weight: bold;
}

/* Program listing */
.program-line {
    display: block;
}

.program-line .line-num {
    color: #55FFFF;
    display: inline-block;
    width: 40px;
}

.program-line .line-content {
    color: #FFFF55;
}

/* ============================================
   COMPILE ANIMATION
   ============================================ */
.compile-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #0000AA;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.compile-overlay.hidden {
    display: none;
}

.compile-text {
    color: #FFFF55;
    font-family: 'Courier New', monospace;
    font-size: 18px;
    text-align: center;
    margin-bottom: 20px;
}

.compile-progress {
    width: 200px;
    height: 20px;
    border: 2px solid #FFFF55;
    position: relative;
    overflow: hidden;
}

.compile-progress-bar {
    height: 100%;
    background: #FFFF55;
    width: 0%;
    transition: width 0.1s linear;
}

.compile-dots {
    display: inline-block;
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
    100% { content: ''; }
}

/* ============================================
   HELP DISPLAY
   ============================================ */
.help-section {
    margin: 8px 0;
}

.help-command {
    color: #55FFFF;
    display: inline-block;
    width: 180px;
}

.help-desc {
    color: #AAAAAA;
}

/* ============================================
   TAGLINE
   ============================================ */
.basic-tagline {
    color: #888888;
    font-size: 12px;
    font-style: italic;
    text-align: center;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #333366;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 600px) {
    .mode-toggle-container {
        flex-direction: column;
        align-items: stretch;
    }

    .mode-toggle {
        width: 100%;
        justify-content: center;
    }

    .mode-btn {
        flex: 1;
        justify-content: center;
        padding: 10px 12px;
    }

    .sound-toggle {
        align-self: flex-end;
    }

    .basic-terminal {
        font-size: 13px;
        padding: 12px;
        min-height: 250px;
        max-height: 400px;
        border-width: 2px;
        border-radius: 6px;
        word-break: break-word;
    }

    .basic-terminal #terminalOutput,
    .basic-terminal [id$="TerminalOutput"] {
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .cursor-blink {
        width: 8px;
        height: 14px;
    }

    .basic-tagline {
        font-size: 10px;
        margin-top: 12px;
        padding-top: 8px;
    }

    /* Prominent toggle on mobile */
    .mode-toggle-prominent .mode-toggle {
        flex-direction: row;
    }

    .mode-toggle-prominent .mode-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .cursor-blink {
        animation: none;
        opacity: 1;
    }

    .compile-dots {
        animation: none;
    }

    .compile-progress-bar {
        transition: none;
    }
}

/* ============================================
   EASTER EGG: CRT FLICKER
   ============================================ */
@keyframes crt-flicker {
    0% { opacity: 1; }
    10% { opacity: 0.8; }
    20% { opacity: 1; }
    30% { opacity: 0.9; }
    40% { opacity: 1; }
    50% { opacity: 0.7; }
    60% { opacity: 1; }
    70% { opacity: 0.85; }
    80% { opacity: 1; }
    90% { opacity: 0.95; }
    100% { opacity: 1; }
}
