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

body {
    background: #000;
    overflow: hidden;
    height: 100vh;
    font-family: 'Share Tech Mono', monospace;
    color: #0f0;
}

/* ===== LOADING ===== */
#loading-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #000;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

#loading-screen.fade-out {
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
}

#loading-screen .title {
    font-family: 'Major Mono Display', monospace;
    font-size: 4rem;
    color: #0f0;
    animation: glitch 3s infinite;
    text-shadow: 0 0 10px #0f0, 0 0 20px #0f0, 0 0 40px #0f0;
}

#loading-screen .subtitle {
    font-size: 0.875rem;
    color: rgba(0, 255, 0, 0.5);
    margin-top: 1rem;
    letter-spacing: 0.5em;
    text-transform: uppercase;
}

#loading-screen .loading-bar {
    width: 12rem;
    height: 2px;
    background: rgba(0, 255, 0, 0.15);
    margin-top: 2rem;
    position: relative;
    overflow: hidden;
}

#loading-screen .loading-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 33%;
    height: 100%;
    background: #0f0;
    animation: loading-progress 1.5s ease-in-out infinite;
}

@keyframes loading-progress {
    0%, 100% { transform: translateX(-100%); }
    50% { transform: translateX(300%); }
}

@keyframes glitch {
    0%, 100% { text-shadow: 0 0 10px #0f0, 0 0 20px #0f0, 0 0 40px #0f0; }
    33% { text-shadow: 2px 0 #f00, -2px 0 #00f; }
    66% { text-shadow: -2px 0 #f00, 2px 0 #00f; }
}

/* ===== CANVAS ===== */
#matrix-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.3;
}

/* ===== APP ===== */
#app {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 0.5rem;
}

/* ===== NAVBAR ===== */
#navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 255, 0, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    height: 48px;
}

#navbar .left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
}

#navbar .menu-btn,
#navbar .settings-btn {
    background: none;
    border: none;
    color: #0f0;
    cursor: pointer;
    padding: 4px;
    font-size: 1.5rem;
    transition: color 0.2s;
}

#navbar .menu-btn:hover,
#navbar .settings-btn:hover {
    color: #00dd00;
}

#navbar .session-name {
    color: rgba(0, 255, 0, 0.5);
    font-size: 0.875rem;
    display: none;
}

@media (min-width: 640px) {
    #navbar .session-name {
        display: block;
    }
}

/* ===== DROPDOWN ===== */
#session-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 255, 0, 0.15);
    border-radius: 8px;
    padding: 8px;
    min-width: 200px;
}

#session-dropdown.active {
    display: block;
}

#session-dropdown .label {
    color: rgba(0, 255, 0, 0.4);
    font-size: 0.65rem;
    padding: 4px 8px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

#session-dropdown .session-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: rgba(0, 255, 0, 0.5);
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    font-family: inherit;
    transition: all 0.2s;
}

#session-dropdown .session-item:hover {
    background: rgba(0, 255, 0, 0.08);
    color: #0f0;
}

#session-dropdown .session-item.active {
    background: rgba(0, 255, 0, 0.15);
    color: #0f0;
}

#session-dropdown .new-session {
    border-top: 1px solid rgba(0, 255, 0, 0.08);
    margin-top: 4px;
    padding-top: 8px;
    color: #0f0;
}

/* ===== TERMINAL ===== */
#terminal-wrapper {
    flex: 1;
    margin-top: 56px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 255, 0, 0.12);
    border-radius: 8px;
    overflow: hidden;
    padding: 8px;
    min-height: 400px;
}

#terminal {
    width: 100%;
    height: 100%;
}

/* ===== SETTINGS MODAL ===== */
#settings-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

#settings-modal.active {
    display: flex;
}

#settings-modal .modal-content {
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid rgba(0, 255, 0, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 420px;
    width: 100%;
}

#settings-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

#settings-modal .modal-title {
    font-family: 'Major Mono Display', monospace;
    color: #0f0;
    font-size: 1.25rem;
}

#settings-modal .close-btn {
    background: none;
    border: none;
    color: #0f0;
    cursor: pointer;
    font-size: 1.5rem;
    transition: color 0.2s;
}

#settings-modal .close-btn:hover {
    color: #00dd00;
}

#settings-modal .section-label {
    color: rgba(0, 255, 0, 0.5);
    font-size: 0.75rem;
    display: block;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#settings-modal .theme-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

#settings-modal .theme-btn {
    height: 2.5rem;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

#settings-modal .theme-btn.active {
    border-color: #0f0;
    transform: scale(1.05);
}

#settings-modal select {
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 255, 0, 0.2);
    color: #0f0;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.875rem;
    outline: none;
    cursor: pointer;
}

#settings-modal select:focus {
    border-color: #0f0;
}

#settings-modal .close-settings-btn {
    width: 100%;
    margin-top: 1.5rem;
    background: rgba(0, 255, 0, 0.15);
    border: none;
    color: #0f0;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}

#settings-modal .close-settings-btn:hover {
    background: rgba(0, 255, 0, 0.25);
}

/* ===== XTERM OVERRIDE ===== */
.xterm .xterm-viewport,
.xterm .xterm-screen {
    background: transparent !important;
}