/* Live Terminal Styles */
.terminal-wrapper {
    width: 100%;
    max-width: 500px;
    background: #1e1e1e;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 350px;
    /* Fixed height as requested */
    box-sizing: border-box;
    transition: height 0.6s cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 0.5s ease;
    /* transform removed from transition to prevent layout glitches during resize */
    border: 1px solid #333;
    margin: 0 auto;
    transform-origin: top center;
    flex-shrink: 0;
}

/* Minimized State */
.terminal-wrapper.closed {
    height: 42px;
    /* Fixed height for header */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.terminal-wrapper.closed .terminal-body,
.terminal-wrapper.closed .terminal-footer {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.terminal-body,
.terminal-footer {
    transition: opacity 0.5s ease 0.1s;
    /* Slight delay when opening */
}

.terminal-wrapper.closed:hover {
    opacity: 1;
}

/* Header */
.terminal-header {
    background: #2d2d2d;
    padding: 12px 15px;
    /* Increase padding slightly */
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #333;
    cursor: pointer;
    height: 42px;
    flex: 0 0 42px;
    /* CRITICAL: Prevent shrinking/growing */
    box-sizing: border-box;
}

.traffic-lights {
    display: flex;
    gap: 8px;
}

.light {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.light.red {
    background: #ff5f56;
}

.light.yellow {
    background: #ffbd2e;
}

.light.green {
    background: #27c93f;
}

/* Removed Title Styles (Title removed from HTML) */

.terminal-toggle-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    transition: color 0.2s;
    padding: 0;
    line-height: 1;
}

.terminal-toggle-btn:hover {
    color: #fff;
}

/* Body */
.terminal-body {
    background: #0d1117;
    padding: 15px;
    flex: 1 1 auto;
    /* Grow and shrink to fill space */
    height: calc(100% - 127px);
    /* CRITICAL: Explicitly limit height to available space (350 - 42 - 85) */
    min-height: 0;
    /* CRITICAL: Allows flex item to shrink below content size, enabling scroll */
    overflow-y: hidden;
    /* No scrollbar as requested, JS handles scrolling */
    color: #c9d1d9;
    font-size: 13px;
    line-height: 1.5;
    /* 19.5px per line */
    position: relative;
}

#terminal-content {
    /* Ensure content wrapper doesn't force height */
    max-height: 100%;
}

/* Footer Container */
.terminal-footer {
    background: #0d1117;
    padding: 12px 15px;
    border-top: 1px solid #1f2428;
    height: 85px;
    /* Fixed height reserved for buttons */
    flex: 0 0 85px;
    /* CRITICAL: Prevent shrinking/growing */
    display: flex;
    align-items: flex-start;
    /* Start from top to prevent centering if only 1 line */
    gap: 10px;
    flex-wrap: wrap;
    z-index: 10;
    box-sizing: border-box;
    overflow: hidden;
}

.terminal-line {
    margin-bottom: 8px;
    display: block;
    min-height: 1.5em;
    /* Prevent jumpiness */
}

/* Colors for syntax highlighting simulation */
.text-green {
    color: #7ee787;
}

.text-blue {
    color: #79c0ff;
}

.text-purple {
    color: #d2a8ff;
}

.text-yellow {
    color: #f2cc60;
}

.text-comment {
    color: #8b949e;
    font-style: italic;
}

.terminal-options,
.terminal-pause-menu {
    display: flex;
    flex-direction: column;
    /* Stacked */
    gap: 6px;
    width: 100%;
    align-items: stretch;
}

.terminal-option-btn {
    background: rgba(56, 139, 253, 0.1);
    border: 1px solid rgba(31, 111, 235, 0.4);
    color: #58a6ff;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.terminal-option-btn:hover {
    background: rgba(56, 139, 253, 0.2);
    border-color: #58a6ff;
    color: #fff;
    transform: translateX(4px);
    box-shadow: 0 0 12px rgba(88, 166, 255, 0.2);
}

.terminal-option-btn:active {
    transform: translateX(2px) scale(0.98);
}

/* Cursor */
.cursor {
    display: inline-block;
    width: 8px;
    height: 15px;
    background: #c9d1d9;
    animation: blink 1s step-end infinite;
    vertical-align: middle;
    margin-left: 2px;
}

.terminal-wrapper.paused .cursor {
    background: #ffbd2e;
    /* Yellow cursor when paused */
    animation: none;
    opacity: 0.5;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* Scrollbar within terminal */
.terminal-body::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}