body {
    font-family: Arial, sans-serif;
    margin: 0;
    background-color: #f0f0f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 0 !important; /* Garante que não haja padding-top no body */
}

/* O h1 original parece ser um título secundário ou de seção agora. */
/* Se este for o H1 "Encomendas", ele será sobreposto por .main-page-title. */
h1 {
    text-align: center;
    margin-bottom: 20px;
}

/* Título principal após a barra de status fixa */
.main-page-title {
    margin-top: 60px; /* Margem superior para o título não ficar escondido */
    margin-bottom: 20px;
    text-align: center;
    width: 100%; /* Para centralizar corretamente em colunas flex */
}

#status { /* Mantenha se você ainda usa este ID */
    text-align: center;
    margin-bottom: 20px;
}

.button-container {
    display: flex;
    justify-content: center;
    gap: 40px; /* Espaçamento entre os botões */
    margin-bottom: 20px;
}

button {
    width: 100px;
    height: 40px;
    font-size: 18px;
    background-color: #82a3bb;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

button:hover {
    background-color: #3367d6;
}

iframe {
    width: 100%;
    height: 600px;
    border: none;
}

#feedback {
    margin-top: 20px;
}

#entregaBtn {
    padding: 15px 30px;
    font-size: 18px;
    background-color: #e92a2a;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    margin: 15px;
    width: 350px;
    max-width: 90%;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

#entregaBtn:hover {
    background-color: #45a049;
    transform: scale(1.02);
}

#entregaBtn.cancel {
    background-color: #f44336;
}

#entregaBtn.cancel:hover {
    background-color: #d32f2f;
}

#entregaBtn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.status-content { /* Mantenha se ainda usa para algo */
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

#status-icon-mqtt,
#status-icon-equip { /* Mantenha se ainda usa para algo */
    font-size: 14px;
    margin-right: 8px;
}

#equipment-gif { /* Mantenha se ainda usa para algo */
    position: absolute;
    right: 0;
    width: 50px;
    height: 50px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin-left: auto;
    font-size: 20px;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}
/* --- FIM: ESTILOS GERAIS --- */


/* --- INÍCIO: ESTILOS PARA A BARRA DE STATUS (status-line e status-box) --- */

.status-line {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    background-color: #e0e0e0;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    padding: 8px 0;
    box-sizing: border-box;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    gap: 10px; /* Espaço entre os itens (incluindo o novo ícone) */
    min-height: 50px;
    flex-wrap: nowrap !important; /* CRÍTICO: Força os itens a NÃO QUEBRAREM LINHA */
}

/* Novo estilo para o botão/quadrado do ícone de menu */
.menu-icon-box {
    width: 40px; /* Largura do quadrado */
    min-width: 40px; /* Garante que não encolha demais */
    height: 40px; /* Altura do quadrado */
    background-color: white; /* Cor de fundo, similar aos status-box */
    border-radius: 5px; /* Cantos arredondados, similar aos status-box */
    box-shadow: 0 1px 2px rgba(0,0,0,0.1); /* Sombra suave */
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: #555; /* Cor do ícone */
    font-size: 24px; /* Tamanho do ícone */
    transition: background-color 0.2s, color 0.2s; /* Transição para hover */
}

.menu-icon-box:hover {
    background-color: #f0f0f0; /* Mudar cor de fundo no hover */
    color: #333; /* Escurecer ícone no hover */
}


.status-box {
    flex-grow: 1;
    flex-shrink: 1;
    flex-basis: auto;
    margin: 0;
    padding: 8px;
    border-radius: 5px;
    text-align: center;
    font-size: 0.9em;
    white-space: nowrap !important;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    min-height: 35px;
}

.status-box p {
    margin: 0;
    line-height: 1.2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    white-space: nowrap !important;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Consolidando e unificando as regras de cores para status */
.status-box.status-ok {
    background-color: #28a745;
    color: white;
}

.status-box.status-blue {
    background-color: #007bff;
    color: white;
}

.status-box.status-warning {
    background-color: #ffc107;
    color: #333;
}

.status-box.status-disconnected,
.status-box.status-offline {
    background-color: #dc3545;
    color: white;
}

.status-box.status-error {
    background-color: #6c757d;
    color: white;
}

.status-box.status-loading {
    background-color: white;
    color: #555;
    border: 1px solid #ccc;
}

/* Remover quaisquer estilos de ícones ou texto que possam conflitar com .status-box */
.status-icon { /* Mantenha se ainda usa para algo */
    font-size: 10px;
    margin-right: 6px;
}
.status-text { /* Mantenha se ainda usa para algo */
    white-space: nowrap;
}

/* --- INÍCIO: MEDIA QUERY PARA TELAS MENORES (CELULARES) --- */
@media (max-width: 768px) {
    .status-line {
        padding: 5px 0;
        flex-wrap: nowrap !important;
    }

    .menu-icon-box { /* Ajuste para o ícone de menu em telas menores */
        width: 35px;
        min-width: 35px;
        height: 35px;
        font-size: 20px;
    }

    .status-box {
        /* Ajuste para que 3 itens (ícone de menu + 2 status-box) caibam na linha */
        /* Largura restante = 100% - largura do menu-icon-box - 2 * gap */
        /* Cada status-box = (Largura restante) / 2 */
        max-width: calc((100% - 35px - 20px) / 2) !important; /* 35px = width do menu-icon-box, 20px = 2*gap */
        min-width: 90px !important; /* Reduzido min-width para encaixar melhor em celulares pequenos */
        padding: 5px !important;
        font-size: 0.65em !important; /* Fonte menor para caber texto */
        flex-basis: 0 !important;
    }
}

/* --- INÍCIO: ESTILOS GERAIS (Mantenha o que você já tem) --- */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    background-color: #f0f0f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 0 !important;
}

