/* =========================================================
    APP.CSS - ESTILO GLOBAL (CUSTOMIZADO)
========================================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --cor-primaria: #0f172a;
    --cor-secundaria: #1e293b;
    --cor-terciaria: #334155;
    --cor-azul: #2563eb;
    --cor-azul-hover: #1d4ed8;
    --cor-verde: #10b981;
    --cor-vermelha: #ef4444;
    --cor-branca: #ffffff;
    --cor-texto: #e2e8f0;
    --cor-borda: #475569;
    --shadow: 0 10px 25px rgba(0, 0, 0, .25);
}

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f172a, #111827, #1e293b);
    color: var(--cor-texto);
    min-height: 100vh;
    padding: 20px;
}

main {
    width: 100%;
    max-width: 1800px;
    margin: auto;
}

h1, h2, h3 {
    font-weight: 700;
}

button {
    cursor: pointer;
    transition: .2s;
}

input, select, textarea, button {
    font-family: inherit;
}

.card {
    background: rgba(15, 23, 42, .85);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.titulo-pagina {
    font-size: 2rem;
    margin-bottom: 20px;
    text-align: center;
    color: white;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.titulo-pagina i {
    color: var(--cor-azul);
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 999px;
}

::-webkit-scrollbar-track {
    background: #0f172a;
}

/* =========================================================
    FORM.CSS
========================================================= */
.formulario-container {
    padding: 25px;
}

.dados-gerais {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
    margin-bottom: 25px;
}

.campo {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.campo label {
    font-size: .92rem;
    font-weight: 600;
    color: #cbd5e1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input {
    width: 100%;
    border: none;
    outline: none;
    padding: 12px 14px;
    border-radius: 12px;
    background: #1e293b;
    color: white;
    border: 1px solid #334155;
    transition: .2s;
}

.input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .25);
}

.input::placeholder {
    color: #94a3b8;
}

.grupo-botoes-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.grupo-botoes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: #111827;
    padding: 6px;
    border-radius: 12px;
    border: 1px solid #334155;
    min-height: 48px;
    align-items: center;
}

.botao-opcao {
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #94a3b8;
    font-weight: 700;
    font-size: 0.85rem;
    transition: all 0.15s;
    flex-grow: 1;
    text-align: center;
    white-space: nowrap;
}

.botao-opcao:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.botao-opcao.ativo,
.botao-opcao.selecionado {
    background: #2563eb;
    color: white;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.botao-submit {
    width: 100%;
    border: none;
    padding: 16px;
    border-radius: 14px;
    background: #2563eb;
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    margin-top: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.botao-submit:hover {
    background: #1d4ed8;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.section-title {
    margin: 30px 0 18px;
    font-size: 1.25rem;
    color: white;
    border-left: 4px solid var(--cor-azul);
    padding-left: 10px;
    text-transform: uppercase;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* =========================================================
    TABELA.CSS
========================================================= */
.table-wrapper {
    width: 100%;
    overflow: auto;
    border-radius: 18px;
    border: 1px solid #334155;
    margin-bottom: 15px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1200px;
    background: #0f172a;
}

thead {
    background: #1e293b;
}

th {
    padding: 14px;
    text-align: center;
    font-size: .9rem;
    color: #cbd5e1;
    border-bottom: 1px solid #334155;
    white-space: nowrap;
    text-transform: uppercase;
    font-weight: 700;
}

td {
    padding: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, .05);
    vertical-align: middle;
    position: relative;
}

tbody tr:hover {
    background: rgba(255, 255, 255, .03);
}

.input-tabela {
    width: 100%;
    border: none;
    outline: none;
    padding: 10px;
    border-radius: 10px;
    background: #1e293b;
    color: white;
    border: 1px solid #334155;
    transition: .2s;
}

.input-tabela:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .25);
}

.input-tabela[readonly] {
    background: #0f172a;
    color: #64748b;
    border-color: rgba(255, 255, 255, 0.05);
    cursor: not-allowed;
}

.btn-add {
    margin-top: 10px;
    padding: 12px 18px;
    border: none;
    border-radius: 12px;
    background: var(--cor-verde);
    color: white;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-add:hover {
    background: #059669;
}

.btn-delete {
    background: none;
    border: none;
    color: var(--cor-vermelha);
    padding: 8px;
    font-size: 1.1rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    width: 36px;
    height: 36px;
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* =========================================================
    AUTOCOMPLETE (DESIGN REVISADO PARA TEMA ESCURO)
========================================================= */
.autocomplete-wrapper {
    position: relative;
    width: 100%;
}

.sugestoes {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 99999; /* Fica acima de qualquer elemento da tabela */
    background: #1e293b; /* Fundo escuro idêntico aos inputs */
    border: 1px solid #475569; /* Borda visível no tema escuro */
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    max-height: 200px;
    overflow-y: auto;
}

.sugestao-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, .05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #ffffff; /* Texto do produto perfeitamente branco */
    background: #1e293b;
    transition: background 0.15s;
}

.sugestao-item:hover,
.sugestao-item.selected {
    background: #334155; /* Destaque cinza azulado ao passar o mouse */
    color: white;
    font-weight: 600;
}

.sugestao-item .sugestao-badge {
    font-size: 0.75rem;
    background: #475569; /* Fundo do código do produto */
    padding: 2px 6px;
    border-radius: 4px;
    color: #cbd5e1; /* Texto do código claro */
    font-family: monospace;
    font-weight: bold;
}

/* =========================================================
    OUTROS COMPONENTES
========================================================= */
.grid-velocidades-tabela {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

.grid-velocidades-tabela th {
    padding: 10px;
    font-size: 0.85rem;
}

.grid-velocidades-tabela td {
    padding: 6px;
}

@media(max-width: 1200px) {
    body { padding: 12px; }
    .formulario-container { padding: 18px; }
    .titulo-pagina { font-size: 1.7rem; }
}

@media(max-width: 768px) {
    .dados-gerais { grid-template-columns: 1fr; }
    .grupo-botoes { justify-content: flex-start; }
    .botao-opcao { flex: 1; }
    table { min-width: 900px; }
    .btn-add { width: 100%; justify-content: center; }
}

.keyboard-info-bar {
    background-color: rgba(37, 99, 235, 0.15);
    border: 1px solid rgba(37, 99, 235, 0.3);
    border-radius: 12px;
    padding: 10px 15px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.85rem;
    color: #93c5fd;
    flex-wrap: wrap;
}

.keyboard-key {
    background: #1e293b;
    border: 1px solid #475569;
    border-bottom: 2px solid #3b82f6;
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: bold;
    color: white;
}

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #1e293b;
    border: 1px solid #334155;
    border-left: 6px solid #10b981;
    padding: 12px 20px;
    border-radius: 10px;
    color: white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
}

.toast-container.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-container.erro {
    border-left-color: #ef4444;
}