/* ==========================================================================
   Sistema de Pedidos Web - Estilos Mobile-First
   Base: 320px | Breakpoints: 480px, 768px, 1024px
   ========================================================================== */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  line-height: 1.5;
  color: #1a1a2e;
  background-color: #f8f9fa;
  min-width: 320px;
  padding-bottom: 3rem;
}

/* ---------- Acessibilidade ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Header ---------- */
.app-header {
  background-color: #16213e;
  color: #ffffff;
  padding: 0.75rem 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
}

.app-title {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* ---------- Seções ---------- */
.secao {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 1rem;
}

.secao h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #16213e;
}

/* ---------- Formulários / Campos ---------- */
.campo {
  margin-bottom: 1rem;
}

.campo label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
  color: #333;
}

.campo input,
.campo select {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1.5px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 1rem;
  color: #1a1a2e;
  background-color: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.campo input:focus,
.campo select:focus {
  outline: none;
  border-color: #4361ee;
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

.campo-invalido {
  border-color: #e63946 !important;
  box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.12) !important;
}

/* ---------- Controles do Cardápio ---------- */
.cardapio-controles {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.campo-busca,
.campo-filtro {
  width: 100%;
}

.campo-busca input,
.campo-filtro select {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1.5px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  background-color: #fff;
  color: #1a1a2e;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.campo-busca input:focus,
.campo-filtro select:focus {
  outline: none;
  border-color: #4361ee;
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}


/* ---------- Grid de Produtos ---------- */
.produtos-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.produto-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 0.875rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: box-shadow 0.2s, transform 0.15s;
}

.produto-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.produto-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.produto-nome {
  font-size: 0.9375rem;
  font-weight: 500;
  color: #1a1a2e;
}

.produto-balanca {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  background-color: #fef3c7;
  color: #92400e;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  text-transform: uppercase;
}

.produto-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.produto-preco {
  font-size: 1rem;
  font-weight: 600;
  color: #16213e;
}

/* ---------- Botões ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.96);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  width: 100%;
  padding: 0.75rem 1.25rem;
  background-color: #4361ee;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 0.625rem;
}

.btn-primary:hover:not(:disabled) {
  background-color: #3a56d4;
}

.btn-primary:focus-visible {
  outline: 2px solid #4361ee;
  outline-offset: 2px;
}

.btn-add {
  width: 2.25rem;
  height: 2.25rem;
  background-color: #4361ee;
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
  border-radius: 50%;
  flex-shrink: 0;
}

.btn-add:hover {
  background-color: #3a56d4;
}

.btn-add:focus-visible {
  outline: 2px solid #4361ee;
  outline-offset: 2px;
}

.btn-qty {
  width: 2rem;
  height: 2rem;
  background-color: #e5e7eb;
  color: #1a1a2e;
  font-size: 1.125rem;
  font-weight: 600;
  border-radius: 0.375rem;
}

.btn-qty:hover {
  background-color: #d1d5db;
}

.btn-minus {
  background-color: #fee2e2;
  color: #991b1b;
}

.btn-minus:hover {
  background-color: #fecaca;
}

.btn-plus {
  background-color: #dcfce7;
  color: #166534;
}

.btn-plus:hover {
  background-color: #bbf7d0;
}

.btn-remove {
  width: 2rem;
  height: 2rem;
  background-color: transparent;
  color: #9ca3af;
  font-size: 1rem;
  border-radius: 0.375rem;
}

.btn-remove:hover {
  background-color: #fee2e2;
  color: #e63946;
}


/* ---------- Carrinho ---------- */
.carrinho-itens {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.carrinho-item {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 0.875rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.carrinho-item-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.carrinho-item-nome {
  font-size: 0.9375rem;
  font-weight: 500;
  color: #1a1a2e;
}

.carrinho-item-preco {
  font-size: 0.875rem;
  font-weight: 600;
  color: #16213e;
}

.carrinho-item-controles {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.carrinho-item-qty {
  min-width: 1.5rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.9375rem;
}

.carrinho-item-obs input {
  width: 100%;
  padding: 0.5rem 0.625rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  font-size: 0.8125rem;
  color: #555;
  background: #f9fafb;
}

.carrinho-item-obs input:focus {
  outline: none;
  border-color: #4361ee;
  background: #fff;
}

/* ---------- Resumo do Carrinho ---------- */
.carrinho-resumo {
  border-top: 1px solid #e5e7eb;
  padding-top: 1rem;
  margin-top: 0.5rem;
}

.carrinho-total {
  font-size: 1.125rem;
  text-align: right;
  margin-bottom: 1rem;
  color: #1a1a2e;
}

.carrinho-total strong {
  font-size: 1.25rem;
  color: #16213e;
}

/* ---------- Notificações ---------- */
.notificacoes {
  position: fixed;
  top: 4rem;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 2rem);
  max-width: 28rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.notificacao {
  padding: 0.875rem 1rem;
  border-radius: 0.625rem;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  animation: slideDown 0.3s ease-out;
  pointer-events: auto;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-0.75rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.notificacao-sucesso {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.notificacao-erro {
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.notificacao-aprovado {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.notificacao-rejeitado {
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.notificacao-info {
  background-color: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}


/* ---------- Status de Conexão ---------- */
.app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  padding: 0.5rem 1rem;
  z-index: 100;
}

.conexao-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: #6b7280;
  max-width: 1200px;
  margin: 0 auto;
}

.conexao-indicador {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-conectado {
  background-color: #10b981;
  box-shadow: 0 0 4px rgba(16, 185, 129, 0.5);
}

.status-desconectado {
  background-color: #ef4444;
  box-shadow: 0 0 4px rgba(239, 68, 68, 0.4);
}

.status-reconectando {
  background-color: #f59e0b;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---------- Status do Pedido ---------- */
.status-container {
  text-align: center;
  padding: 2rem 1rem;
}

.status-pendente {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.status-icone {
  font-size: 2.5rem;
  animation: pulse 2s ease-in-out infinite;
}

.status-mensagem {
  font-size: 1.125rem;
  font-weight: 600;
  color: #16213e;
}

.status-detalhe {
  font-size: 0.875rem;
  color: #6b7280;
}

.status-id {
  font-size: 0.75rem;
  color: #9ca3af;
  font-family: monospace;
}

/* ---------- Mensagens ---------- */
.mensagem-vazio {
  text-align: center;
  padding: 2rem 1rem;
  color: #6b7280;
  font-size: 0.9375rem;
}

.mensagem-loading {
  text-align: center;
  padding: 2rem 1rem;
  color: #6b7280;
  font-size: 0.9375rem;
  animation: pulse 1.5s ease-in-out infinite;
}

/* ---------- Responsivo: 480px+ ---------- */
@media (min-width: 480px) {
  .cardapio-controles {
    flex-direction: row;
  }

  .campo-busca {
    flex: 2;
  }

  .campo-filtro {
    flex: 1;
  }

  .produtos-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---------- Responsivo: 768px+ ---------- */
@media (min-width: 768px) {
  .secao {
    padding: 1.5rem 2rem;
  }

  .secao h2 {
    font-size: 1.5rem;
  }

  .app-title {
    font-size: 1.375rem;
  }

  .app-header {
    padding: 1rem 2rem;
  }

  .produtos-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .notificacoes {
    top: 5rem;
  }

  #form-identificacao {
    max-width: 24rem;
  }
}

/* ---------- Responsivo: 1024px+ ---------- */
@media (min-width: 1024px) {
  .produtos-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .carrinho-itens {
    max-width: 40rem;
  }

  .carrinho-resumo {
    max-width: 40rem;
  }
}
