body { background-color: #f4f6f9; font-family: 'Poppins', sans-serif; font-size: 14px; padding-bottom: 20px; color: #333; }
.app-screen { display: none; min-height: 100vh; }
.active { display: block; }
#screen-login.active { display: flex !important; }

/* BARRA DE SINCRONIZAÇÃO */
.sync-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #ffc107;
    color: #000;
    text-align: center;
    padding: 8px;
    font-weight: bold;
    font-size: 12px;
    z-index: 10000; /* Acima de tudo */
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    display: none;
}

#app-header { background: #000; color: white; padding: 25px 15px; border-radius: 0 0 20px 20px; margin-bottom: 20px; display: none; text-align: center; position: relative; }
#user-name { font-size: 1.6rem; font-weight: 600; display: block; margin-bottom: 5px; }

.btn-logout { position: absolute; top: 50%; transform: translateY(-50%); right: 16px; color: white; opacity: 0.9; cursor: pointer; padding: 12px; margin: -12px; touch-action: manipulation; -webkit-tap-highlight-color: rgba(255,193,7,.3); font-size: 20px; }
.btn-menu { position: absolute; top: 50%; transform: translateY(-50%); left: 25px; color: white; opacity: 0.8; cursor: pointer; }

.card-custom { border: none; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.03); margin-bottom: 15px; background: white; padding: 20px; }
.btn-gelb { background-color: #ffc107; color: #000; font-weight: 500; border-radius: 50px; width: 100%; padding: 12px; border: none; font-size: 15px; }

.form-check-input { width: 3.5em !important; height: 1.75em !important; cursor: pointer; margin-right: 10px; }
.form-check-input:checked { background-color: #f5c745; border-color: #f5c745; }
.form-check-label { font-weight: 400 !important; padding-top: 3px; font-size: 15px; }

.option-btn { cursor: pointer; transition: all 0.3s; background: #fff; border: 2px solid #dee2e6; opacity: 0.6; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.option-btn.active-option { border: 3px solid #f5c745 !important; opacity: 1; background-color: #fffdf5; transform: scale(1.02); }

.section-title { font-size: 0.95rem; font-weight: 600; color: #000; margin-bottom: 15px; border-bottom: 2px solid #ffc107; display: inline-block; }
.locked-overlay { opacity: 0.5; pointer-events: none; filter: grayscale(1); }

#reader { width: 100%; min-height: 300px; background: #000; border-radius: 10px; margin-bottom: 15px; display: none; }

/* MENU LATERAL */
#side-menu { position: fixed; top: 0; left: -280px; width: 280px; height: 100%; background: #fff; z-index: 3000; transition: 0.3s ease; box-shadow: 2px 0 10px rgba(0,0,0,0.1); display: flex; flex-direction: column; }
#side-menu.open { left: 0; }
.menu-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 2999; display: none; }
.menu-overlay.open { display: block; }
.menu-header { background: #000; color: #fff; padding: 25px 20px; display: flex; justify-content: space-between; align-items: center; }
.menu-item { padding: 20px; border-bottom: 1px solid #f0f0f0; color: #333; text-decoration: none; font-weight: 500; display: flex; align-items: center; gap: 15px; font-size: 16px; cursor: pointer; transition: 0.2s; }
.menu-item:hover { background: #f8f9fa; color: #000; }
.menu-item i { width: 25px; text-align: center; color: #ffc107; }

/* MODAIS */
#modal-validade, #modal-duvidas, #modal-bingo { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #f4f6f9; z-index: 2000; display: none; flex-direction: column; overflow-y: auto; }
.modal-header-v { padding: 20px; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.05); display: flex; align-items: center; gap: 10px; }

/* LISTA DE VALIDADES */
.validade-list-item { background: #fff; border-radius: 8px; padding: 15px; margin-bottom: 10px; border-left: 5px solid #ccc; position: relative; }
.v-status-green { border-left-color: #198754; }
.v-status-yellow { border-left-color: #ffc107; }
.v-status-red { border-left-color: #dc3545; }

/* FAQ */
.faq-item { background: #fff; border-radius: 8px; margin-bottom: 10px; overflow: hidden; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.faq-question { padding: 15px; font-weight: 600; cursor: pointer; display: flex; justify-content: space-between; align-items: center; color: #333; }
.faq-answer { padding: 0 15px 15px 15px; display: none; color: #555; border-top: 1px solid #f4f4f4; margin-top: 0; padding-top: 15px; line-height: 1.6; }
.faq-item.active .faq-answer { display: block; }
.faq-item.active .faq-question { color: #d63384; background-color: #fffdf5; }
.faq-item.active .fa-chevron-down { transform: rotate(180deg); transition: 0.3s; }

/* ANIMAÇÕES DE ALERTA */
@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}
.pulsing-red { animation: pulse-red 2s infinite; border-left-color: #dc3545 !important; border: 2px solid #dc3545 !important; }

/* NOVA ANIMAÇÃO PARA NOTA BAIXA (PISCAR VERMELHO) */
@keyframes blink-red-bg {
    0% { background-color: #fff; border-color: #eee; }
    50% { background-color: #fff5f5; border-color: #dc3545; box-shadow: 0 0 10px rgba(220, 53, 69, 0.3); }
    100% { background-color: #fff; border-color: #eee; }
}
.blink-red {
    animation: blink-red-bg 1.5s infinite;
    border: 2px solid #dc3545 !important;
}

.btn-trash { position: absolute; top: 15px; right: 15px; color: #dc3545; background: none; border: none; }
.input-group-camera { position: relative; }
.btn-cam-inside { position: absolute; right: 0; top: 0; height: 100%; width: 50px; border: none; background: transparent; color: #d63384; font-size: 20px; }

/* ESTILO DO HISTÓRICO HORIZONTAL */
.history-card-h {
    min-width: 220px;
    max-width: 220px;
    background: #fff;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid #eee;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.1s;
}
.history-card-h:active { transform: scale(0.98); }
.history-card-h .h-date { font-size: 11px; color: #888; margin-bottom: 5px; }
.history-card-h .h-pdv { font-weight: 600; color: #333; font-size: 14px; margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-card-h .h-rating { color: #ffc107; font-size: 13px; margin-bottom: 5px; }
.history-card-h .h-obs { font-size: 11px; color: #555; font-style: italic; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3; }

#historico-horizontal::-webkit-scrollbar { display: none; }
#historico-horizontal { -ms-overflow-style: none; scrollbar-width: none; }

/* ESTILO CARD VALIDADO */
.card-validado {
    background-color: #198754 !important;
    color: white !important;
    border: none !important;
}
.card-validado .section-title { color: white !important; border-bottom-color: white !important; }
.card-validado .text-muted { color: rgba(255,255,255,0.8) !important; }
.card-validado .badge { background-color: white !important; color: #198754 !important; }
.card-validado button { border-color: white !important; color: white !important; }
.card-validado button:hover { background-color: white !important; color: #198754 !important; }

/* ESTILOS CONFERÊNCIA */
.btn-scan-conf {
    background-color: #ffc107; color: #000; border: none;
    width: 100%; padding: 20px; font-size: 20px; font-weight: 800;
    border-radius: 12px; margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.btn-scan-conf:active { transform: scale(0.98); }

.card-pdv {
    background: #fff; border-radius: 10px; padding: 15px; margin-bottom: 15px;
    border-left: 5px solid #6c757d; transition: all 0.3s; box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    cursor: pointer; /* Indica que é clicável */
}
.card-pdv.complete { border-left-color: #198754; background: #e8f5e9; }

.pdv-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.pdv-name { font-weight: 600; font-size: 16px; color: #333; }
.pdv-status { font-size: 12px; font-weight: bold; background: #e9ecef; padding: 2px 8px; border-radius: 4px; color: #495057; }
.complete .pdv-status { background: #198754; color: white; }

.progress { height: 8px; background-color: #e9ecef; border-radius: 4px; }
.progress-bar { background-color: #ffc107; }
.complete .progress-bar { background-color: #198754; }

.vol-list { font-size: 11px; color: #6c757d; margin-top: 8px; }

/* GRID BINGO (CARTELA) */
.bingo-grid {
    display: grid;
    /* Cria 4 colunas de tamanho igual */
    grid-template-columns: repeat(4, 1fr); 
    gap: 15px; /* Espaço entre os quadrados */
    padding: 10px;
    margin-top: 10px;
    justify-content: center;
}

.bingo-item {
    background-color: #ffffff;
    border: 2px solid #ffc107; /* Borda Amarela Gelb */
    color: #000;
    font-weight: 800;
    font-size: 22px;
    
    /* Faz ficar quadrado */
    aspect-ratio: 1 / 1; 
    display: flex;
    align-items: center;
    justify-content: center;
    
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15); /* Sombra para dar relevo */
    transition: transform 0.1s;
}

.bingo-item:active {
    transform: scale(0.95); /* Efeito de clique */
    background-color: #fffdf5;
}

/* Ajuste para telas muito pequenas */
@media (max-width: 350px) {
    .bingo-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* --- MÓDULO SPEEDTEST --- */
.speedtest-container {
    text-align: center;
    padding: 20px 10px;
}

.gauge-wrapper {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 20px auto;
    border-radius: 50%;
    border: 10px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: border-color 0.3s;
}

.gauge-wrapper.active {
    border-color: #ffc107;
    border-top-color: #333;
    animation: spin-gauge 1s linear infinite;
}

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

.gauge-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: #333;
    animation: none !important; /* Texto não gira */
    transform: rotate(0deg); /* Mantém fixo se o pai girar */
}

.gauge-unit {
    font-size: 0.9rem;
    color: #777;
    text-transform: uppercase;
}

.st-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.st-card {
    background: #fff;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    text-align: center;
}

.st-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
    display: block;
}

.st-val {
    font-size: 1.2rem;
    font-weight: 700;
    color: #333;
}

.st-status-badge {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 50px;
    font-weight: bold;
    color: white;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.st-status-Excelente { background-color: #198754; }
.st-status-Bom { background-color: #0dcaf0; color: #000; }
.st-status-Ruim { background-color: #ffc107; color: #000; }
.st-status-Crítico { background-color: #dc3545; }
.st-status-Erro { background-color: #6c757d; }

.btn-start-test {
    background: #333;
    color: #ffc107;
    border: none;
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 800;
    width: 100%;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: transform 0.1s;
}

.btn-start-test:active {
    transform: scale(0.98);
}

.btn-start-test:disabled {
    background: #ccc;
    color: #666;
}

.history-list {
    margin-top: 20px;
    text-align: left;
}

.history-item {
    background: white;
    padding: 10px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.history-item:first-child { border-top-left-radius: 10px; border-top-right-radius: 10px; }
.history-item:last-child { border-bottom-left-radius: 10px; border-bottom-right-radius: 10px; border-bottom: none; }
/* ── STEP FORMAT ─────────────────────────────────────────────────────────── */
.step-dot { width:8px; height:8px; border-radius:50%; background:rgba(255,255,255,.3); transition:.3s; }
.step-dot-active { background:#ffc107; transform:scale(1.3); }
.step-dot-done   { background:rgba(255,193,7,.6); }
.step-content    { animation: stepFadeIn .25s ease; }
@keyframes stepFadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
.step-nav-btns   { display:flex; gap:10px; margin-top:12px; margin-bottom:4px; }
.step-nav-btns .btn { border-radius:10px; font-weight:600; padding:10px 16px; }
    50%       { box-shadow: 0 4px 24px rgba(255, 152, 0, 0.70); }
}

/* SweetAlert2 — garante que apareça acima de qualquer modal (z-index máx do app: 2000) */
.swal2-container { z-index: 9999 !important; }
