/* ===== ARQUIVO: styles.css ===== */

/* Variáveis CSS */
:root {
    --content-width: 640px;
    /* Paleta de cores personalizada - Azul escuro, Branco e Amarelo */
    --theme-color: #0047AB;        /* azul escuro principal */
    --theme-color-light: #1E5FBF;  /* azul escuro claro */
    --theme-color-dark: #003580;   /* azul escuro mais escuro */
    --accent-color: #FFC30B;       /* amarelo */
    --accent-color-light: #FFD54F; /* amarelo claro */
    --text-color: #333333;
    --text-light: #555555;
    --text-muted: #888888;
    --bg-color: #0047AB;           /* azul escuro */
    --surface-color: #FFFFFF;      /* branco */
    --border-color: #E0E0E0;
    --shadow-light: 0 2px 4px rgba(0,71,171,0.1);
    --shadow-medium: 0 4px 12px rgba(0,71,171,0.15);
    --shadow-heavy: 0 8px 24px rgba(0,71,171,0.2);
    --border-radius: 12px;
    --border-radius-small: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --max-width: 1200px;
}

/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: var(--bg-color);
    overflow-x: hidden;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--surface-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--theme-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Header */
.header {
    background: var(--bg-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-light);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.header-content {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.app-title {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    color: #FFFFFF;
    margin: 0;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--surface-color);
    border-radius: var(--border-radius-small);
    font-size: 0.9rem;
    color: var(--text-color);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #28a745;
    animation: pulse 2s infinite;
}

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

/* Navegação de Categorias */
.category-nav {
  background: transparent; /* remove faixa branca */
  border-top: none;
  overflow-x: visible; /* permite quebrar linha sem scroll horizontal */
  scrollbar-width: none;
}
.category-nav::-webkit-scrollbar { display: none; }

.category-nav-container {
    max-width: var(--content-width);
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    padding: 16px;
}

.category-button {
    flex: 0 0 auto;
    border: 2px solid var(--theme-color);
    border-radius: 25px;
    padding: 10px 20px;
    background: transparent;
    color: var(--theme-color);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.category-button::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--theme-color);
    transition: left 0.3s ease;
    z-index: -1;
}

.category-button:hover::before,
.category-button.active::before {
    left: 0;
}

.category-button:hover,
.category-button.active {
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

/* Conteúdo Principal */
.main-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 16px;
    min-height: calc(100vh - 200px);
}

/* Seção de Busca */
.search-section {
    padding: 24px 0;
}

.search-container {
    position: relative;
    max-width: var(--content-width);
    width: 100%;
    margin: 0 auto;
}

.search-input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    background: var(--surface-color);
    transition: var(--transition);
    outline: none;
}

.search-input:focus {
    border-color: var(--theme-color);
    box-shadow: 0 0 0 3px rgba(0, 71, 171, 0.1);
}

.search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: var(--transition);
}

.search-clear:hover {
    background: var(--surface-color);
    color: var(--text-color);
}

/* Lista de Itens */
.item-list {
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    padding-bottom: 40px;
}

.status-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.status-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.status-message p {
    font-size: 1.2rem;
    margin: 0;
}

/* Cards de Itens */
.menu-item {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-light);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    border: 1px solid var(--border-color);
}

.menu-item:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-heavy);
}

.menu-item.inactive {
    opacity: 0.6;
    filter: grayscale(0.5);
}

.item-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    background: var(--bg-color);
    transition: var(--transition);
}

.menu-item:hover .item-image {
    transform: scale(1.05);
}

.item-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.item-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0;
    line-height: 1.3;
}

.item-status {
    padding: 4px 8px;
    border-radius: var(--border-radius-small);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.item-status.active {
    background: var(--accent-color);
    color: var(--theme-color);
}

.item-status.inactive {
    background: var(--theme-color-dark);
    color: #FFFFFF;
}

.item-description {
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
}

.item-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0;
}

.item-tag {
    padding: 4px 8px;
    background: var(--surface-color);
    border-radius: var(--border-radius-small);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.item-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--theme-color);
}

