
* {
    box-sizing: border-box;
}

body, html {
    margin: 0;
    padding: 0;
    min-height: 100%;
    min-height: 100vh; /* Use viewport height for better mobile support */
    overflow: auto; /* Enable scrolling */
    background-color: #000;
    color: #ccc;
    font-family: 'Courier New', Courier, monospace;
    -webkit-text-size-adjust: none; /* Prevent iOS text scaling */
    -moz-text-size-adjust: none;
    -ms-text-size-adjust: none;
    text-size-adjust: none;
}

#terminal {
    width: 100%;
    height: calc(100vh - 100px); /* Leave space for bottom buttons area */
    padding: 10px 20px 10px 10px; /* More padding on the right */
    position: relative;
    overflow: hidden; /* Let xterm.js handle scrolling */
    box-sizing: border-box;
}

/* Bottom buttons container */
.bottom-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background-color: #000;
    z-index: 999;
}

/* Mobile responsive adjustments */
@media screen and (max-width: 768px) {
    #terminal {
        padding: 5px 15px 5px 5px; /* Keep right padding on mobile */
        height: calc(100vh - 120px); /* More space for mobile bottom buttons */
    }
    
    .bottom-controls {
        height: 120px;
    }
    
    /* Smaller buttons on mobile to prevent overlap */
    #mode-toggle {
        padding: 8px 15px;
        font-size: 11px;
        bottom: 15px;
        left: 15px;
    }
    
    .mode-indicator {
        bottom: 70px;
        left: 15px;
        padding: 6px 12px;
        font-size: 10px;
    }
    
    /* Adjust booking button for mobile to avoid overlap */
    div[id="booking-button"] {
        padding: 12px 20px;
        font-size: 12px;
        bottom: 15px;
        right: 15px;
    }
}

/* Very small screens - extra small buttons */
@media screen and (max-width: 480px) {
    #terminal {
        padding: 5px 10px 5px 5px; /* Slightly less padding on small screens */
        height: calc(100vh - 100px); /* Consistent space for buttons */
    }
    
    .bottom-controls {
        height: 100px;
    }
    
    #mode-toggle {
        padding: 6px 12px;
        font-size: 10px;
        bottom: 10px;
        left: 10px;
    }
    
    .mode-indicator {
        bottom: 60px;
        left: 10px;
        padding: 4px 8px;
        font-size: 9px;
    }
    
    /* Extra small booking button for very small screens */
    div[id="booking-button"] {
        padding: 8px 15px;
        font-size: 10px;
        bottom: 10px;
        right: 10px;
    }
}

/* Override xterm.js styles for better appearance */
.xterm {
    font-feature-settings: "liga" 0;
    position: relative;
    user-select: none;
    -ms-user-select: none;
    -webkit-user-select: none;
    height: 100% !important; /* Fill container */
    width: 100% !important;
}

.xterm.focus,
.xterm:focus {
    outline: none;
}

.xterm .xterm-helpers {
    position: absolute;
    top: 0;
    z-index: 5;
}

.xterm .xterm-helper-textarea {
    padding: 0;
    border: 0;
    margin: 0;
    position: absolute;
    opacity: 0;
    left: -9999em;
    top: 0;
    width: 0;
    height: 0;
    z-index: -5;
    white-space: nowrap;
    overflow: hidden;
    resize: none;
}

.xterm .xterm-screen {
    position: relative;
}

.xterm .xterm-viewport {
    overflow-y: auto !important; /* Enable vertical scrolling */
    overflow-x: hidden !important;
    scrollbar-width: thin;
    scrollbar-color: #333 #000;
}

.xterm .xterm-viewport::-webkit-scrollbar {
    width: 10px;
}

.xterm .xterm-viewport::-webkit-scrollbar-track {
    background: #000;
}

.xterm .xterm-viewport::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 5px;
}

.xterm .xterm-viewport::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Ensure scrollbar appears on page */
body::-webkit-scrollbar {
    width: 12px;
}

body::-webkit-scrollbar-track {
    background: #000;
}

body::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 6px;
}

body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Interactive mode toggle button */
#mode-toggle {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    font-size: 12px;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.4);
    z-index: 1000;
    transition: all 0.3s ease;
    user-select: none;
    font-family: 'Courier New', monospace;
    display: flex;
    align-items: center;
    gap: 8px;
}

#mode-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.6);
}

#mode-toggle.chat-active {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

#mode-toggle.chat-active:hover {
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.6);
}

/* Chat mode indicator */
.mode-indicator {
    position: fixed;
    bottom: 80px;
    left: 20px;
    background: rgba(76, 175, 80, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: bold;
    display: none;
    z-index: 10001;
    font-family: 'Courier New', monospace;
}

.mode-indicator.active {
    display: block;
}

/* Clickable link styles in terminal */
.xterm .xterm-link-layer {
    z-index: 2;
}

.xterm-link {
    text-decoration: underline !important;
    cursor: pointer !important;
}

.xterm-link:hover {
    opacity: 0.8;
    text-decoration: underline !important;
}
