/* =========================================
   1. RESET E ESTRUTURA BÁSICA
   ========================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body, html {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* Fonte mais moderna */
  background-color: #f4f4f9;
  height: 100%;
  overflow-x: hidden;
}

.container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  width: 100%;
  max-width: 1000px; /* Limita largura em telas grandes */
  margin: 0 auto;
}

/* =========================================
   2. NOVO CABEÇALHO (Compacto e Flexbox)
   ========================================= */
.main-header {
  background-color: #333;
  color: #fff;
  padding: 10px 20px;
  display: flex;
  justify-content: space-between; /* Texto na esq, User na dir */
  align-items: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* =========================================
   ESTILO DA MARCA (Texto como Logo)
   ========================================= */

/* 1. Logo na Tela de Login (Fundo Branco -> Texto Escuro) */
.brand-logo-login {
    margin-bottom: 25px;
    display: flex;
    flex-direction: column; /* Empilha: Comanda em cima, Online embaixo */
    align-items: center;
    line-height: 1; /* Junta as linhas */
}

.brand-logo-login .brand-primary {
    font-size: 2.5em;
    font-weight: 900; /* Extra Negrito */
    color: #333;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.brand-logo-login .brand-secondary {
    font-size: 2.5em;
    font-weight: 300; /* Fino */
    color: #007bff;   /* Azul do sistema */
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* =========================================
   ESTILO DA MARCA (Texto Justificado / Bloco)
   ========================================= */

/* 1. Logo no Cabeçalho (Painel/Comanda) */
.logo-text {
    display: flex;
    flex-direction: column; /* Empilha um sobre o outro */
    align-items: center; /* Alinha tudo à esquerda */
    justify-content: center;
    line-height: 0.9; /* Aproxima as linhas */
    padding-right: 20px; /* Garante espaço entre o logo e o nome do usuário */
    cursor: default;
}

.logo-top {
    font-size: 1.4em;       /* Tamanho base */
    font-weight: 900;       /* Extra Negrito */
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;    /* Espaçamento normal */
}

.logo-bottom {
    font-size: 0.75em;      /* Fonte menor */
    font-weight: 400;       /* Fonte normal/fina */
    color: #00bfff;         /* Azul ciano ( destaque) ou use #fff se preferir tudo branco */
    text-transform: uppercase;
    
    /* O TRUQUE DO JUSTIFICADO: */
    /* Esticamos as letras de ONLINE para bater com a largura de COMANDA */
    letter-spacing: 5.5px;  
    margin-left: 1px;       /* Pequeno ajuste óptico */
}

/* 2. Logo na Tela de Login (Versão Gigante) */
.brand-logo-login {
    display: flex;
    flex-direction: column;
    align-items: center;    /* No login fica centralizado */
    margin-bottom: 30px;
    line-height: 0.9;
}

.brand-logo-login .brand-primary {
    font-size: 3em;
    font-weight: 900;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.brand-logo-login .brand-secondary {
    font-size: 1.6em;       /* Proporção para casar a largura */
    font-weight: 300;
    color: #007bff;
    text-transform: uppercase;
    letter-spacing: 14px;   /* Estica muito para ficar quadrado */
    margin-left: 8px;       /* Compensa o espaçamento da última letra */
}

.user-controls {
  display: flex;
  align-items: center;
  gap: 15px;
}

#user-display {
  font-size: 0.9em;
  color: #ddd;
}

/* Botão Sair (Exceção ao estilo global de botões) */
.btn-logout-compact {
  background-color: #555;
  color: white;
  border: 1px solid #777;
  padding: 5px 12px !important; /* Força padding pequeno */
  border-radius: 4px;
  font-size: 0.85em !important;
  cursor: pointer;
  width: auto !important;      /* Anula o 100% global */
  max-width: none !important;  /* Anula o max-width global */
  margin: 0 !important;        /* Anula a margem global */
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn-logout-compact:hover {
  background-color: #dc3545;
  border-color: #dc3545;
}

/* =========================================
   ÁREA DE PAGAMENTOS (Múltiplos)
   ========================================= */
.payment-grid {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.pay-item {
    flex: 1;
}

.pay-item label {
    display: block;
    font-size: 0.85em;
    font-weight: bold;
    color: #555;
    margin-bottom: 5px;
}

.pay-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 5px;
    font-size: 1rem;
    text-align: center;
    color: #333;
    transition: border-color 0.2s;
}

.pay-input:focus {
    border-color: #007bff;
    outline: none;
    background-color: #f0f8ff;
}

/* =========================================
   3. RODAPÉ
   ========================================= */
footer {
  background-color: #333;
  color: white;
  text-align: center;
  padding: 15px 0;
  margin-top: auto;
}

footer a {
  color: white;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* =========================================
   4. ESTILOS GERAIS DE BOTÕES E ITENS
   ========================================= */
/* Estilo padrão para botões grandes de ação */
button {
  display: block;
  width: 100%;
  max-width: 300px;
  margin: 20px auto;
  padding: 12px;
  background-color: #007BFF;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1em;
}

button:hover {
  background-color: #0056b3;
}

/* Botões utilitários (Verde/Vermelho) */
.green-button {
  background-color: #28a745;
}
.green-button:hover {
  background-color: #218838;
}

.red-button {
  background-color: #dc3545;
}
.red-button:hover {
  background-color: #c82333;
}

/* Itens de Lista (Perfil/Comanda) */
.profile-item, .order-item {
  background-color: white;
  border: 1px solid #ddd;
  padding: 15px;
  margin: 10px 0;
  border-radius: 8px; /* Mais arredondado */
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05); /* Sombra leve */
  transition: transform 0.1s;
}

.profile-item:hover, .order-item:hover {
  background-color: #f8f9fa;
  border-color: #007bff;
}

/* =========================================
   5. MODAIS
   ========================================= */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px); /* Efeito moderno de desfoque */
}

.modal-content {
  background-color: #fff;
  margin: 5% auto; /* Um pouco mais pra cima */
  padding: 25px;
  border: 1px solid #888;
  width: 90%;
  max-width: 450px;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
  text-align: center;
}

.modal-content h2, .modal-content h3 {
  margin-bottom: 20px;
  color: #333;
}

.modal-content input, .modal-content select {
  width: 100%; /* Ocupa largura total do container */
  box-sizing: border-box; /* Garante que padding não quebre layout */
  margin-bottom: 15px;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 1em;
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  line-height: 20px;
}

.close:hover {
  color: black;
  text-decoration: none;
  cursor: pointer;
}

/* Ajuste Fino para Celular (Header) */
@media (max-width: 480px) {
    .logo-top { font-size: 1.1em; }
    .logo-bottom { font-size: 0.6em; letter-spacing: 4px; }
    
    /* Garante que o nome do usuário não esmague o logo */
    .logo-text { padding-right: 10px; } 
    .payment-grid { flex-direction: column; }
}

/* =========================================
   6. OTIMIZAÇÃO MOBILE (TABELAS E CARDS)
   ========================================= */
@media (max-width: 768px) {
  
  /* Ajuste do Header no celular */
  .logo-text { 
      font-size: 1.0em; /* Logo um pouco menor */
  }
  

  
  #user-display { 
      display: inline-block !important; /* Força exibir o nome */
      font-size: 0.8em; /* Fonte menor */
      margin-right: 5px;
      max-width: 100px; /* Limita largura */
      overflow: hidden; /* Corta se for muito longo */
      text-overflow: ellipsis; /* Põe "..." se cortar */
      white-space: nowrap; 
  }
  
  /* Transforma a Tabela de Comanda em Cartões */
  #order-table thead {
      display: none;
  }

  #order-table tbody tr {
      display: flex;
      flex-wrap: wrap;
      background: #fff;
      margin-bottom: 15px;
      border: 1px solid #ddd;
      border-radius: 8px;
      box-shadow: 0 2px 5px rgba(0,0,0,0.05);
      padding: 10px;
  }

  #order-table tbody td {
      border: none;
      padding: 5px;
      box-sizing: border-box;
  }

  /* Linha 1: Produto (100% largura) */
  #order-table tbody td:nth-child(1) {
      width: 100%;
      order: 1;
      margin-bottom: 5px;
  }
  
  /* Linha 2: Colunas de Valores */
  #order-table tbody td:nth-child(2), 
  #order-table tbody td:nth-child(3), 
  #order-table tbody td:nth-child(4) {
      width: 30%;
      order: 2;
      text-align: center;
  }
  
  /* Botão X */
  #order-table tbody td:nth-child(5) {
      width: 10%;
      order: 2;
      display: flex;
      align-items: flex-end;
      justify-content: center;
      padding-bottom: 10px;
  }

  /* Rótulos falsos acima dos campos */
  #order-table tbody td:nth-child(1)::before { content: "Produto"; display: block; font-size: 0.8em; color: #666; font-weight: bold; }
  #order-table tbody td:nth-child(2)::before { content: "Qtd"; display: block; font-size: 0.8em; color: #666; font-weight: bold; }
  #order-table tbody td:nth-child(3)::before { content: "Vlr. Unt."; display: block; font-size: 0.8em; color: #666; font-weight: bold; }
  #order-table tbody td:nth-child(4)::before { content: "Total"; display: block; font-size: 0.8em; color: #666; font-weight: bold; }

  /* Inputs Mobile */
  .inp-name { padding: 10px; font-weight: bold; border: 1px solid #007bff; background: #f8f9fa; }
  .inp-qtd, .inp-price { text-align: center; padding: 8px; width: 100%; }
}