/* Botão de ação dentro dos cards (Adicionar ao carrinho). Usa as cores do tema */
.whatsapp-button {
    background: var(--accent-color);
    color: var(--theme-color);
    border: none;
    border-radius: var(--border-radius-small);
    padding: 12px 20px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.whatsapp-button:hover {
    background: #E6B800;
    color: var(--theme-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.whatsapp-button:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
}

/* Horários */
.horarios-section {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 24px;
    margin: 24px 0;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
}

.horarios-section h2 {
    color: var(--theme-color);
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.horarios-list {
    display: grid;
    gap: 12px;
}

.horario-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-color);
    border-radius: var(--border-radius-small);
    border-left: 4px solid var(--theme-color);
}

.horario-dia {
    font-weight: 600;
    color: var(--text-color);
}

.horario-tempo {
    color: var(--text-light);
    font-size: 0.9rem;
}

.horario-item.fechado {
    border-left-color: var(--text-muted);
    opacity: 0.7;
}

.horario-item.fechado .horario-tempo {
    color: var(--text-muted);
}

/* Footer */
.footer {
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    margin-top: 40px;
}

.footer-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 32px 16px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    align-items: center;
}

.footer-section h3 {
    color: var(--theme-color);
    margin-bottom: 16px;
    font-size: 1.1rem;
}

.contact-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.contact-btn,
.toggle-btn,
.install-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border: none;
    border-radius: var(--border-radius-small);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-size: 0.9rem;
}

.whatsapp-btn {
    background: #25D366;
    color: white;
}

.whatsapp-btn:hover {
    background: #128C7E;
}

.instagram-btn {
    background: var(--theme-color);
    color: white;
}

