/* =========================================
   Estilo Base
   ========================================= */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f0f2f5;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    margin: 0;
    color: #333;
}

h1 { 
    font-size: 22px; 
    text-align: center; 
    margin-bottom: 20px;
    color: #1a1a1a;
}

/* =========================================
   Caixas de Conteúdo (Cards)
   ========================================= */
.box-padrao {
    width: 100%;
    max-width: 400px;
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-align: center;
    box-sizing: border-box;
    margin-bottom: 15px;
}

.box-padrao input[type="number"] {
    width: calc(100% - 20px);
    padding: 12px;
    margin: 10px 0;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 16px;
    text-align: center;
    background-color: #f9fafb;
}

/* =========================================
   Sistema de Botões (Paleta Intuitiva)
   ========================================= */
.btn-acao {
    width: 100%;
    padding: 14px;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 5px;
}

.btn-primario { background: #2563eb; } /* Azul - Adicionar item */
.btn-primario:hover { background: #1d4ed8; }

.btn-sucesso { background: #16a34a; } /* Verde - Finalizar compra */
.btn-sucesso:hover { background: #15803d; }

.btn-secundario { background: #64748b; margin-bottom: 20px; } /* Cinza - Histórico */
.btn-secundario:hover { background: #475569; }

.btn-contador {
    padding: 10px 20px; 
    font-size: 20px; 
    font-weight: bold; 
    background: #e2e8f0; 
    color: #334155; 
    border: none; 
    border-radius: 8px; 
    cursor: pointer;
}

/* =========================================
   Leitor e Alertas
   ========================================= */
#reader {
    width: 100%;
    max-width: 400px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    background: white;
    margin-bottom: 15px;
    border: none;
}

#resultado-area {
    padding: 12px;
    background: #dcfce7; /* Fundo verde claro */
    color: #166534;      /* Texto verde escuro */
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    font-weight: bold;
    font-size: 16px;
    display: none; 
    text-align: center;
    width: 100%;
    max-width: 370px;
    margin-bottom: 15px;
}

@keyframes piscarAlerta {
    0% { box-shadow: 0 2px 8px rgba(0,0,0,0.08); background-color: white; border: 2px solid transparent; }
    50% { box-shadow: 0 0 15px rgba(239, 68, 68, 0.4); background-color: #fef2f2; border: 2px solid #ef4444; }
    100% { box-shadow: 0 2px 8px rgba(0,0,0,0.08); background-color: white; border: 2px solid transparent; }
}

.alerta-estourou {
    animation: piscarAlerta 1.5s infinite !important;
}

/* =========================================
   Modal Histórico
   ========================================= */
.modal {
    display: none; 
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.modal-content {
    background: white;
    max-width: 400px;
    margin: 20px auto;
    padding: 20px;
    border-radius: 12px;
    position: relative;
}

.close-btn {
    position: absolute;
    top: 10px; right: 15px;
    font-size: 28px;
    cursor: pointer;
    color: #94a3b8;
    font-weight: bold;
}

.compra-card {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    text-align: left;
    background: #f8fafc;
}