/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    transition: background-color 0.3s ease;
    font-family: 'Courier New', 'Consolas', 'Monaco', monospace;
}

/* ===== Dark Theme ===== */
.dark-theme {
    background-color: #1a1a2e;
}

.dark-theme .terminal {
    background-color: #0d1117;
    border: 1px solid #30363d;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}

.dark-theme .terminal-header {
    background-color: #161b22;
    border-bottom: 1px solid #30363d;
}

.dark-theme .terminal-title {
    color: #8b949e;
}

.dark-theme .terminal-body {
    background-color: #0d1117;
    color: #c9d1d9;
}

.dark-theme .prompt {
    color: #58a6ff;
}

.dark-theme #command-input {
    color: #39d353;
    caret-color: #39d353;
}

.dark-theme .output-line {
    color: #c9d1d9;
}

.dark-theme .output-line.command {
    color: #39d353;
}

.dark-theme .output-line.info {
    color: #58a6ff;
}

.dark-theme .output-line.accent {
    color: #f78166;
}

.dark-theme .output-line.success {
    color: #39d353;
}

.dark-theme .output-line.warning {
    color: #d29922;
}

.dark-theme .output-line.muted {
    color: #8b949e;
}

.dark-theme .theme-toggle {
    color: #8b949e;
    border-color: #30363d;
}

.dark-theme .theme-toggle:hover {
    color: #f0e68c;
    border-color: #58a6ff;
}

/* ===== Light Theme ===== */
.light-theme {
    background-color: #e8e8e8;
}

.light-theme .terminal {
    background-color: #ffffff;
    border: 1px solid #d0d0d0;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
}

.light-theme .terminal-header {
    background-color: #f0f0f0;
    border-bottom: 1px solid #d0d0d0;
}

.light-theme .terminal-title {
    color: #666;
}

.light-theme .terminal-body {
    background-color: #ffffff;
    color: #333;
}

.light-theme .prompt {
    color: #0366d6;
}

.light-theme #command-input {
    color: #22863a;
    caret-color: #22863a;
}

.light-theme .output-line {
    color: #333;
}

.light-theme .output-line.command {
    color: #22863a;
}

.light-theme .output-line.info {
    color: #0366d6;
}

.light-theme .output-line.accent {
    color: #d73a49;
}

.light-theme .output-line.success {
    color: #22863a;
}

.light-theme .output-line.warning {
    color: #b08800;
}

.light-theme .output-line.muted {
    color: #999;
}

.light-theme .theme-toggle {
    color: #666;
    border-color: #d0d0d0;
}

.light-theme .theme-toggle:hover {
    color: #333;
    border-color: #0366d6;
}

/* ===== Terminal Structure ===== */
.terminal {
    width: 90vw;
    max-width: 780px;
    height: 80vh;
    max-height: 560px;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.terminal-header {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    position: relative;
    transition: background-color 0.3s, border-color 0.3s;
}

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

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

.btn-close { background-color: #ff5f56; }
.btn-minimize { background-color: #ffbd2e; }
.btn-maximize { background-color: #27c93f; }

.terminal-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 13px;
    transition: color 0.3s;
}

.theme-toggle {
    position: absolute;
    right: 16px;
    background: none;
    border: 1px solid;
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 14px;
    transition: color 0.3s, border-color 0.3s;
}

.theme-icon {
    font-size: 14px;
}

/* ===== Terminal Body ===== */
.terminal-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

.terminal-body::-webkit-scrollbar {
    width: 6px;
}

.terminal-body::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 3px;
}

.output-line {
    white-space: pre-wrap;
    word-wrap: break-word;
    transition: color 0.3s;
}

.output-line a {
    color: inherit;
    text-decoration: underline;
}

.output-line a:hover {
    opacity: 0.8;
}

/* ===== Input Line ===== */
.input-line {
    display: flex;
    align-items: center;
}

.prompt {
    white-space: nowrap;
    font-size: 14px;
    transition: color 0.3s;
}

#command-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    transition: color 0.3s;
}

/* ===== ASCII Art ===== */
.ascii-art {
    font-size: 12px;
    line-height: 1.2;
}

/* ===== Mobile ===== */
@media (max-width: 600px) {
    .terminal {
        width: 100vw;
        height: 100vh;
        max-height: none;
        border-radius: 0;
    }

    .terminal-body {
        font-size: 13px;
        padding: 10px;
    }

    .prompt {
        font-size: 13px;
    }

    #command-input {
        font-size: 16px; /* prevent iOS zoom on focus */
    }

    .ascii-art {
        font-size: 7px;
        line-height: 1.1;
        letter-spacing: -0.5px;
    }

    .terminal-title {
        font-size: 11px;
    }

    .output-line {
        font-size: 13px;
    }
}

/* Extra small screens */
@media (max-width: 380px) {
    .ascii-art {
        font-size: 5.5px;
    }

    .terminal-body {
        padding: 8px;
    }
}