.instagram-btn:hover {
    background: var(--theme-color-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.toggle-btn {
    background: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.toggle-btn:hover {
    background: var(--accent-color);
    color: var(--theme-color);
}

.install-btn {
    background: var(--theme-color);
    color: white;
}

.install-btn:hover {
    background: var(--theme-color-dark);
}

/* Botão do carrinho */
.cart-btn {
    background: var(--theme-color);
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border: none;
    border-radius: var(--border-radius-small);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.cart-btn:hover {
    background: var(--theme-color-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.footer-bottom {
    text-align: center;
    padding: 20px 16px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-heavy);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    z-index: 1;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-color);
    color: var(--text-color);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-color);
    color: white;
    padding: 12px 24px;
    border-radius: var(--border-radius);
    z-index: 1001;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Modo claro (fundo azul) */
@media (prefers-color-scheme: light) {
  .category-nav { background: transparent; border-top: none; }
  .search-input { background: #fff; color: #1f2937; }
  .search-input::placeholder { color: rgba(0,0,0,.45); }
  .item-status.active { background: var(--accent-color); color: var(--theme-color); } /* amarelo */
  
  /* Correção para botões de categoria no modo claro */
  .category-button {
    border-color: #ffffff;        /* contorno branco */
    color: #ffffff;               /* texto branco */
    background: transparent;      /* fundo transparente */
  }
  .category-button:hover,
  .category-button.active {
    background: #ffffff;          /* fundo branco no ativo/hover */
    color: var(--theme-color);    /* texto azul */
  }
  .category-button::before {
    background: #ffffff;          /* animação de fundo branca */
  }
}

/* Modo escuro (cards brancos) */
@media (prefers-color-scheme: dark) {
  :root {
    --content-width: 640px;
    /* Fundo geral escuro como o exemplo */
    --bg-color: #1f1f22;
    /* Cards continuam brancos */
    --surface-color: #FFFFFF;
    /* Texto geral fora dos cards */
    --text-color: #e9ecef;
    --text-light: #c8cdd2;
    --text-muted: #9aa0a6;
    --border-color: #2c2c2c;
    /* Tema/Acento iguais */
    --theme-color: #0047AB;
    --theme-color-light: #1E5FBF;
    --theme-color-dark: #003580;
    --accent-color: #FFC30B;
    --accent-color-light: #FFD54F;
  
  /* Tornar o texto do status legível sobre fundo claro no modo escuro */
  .status-indicator, #status-text { color: #1a1a1a; }
}

  /* Chips no dark: sem faixa e ativo azul */
  .category-nav { background: transparent; border-top: none; }
  .category-button { border-color: rgba(255,255,255,.25); color: #e9ecef; }
  .category-button:hover, .category-button.active { color: #fff; }
  .category-button:hover::before, .category-button.active::before { background: var(--theme-color); }

  /* Título legível */
  .app-title {
    text-align: center; color: #fff; }

  /* Cards brancos com texto escuro dentro */
  .menu-item { background: #fff; color: #1f2937; border-color: #e5e7eb; }
  .menu-item .item-title { color: #111827; }
  .menu-item .item-description { color: #4b5563; }
  .menu-item .item-details .item-tag { background: #f3f4f6; color: #374151; }

  /* "DISPONÍVEL" cinza claro no dark */
  .item-status.active { background: #E6E9EF; color: #1f2937; }

  /* Botão Pedir permanece amarelo */
  .whatsapp-button { background: var(--accent-color); color: var(--theme-color); }
  .whatsapp-button:hover { background: #E6B800; color: var(--theme-color); }
}

/* Responsividade */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    .app-title {
    text-align: center;
        font-size: 1.8rem;
    }
    
    .item-list {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .contact-buttons {
        justify-content: center;
    }
    
    .category-nav-container {
        padding: 12px 16px;
        gap: 16px;
    }
    
    .category-button {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
}

@media (max-width: var(--content-width);
    }
    
    .item-content {
        padding: 16px;
    }
    
    .item-title {
        font-size: 1.2rem;
    }
    
    .item-price {
        font-size: 1.3rem;
    }
    
    .search-container {
        margin: 0;
    }
}

/* Animações de entrada */
.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animação de pulso para o status online */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
    }
}

/* Estilos para o modo de impressão */
@media print {
    body {
        background-color: #fff;
        color: #000;
    }

    .header, .search-section, .category-nav, .footer, .whatsapp-button, .modal, .toast {
        display: none !important;
    }

    .main-content {
        padding: 0;
        margin: 0;
        max-width: var(--content-width);
    }

    .item-list {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .menu-item {
        border: 1px solid #ccc;
        box-shadow: none;
        display: flex;
        page-break-inside: avoid;
    }

    .item-image {
        width: 100px;
        height: 100px;
        flex-shrink: 0;
        margin-right: 10px;
    }

    .item-content {
        padding: 10px;
        gap: 5px;
    }

    .item-title {
        font-size: 1rem;
    }

    .item-description {
        font-size: 0.8rem;
    }

    .item-price {
        font-size: 1rem;
        color: #000;
    }

    .item-status, .item-details, .item-footer {
        display: none;
    }
}




/* === PATCH CSS: Correção de alinhamento dos botões === */

/* === Grid: garanta que os cards estiquem igualmente na linha === */
.item-list, .items-grid, #items-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  align-items: stretch; /* importante para igualar a altura dos cards por linha */
}

/* === Card: empilhar e fixar o footer no rodapé === */
.menu-item {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Conteúdo interno ocupa o espaço disponível */
.menu-item .item-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto; /* cresce para preencher */
}

/* Empurra o footer para o fim do card, alinhando o botão */
.menu-item .item-footer {
  margin-top: auto;              /* 👈 chave do alinhamento */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Imagens com altura consistente para não "pular" o layout */
.menu-item .item-image {
  width: 100%;
  height: 160px;                 /* padronize a vitrine (ajuste se quiser) */
  object-fit: cover;             /* corta mantendo proporção */
  display: block;
}

/* Opcional: alturas mínimas para título/descrição (estabiliza linhas) */
.menu-item .item-title { min-height: 0; }
.menu-item .item-description { min-height: 40px; } /* ajuste conforme seu texto */

/* Botão consistente */
.whatsapp-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 14px;
}