.status-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 10px 15px;
    background-color: #e0e0e0;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 999; /* Ajustado para ser menor que o menu e overlay */
    box-sizing: border-box;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    gap: 10px;
    min-height: 50px;
    flex-wrap: nowrap !important;
}

.menu-icon-box {
    width: 40px;
    min-width: 40px;
    height: 40px;
    background-color: white;
    border-radius: 5px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: #555;
    font-size: 24px;
    transition: background-color 0.2s, color 0.2s;
}

.menu-icon-box:hover {
    background-color: #f0f0f0;
    color: #333;
}

.status-box {
    flex-grow: 1;
    flex-shrink: 1;
    flex-basis: auto;
    margin: 0;
    padding: 8px;
    border-radius: 5px;
    text-align: center;
    font-size: 0.9em;
    white-space: nowrap !important;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    min-height: 35px;
}

.status-box p {
    margin: 0;
    line-height: 1.2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    white-space: nowrap !important;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ... (seus estilos para .status-box.status-ok, .status-box.status-blue, etc.) ... */

/* --- INÍCIO: ESTILOS PARA O MENU LATERAL --- */
.side-menu {
    height: 100%; /* Ocupa a altura total da viewport */
    width: 250px; /* Largura padrão do menu */
    position: fixed; /* Fixado na tela */
    z-index: 1001; /* Fica acima de todos os outros elementos */
    top: 0;
    left: 0; /* Posição inicial no lado esquerdo */
    background-color: #f8f9fa; /* Fundo claro para o menu */
    overflow-x: hidden; /* Esconde conteúdo que transborda horizontalmente */
    transition: transform 0.5s ease-in-out; /* Animação suave de deslizamento */
    transform: translateX(-100%); /* Inicialmente, o menu está fora da tela (escondido) */
    padding-top: 110px; /* Espaço para o cabeçalho do menu, abaixo da status-line */
    box-shadow: 2px 0 5px rgba(0,0,0,0.2); /* Sombra para dar profundidade */
}

/* Classe para mostrar o menu */
.side-menu.open {
    transform: translateX(0); /* Desliza o menu para dentro da tela */
}

.side-menu .menu-header {
    padding: 15px 25px;
    background-color: #007bff; /* Fundo azul para o cabeçalho do menu */
    color: white;
    font-size: 1.2em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: absolute; /* Para manter o cabeçalho no topo mesmo com padding-top */
    top: 0;
    width: 100%;
    box-sizing: border-box;
}

.side-menu ul {
    list-style-type: none; /* Remove os marcadores da lista */
    padding: 0;
    margin: 0;
}

.side-menu li a {
    padding: 15px 25px;
    text-decoration: none;
    font-size: 1.1em;
    color: #333;
    display: block; /* Ocupa a largura total para facilitar o clique */
    transition: 0.3s; /* Transição para o hover */
    border-bottom: 1px solid #eee; /* Linha divisória entre os itens */
}

.side-menu li a:hover {
    background-color: #e9ecef; /* Fundo mais claro no hover */
    color: #007bff; /* Cor do texto azul no hover */
}

/* --- INÍCIO: ESTILOS PARA O OVERLAY --- */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5); /* Semi-transparente preto */
    z-index: 1000; /* Fica abaixo do menu, mas acima do restante do conteúdo */
    display: none; /* Escondido por padrão */
    transition: opacity 0.5s; /* Animação suave de opacidade */
    opacity: 0; /* Inicia transparente */
}

/* Classe para mostrar o overlay */
.overlay.visible {
    display: block; /* Mostra o overlay */
    opacity: 1; /* Torna-o visível */
}

/* --- FIM: ESTILOS PARA O MENU LATERAL E OVERLAY --- */


/* --- INÍCIO: MEDIA QUERY PARA TELAS MENORES (CELULARES) --- */
@media (max-width: 768px) {
    .status-line {
    padding: 5px 0;
    flex-wrap: nowrap !important;
}

.menu-icon-box {
    width: 35px;
    min-width: 35px;
    height: 35px;
    font-size: 20px;
}

.status-box {
    max-width: calc((100% - 35px - 20px) / 2) !important; /* 35px = width do menu-icon-box, 20px = 2*gap */
    min-width: 90px !important;
    padding: 5px !important;
    font-size: 0.65em !important;
    flex-basis: 0 !important;
}
}

/* CSS para o side-menu */
.side-menu {
    /* ... (seus estilos existentes) ... */
    transform: translateX(-100%); /* Estado inicial: oculto */
    transition: transform 0.5s ease-in-out; /* Adicionei para garantir a transição */
}

.side-menu.open {
    transform: translateX(0); /* Estado aberto: visível */
}

/* CSS para o overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* Cor preta semi-transparente */
    z-index: 1000; /* Deve estar abaixo do side-menu (z-index: 1001) */
    opacity: 0;
    visibility: hidden; /* Oculta inicialmente */
    transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
}

.overlay.visible {
    opacity: 1;
    visibility: visible; /* Torna visível */
}

.logo-encomendas {
    max-width: 200px;        /* Ajuste o tamanho conforme necessário */
    max-height: 60px;        /* Altura máxima */
    width: auto;             /* Mantém proporção */
    height: auto;            /* Mantém proporção */
    object-fit: contain;     /* Garante que a imagem não distorça */
}

/* Para telas menores (responsivo) */
@media (max-width: 768px) {
    .logo-encomendas {
        max-width: 450px;
        max-height: 135px;
    }
}

@media (max-width: 480px) {
    .logo-encomendas {
        max-width: 120px;
        max-height: 35px;
    }
}