/* WebOS/400 - Terminal Styles - 5250 Terminal Emulation */

.terminal {
    width: 100%;
    height: 100%;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: var(--font-size-base);
    line-height: var(--line-height);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Wrapper para permitir escala da tela sem alterar layout externo */
.terminal-screen-wrap {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: hidden;
    width: 100%;
}

.terminal-screen {
    /* Fixar células em tamanho de caractere para evitar esticamento em telas grandes */
    width: fit-content;
    height: fit-content;
    margin: 0 auto; /* centraliza horizontalmente */
    font-family: var(--font-mono);
    font-size: 24px;
    line-height: 1.2;
    padding: 0;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    position: relative;
    display: grid;
    grid-template-rows: repeat(24, 1.2em);
    grid-template-columns: repeat(80, 1ch);
    gap: 0;
    box-sizing: border-box;
}

.terminal-char {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1ch;
    height: 1.2em;
    font-family: var(--font-mono);
    font-size: 24px;
    line-height: 1.2;
    letter-spacing: normal;
    margin: 0;
    padding: 0;
    white-space: pre;
    box-sizing: border-box;
}

.terminal-char.cursor {
    background-color: var(--text-primary);
    color: var(--bg-primary);
    animation: cursor-blink 1s infinite;
}

.terminal-char.reverse {
    background-color: var(--text-primary);
    color: var(--bg-primary);
}

.terminal-char.underline {
    border-bottom: 1px solid var(--text-primary);
}

.terminal-char.blink {
    animation: text-blink 1s infinite;
}

/* Field Attributes */
.field-normal {
    color: var(--color-green);
}

.field-high-intensity {
    color: var(--color-white);
    font-weight: bold;
}

.field-reverse {
    background-color: var(--text-primary);
    color: var(--bg-primary);
}

.field-underline {
    border-bottom: 1px solid var(--text-primary);
}

.field-blink {
    animation: text-blink 1s infinite;
}

.field-non-display {
    color: transparent;
}

/* Color Attributes */
.color-green { color: var(--color-green); }
.color-white { color: var(--color-white); }
.color-red { color: var(--color-red); }
.color-turquoise { color: var(--color-turquoise); }
.color-yellow { color: var(--color-yellow); }
.color-pink { color: var(--color-pink); }
.color-blue { color: var(--color-blue); }

/* Input Fields */
.input-field {
    background-color: rgba(0, 136, 204, 0.2);
    border: 1px solid var(--accent-color);
    outline: none;
    color: var(--color-white);
    font-family: var(--font-mono);
    font-size: 18px;
    padding: 2px 4px;
    margin: 0;
    display: inline-block;
    vertical-align: baseline;
}

.input-field:focus {
    background-color: var(--accent-color);
    color: var(--color-white);
}

.cursor-blink {
    background-color: var(--text-primary);
    color: var(--bg-primary);
    animation: cursor-blink 1s infinite;
}

/* Menu Styles */
.menu-bar {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    position: absolute;
    z-index: 1000;
}

.menu-item {
    padding: 4px 8px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
}

.menu-item:hover {
    background-color: var(--accent-color);
    color: var(--color-white);
}

.menu-item.selected {
    background-color: var(--text-primary);
    color: var(--bg-primary);
}

/* Function Key Bar */
.function-keys {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 4px 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 6px; /* row gap, column gap */
    align-content: flex-start;
    font-size: 11px;
}

.function-key {
    padding: 2px 4px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    min-width: 48px;
    text-align: center;
}

.function-key:hover {
    background-color: var(--accent-color);
    color: var(--color-white);
}

.function-key.active {
    background-color: var(--text-primary);
    color: var(--bg-primary);
}

/* Internal Terminal Status Bar (inside terminal component) */
.term-status-bar {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 6px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 28px;
    font-size: 12px;
}

.term-status-text {
    color: var(--text-secondary);
}

.term-cursor-pos {
    color: var(--color-yellow);
    font-weight: bold;
}

/* Status types for status text */
.term-status-text.status-info {
    color: var(--text-secondary);
}

.term-status-text.status-warning {
    color: var(--color-yellow);
    font-weight: bold;
}

.term-status-text.status-error {
    color: var(--color-red);
    font-weight: bold;
}

/* Animations */
@keyframes cursor-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

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

/* Window Styles */
.window {
    position: absolute;
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-color);
    box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.5);
    z-index: 100;
}

.window-title {
    background-color: var(--accent-color);
    color: var(--color-white);
    padding: 4px 8px;
    font-weight: bold;
    border-bottom: 1px solid var(--border-color);
}

.window-content {
    padding: 8px;
}
