/* Root variables */
:root {
    --primary-color: #00ff00;
    --background-color: #0a0a0a;
    --header-bg: #111111;
    --text-color: #00ff00;
    --status-color: #00ff00;
    --error-color: #ff0000;
}

/* Reset and global styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: #1e1e1e;
    color: #ffffff;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Container styles */
.container {
    display: flex;
    flex-direction: column;
    height: 100vh; /* Ensure the container fills the viewport */
    width: 100%;
}

/* Header styles */
.header {
    padding: 0.5rem 1rem;
    background-color: #2d2d2d;
    border-bottom: 1px solid #3d3d3d;
    flex-shrink: 0;
}

.header h1 {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
    color: #00ff00;
}

.status-bar {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #888;
}

#status.connected {
    color: #00ff00;
}

#status.disconnected {
    color: #ff0000;
}

/* Terminal container styles */
#terminal-container {
    flex: auto; /* Allow the terminal container to take up all remaining space */
    overflow-y: auto;
    width: 100%;
    background-color: #1e1e1e; /* Terminal background color */
    display: flex;
    flex-direction: column;
    scroll-behavior: smooth; /* Smooth scrolling */
    max-height: 100vh; /* Prevent overflow on smaller screens */
    /* Adds breathing room on bottom */
    padding-bottom: 10vh;

    /* Prevent the container from growing too tall */
    max-height: calc(100vh - 10px);
}

/* Terminal styles */
#terminal {
    flex: 1; /* Ensure the terminal fills the container */
    background-color: #1e1e1e;
    padding: 0;
    overflow: hidden;
}

/* Hidden input styles */
#hiddenInput {
    position: absolute;
    opacity: 0;
    left: -9999px;
    z-index: -1;
}


/* Grouping Disclaimer and Hub Button */
.button-group {
    display: flex;
    gap: 6px; /* Tight spacing */
    margin-top: 6px;
}
/* Disclaimer button styles */
.disclaimer-btn {
    background-color: #333;
    color: var(--text-color);
    border: 1px solid #555;
    padding: 4px 10px;
    font-size: 0.8rem;
    margin-top: 6px;
    cursor: pointer;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
}

.disclaimer-btn:hover {
    background-color: #444;
}

.hub-btn {
    background-color: #333;
    color: var(--text-color);
    border: 1px solid #555;
    padding: 4px 10px;
    font-size: 0.8rem;
    margin-top: 6px;
    cursor: pointer;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    text-decoration: none;
}

.hub-btn:hover {
    background-color: #444;
}

/* Modal styles */
.modal.hidden {
    display: none;
}

.modal {
    position: fixed;
    z-index: 999;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
}

.modal-content {
    background-color: #222;
    color: #00ff00;
    margin: 10% auto;
    padding: 20px;
    border: 1px solid #444;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    font-size: 0.9rem;
    line-height: 1.4;
    font-family: 'Courier New', Courier, monospace;
}

.modal-content h2 {
    margin-bottom: 10px;
    color: #00ff00;
}

.modal-content ul {
    margin: 10px 0;
    padding-left: 20px;
}

.modal-content ul li {
    margin-bottom: 8px;
}

.close-btn {
    margin-top: 15px;
    padding: 6px 12px;
    background-color: #333;
    color: #ff0000;
    border: 1px solid #333;
    cursor: pointer;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
}

.close-btn:hover {
    background-color: #444;
}

/* Xterm.js styles */
.xterm {
    padding: 0;
    height: 100%;
}

.xterm-viewport {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--background-color);
}

.xterm-viewport::-webkit-scrollbar {
    width: 8px;
}

.xterm-viewport::-webkit-scrollbar-track {
    background: var(--background-color);
}

.xterm-viewport::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.xterm-viewport::-webkit-scrollbar-thumb:hover {
    background: #00cc00;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .header {
        padding: 0.25rem 0.5rem;
    }
    
    .header h1 {
        font-size: 1rem;
    }
    
    .status-bar {
        font-size: 0.7rem;
    }
    
    #terminal {
        font-size: 14px;
    }
    
    .xterm {
        font-size: 14px;
    }
}

/* Ensure proper terminal sizing on different devices */
@media (orientation: landscape) {
    .container {
        height: 100vh;
    }
}

@media (orientation: portrait) {
    .container {
        height: calc(100vh - 60px);
    }
}

/* Matrix-style scanlines effect */
#terminal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        transparent 0%,
        rgba(32, 128, 32, 0.2) 2%,
        transparent 3%,
        transparent 100%
    );
    background-size: 100% 3px;
    pointer-events: none;
    animation: scan 7.5s linear infinite;
    z-index: 1;
}

@keyframes scan {
    0% {
        background-position: 0 -100vh;
    }
    100% {
        background-position: 0 100vh;
    }
}

/* Terminal cursor animation */
.xterm-cursor-layer {
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background-color);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #00cc00;
}