/* style.css - Completo */

body {
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #f0f0f0;
    padding: 20px;
    margin: 0;
    min-height: 100vh;
    position: relative; /* Necessário para alguns posicionamentos, mas não mais para o rodapé */
    padding-bottom: 60px; /* Espaço reservado para o rodapé fixo */
}

h1 {
    text-align: center;
    color: #333;
    margin-top: 40px;
    margin-bottom: 5px; /* Menos espaço abaixo */
}

/* Estilo para o Subtítulo */
.subtitle {
    text-align: center;
    color: #555;
    font-size: 0.95em;
    margin-bottom: 20px;
}


h2 {
    text-align: center;
    color: #333;
}

/* --- SELETOR DE IDIOMA --- */
.language-selector {
    position: absolute; top: 10px; right: 15px; display: flex; gap: 5px;
}
.language-selector button {
    background: none; border: 2px solid transparent; padding: 3px; cursor: pointer;
    font-size: 1.8em; line-height: 1; border-radius: 4px; transition: border-color 0.2s ease;
}
.language-selector button:hover { border-color: #ccc; }
.language-selector button.active-lang { border-color: #007bff; background-color: rgba(0, 123, 255, 0.1); }
/* --------------------------- */

/* Área Principal da Simulação */
.simulation-area { display: flex; align-items: stretch; justify-content: space-between; width: 90%; max-width: 900px; margin-top: 10px; background-color: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); position: relative; }

/* Dispositivos */
.device { border: 2px solid #ccc; padding: 20px; border-radius: 8px; background-color: #e9e9e9; width: 300px; text-align: center; position: relative; display: flex; flex-direction: column; justify-content: space-between; }
.device h2 { margin-top: 0; margin-bottom: 15px; }
.device label { display: block; margin-top: 10px; margin-bottom: 3px; font-weight: bold; color: #555; text-align: left; }

/* Rótulos TX/RX */
.pin-label { position: absolute; font-weight: bold; color: #555; background-color: #ddd; padding: 2px 5px; border-radius: 3px; border: 1px solid #bbb; font-size: 0.9em; }
#sender .pin-label { right: -25px; top: 50%; transform: translateY(-50%); }
#receiver .pin-label { left: -25px; top: 50%; transform: translateY(-50%); }

/* Input ASCII */
#asciiInput { padding: 8px; border: 1px solid #ccc; border-radius: 4px; font-size: 1.1em; width: calc(100% - 18px); background-color: #e0ffe0; text-align: left; font-family: 'Courier New', Courier, monospace; }

/* Caixas de Preview */
.preview-box { margin-top: 0px; margin-bottom: 10px; padding: 8px; background-color: #fff; border: 1px solid #ccc; border-radius: 4px; font-family: monospace; font-size: 1.1em; min-height: 1.5em; word-wrap: break-word; text-align: center; color: #333; line-height: 1.4; }
#binaryPreview { font-size: 1.0em; white-space: nowrap; overflow-x: auto; scrollbar-width: thin; }
#binaryPreview::-webkit-scrollbar { height: 6px; }
#binaryPreview::-webkit-scrollbar-thumb { background-color: #ccc; border-radius: 3px;}
#receiverScreen.screen { background-color: #e0ffe0; font-family: 'Courier New', Courier, monospace; font-weight: bold; font-size: 1.2em; height: 60px; overflow-y: auto; text-align: left; }

/* Botões de Controle */
.control-buttons { display: flex; justify-content: space-around; gap: 10px; margin-top: 15px; margin-bottom: 5px; }
.control-buttons button { padding: 8px 10px; font-size: 1.3em; line-height: 1; border: none; border-radius: 5px; cursor: pointer; background-color: #2196F3; color: white; transition: background-color 0.3s ease; flex-grow: 1; flex-basis: 0; }
.control-buttons button:hover:not(:disabled) { background-color: #1976D2; }
.control-buttons button:disabled { background-color: #ccc; cursor: not-allowed; }

/* Fio de Comunicação */
.wire-container { flex-grow: 1; display: flex; align-items: center; justify-content: center; padding: 0 30px; position: relative; }
#wire { height: 10px; width: 100%; background-color: #ffcc00; border: 1px solid #999; border-radius: 5px; position: relative; display: flex; align-items: center; justify-content: center; transition: background-color 0.1s ease-in-out; }
#wire.low { background-color: #007bff; } #wire.high { background-color: #ffcc00; }
#bitMarker { position: absolute; background-color: rgba(255, 255, 255, 0.8); padding: 3px 8px; border-radius: 4px; font-size: 0.9em; font-weight: bold; color: #333; border: 1px solid #ccc; white-space: nowrap; }

/* Fio Terra */
.ground-wire { position: absolute; bottom: 30px; left: 5%; width: 90%; height: 4px; background-color: #3b2b0a; border-radius: 2px; }
.ground-label { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); font-size: 0.8em; color: #3b2b0a; }

/* Rótulos e Estados no Receptor */
#receivedBitsLabel, #interpretedDataLabel, #receiverScreenLabel { margin-top: 10px; font-weight: bold; color: #555; text-align: left; }

/* Indicadores de Estado */
#senderState, #receiverState { margin-top: 10px; font-style: italic; color: #666; font-size: 0.9em; text-align: center; }

/* --- OSCILOSCÓPIO --- */
#oscilloscope { width: 90%; max-width: 1000px; margin-top: 40px; margin-bottom: 20px; padding: 20px; background-color: #fff; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); text-align: center; }
#oscilloscopeCanvas { border: 1px solid #aaa; background-color: #fdfdfd; margin-top: 10px; max-width: 100%; height: auto; display: inline-block; }

/* --- ESTILOS PARA HIGHLIGHTS --- */
#binaryPreview span { display: inline-block; transition: color 0.1s, font-weight 0.1s; }
#binaryPreview span.highlighted-bit { color: red; font-weight: bold; }
#binaryPreview span.separator { color: #999; font-weight: normal; margin: 0 0.2em; }
#receivedData span { display: inline-block; transition: color 0.1s, font-weight 0.1s; }
#receivedData span.highlighted-received-bit { color: red; font-weight: bold; }

/* --- RODAPÉ (MODIFICADO position e adicionado background) --- */
.footer {
    position: fixed; /* <<<<<<< ALTERADO PARA FIXED */
    bottom: 0;      /* <<<<<<< Alinha na base da janela */
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 0.9em;
    color: #666;
    padding: 10px 0;
    background-color: #f0f0f0; /* <<<<<<< Adiciona cor de fundo (mesma do body) */
    border-top: 1px solid #ddd; /* <<<<<<< Linha sutil para separar */
    z-index: 10; /* Garante que fique sobre outros elementos se necessário */
}
.footer a { color: #007bff; text-decoration: none; }
.footer a:hover { text-decoration: underline; }
/* ------------- */