/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #0a0a0a;
    font-family: 'Fira Code', monospace;
    overflow: hidden;
    height: 100vh;
    margin: 0;
    padding: 20px;
}

/* Terminal container */
.terminal {
    width: 80vw;
    height: 70vh;
    max-width: none;
    min-width: 400px;
    min-height: 300px;
    background: #1a1a1a;
    border-radius: 8px;
    box-shadow: 0 20px 40px rgba(0, 255, 0, 0.1);
    overflow: hidden;
    border: 1px solid #333;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    resize: both;
    user-select: none;
    transition: all 0.2s ease;
}

.terminal:hover {
    box-shadow: 0 25px 50px rgba(0, 255, 0, 0.15);
}

.terminal.dragging {
    user-select: none;
    cursor: move;
    transition: none;
}

.terminal.maximized {
    border-radius: 0;
    resize: none;
}

/* Terminal header */
.terminal-header {
    background: #2d2d2d;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #333;
    cursor: move;
    user-select: none;
}

.terminal-header:hover {
    background: #333;
}

.terminal-buttons {
    display: flex;
    gap: 8px;
    margin-right: 15px;
}

.btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s ease;
}

.btn:hover {
    transform: scale(1.1);
}

.close { 
    background: #ff5f56; 
}
.close:hover {
    background: #ff3b30;
}

.minimize { 
    background: #ffbd2e; 
}
.minimize:hover {
    background: #ff9500;
}

.maximize { 
    background: #27ca3f; 
}
.maximize:hover {
    background: #30d158;
}

.terminal-title {
    color: #c0c0c0;
    font-size: 13px;
    font-weight: 500;
}

/* Terminal body */
.terminal-body {
    height: calc(100% - 43px);
    padding: 20px;
    background: #000;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Terminal output */
#terminal-output {
    flex: 1;
    overflow-y: auto;
    color: #00ff00;
    font-size: 14px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.welcome-message {
    color: #00ff00;
    margin-bottom: 20px;
}

.command-line {
    margin-bottom: 5px;
}

.command {
    color: #00ff00;
}

.output {
    color: #00ff00;
    margin: 10px 0;
    padding-left: 0;
}

.error {
    color: #ff6b6b;
}

.success {
    color: #51cf66;
}

.info {
    color: #74c0fc;
}

/* Terminal input */
.terminal-input-line {
    display: flex;
    align-items: center;
    margin-top: 10px;
    position: relative;
}

.prompt {
    color: #00ff00;
    font-weight: 500;
    white-space: nowrap;
}

#terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #00ff00;
    font-family: 'Fira Code', monospace;
    font-size: 14px;
    margin-left: 5px;
    caret-color: transparent; /* Hide default cursor */
}

.cursor {
    color: #00ff00;
    animation: blink 1s infinite;
    position: absolute;
    pointer-events: none;
    font-family: 'Fira Code', monospace;
    font-size: 14px;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Scrollbar */
#terminal-output::-webkit-scrollbar {
    width: 8px;
}

#terminal-output::-webkit-scrollbar-track {
    background: #1a1a1a;
}

#terminal-output::-webkit-scrollbar-thumb {
    background: #00ff00;
    border-radius: 4px;
}

#terminal-output::-webkit-scrollbar-thumb:hover {
    background: #00cc00;
}

/* Responsive design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .terminal {
        width: 95vw;
        height: 90vh;
        min-width: 300px;
        min-height: 250px;
        position: relative;
        top: auto;
        left: auto;
        transform: none;
    }
    
    .terminal-header {
        padding: 8px 12px;
    }
    
    .terminal-title {
        font-size: 12px;
    }
    
    .btn {
        width: 10px;
        height: 10px;
    }
    
    #terminal-output, #terminal-input {
        font-size: 12px;
    }
    
    .terminal-body {
        padding: 10px;
    }
    
    .terminal-label {
        width: 100px;
        padding-right: 10px;
    }
    
    .prompt {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .terminal {
        width: 98vw;
        height: 95vh;
        min-width: 280px;
    }
    
    .terminal-header {
        padding: 6px 10px;
    }
    
    .terminal-title {
        font-size: 11px;
    }
    
    .btn {
        width: 8px;
        height: 8px;
    }
    
    #terminal-output, #terminal-input {
        font-size: 11px;
    }
    
    .terminal-body {
        padding: 8px;
    }
    
    .terminal-label {
        width: 80px;
        padding-right: 8px;
    }
    
    .welcome-message pre {
        font-size: 10px;
    }
}

/* Selection styling */
::selection {
    background: #00ff0044;
}

/* Resize handle */
.terminal::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 15px;
    height: 15px;
    background: linear-gradient(-45deg, 
        transparent 0%, 
        transparent 40%, 
        #555 40%, 
        #555 50%, 
        transparent 50%, 
        transparent 60%, 
        #555 60%, 
        #555 70%, 
        transparent 70%
    );
    cursor: nw-resize;
    z-index: 10;
}

/* Focus states */
#terminal-input:focus {
    outline: none;
}

/* ASCII art and special formatting */
.ascii-art {
    color: #00ff00;
    font-size: 12px;
    line-height: 1.2;
}

.file-list {
    color: #00ff00;
    margin: 10px 0;
}

.file-list .directory {
    color: #74c0fc;
    font-weight: bold;
}

.file-list .executable {
    color: #51cf66;
    font-weight: bold;
}

.help-command {
    color: #ffec99;
    font-weight: 500;
}

.help-description {
    color: #c0c0c0;
    margin-left: 20px;
}

/* Link styling */
a {
    color: #74c0fc;
    text-decoration: underline;
    transition: color 0.2s ease;
}

a:hover {
    color: #51cf66;
    text-decoration: none;
}

a:visited {
    color: #9775fa;
}

/* Terminal table for aligned output */
.terminal-table {
    display: table;
    margin: 10px 0;
}

.terminal-row {
    display: table-row;
}

.terminal-label {
    display: table-cell;
    padding-right: 15px;
    vertical-align: top;
    width: 120px;
}

.terminal-value {
    display: table-cell;
    vertical-align: top;
}
