/* painel_cliente/css/estilo.css - Estilos do Painel do Cliente */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--cor-fundo-pagina);
    font-family: var(--familia-fonte);
    font-size: var(--tamanho-fonte-base);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* ============================================ */
/* MENU FLUTUANTE UNIFICADO */
/* ============================================ */
.audio-menu-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: inherit;
}

.audio-menu-btn {
    background: var(--cor-gradiente);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.audio-menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.25);
}

.audio-menu-btn i {
    font-size: 1rem;
}

.audio-dropdown {
    position: absolute;
    bottom: 60px;
    right: 0;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    min-width: 180px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    z-index: 1001;
}

.audio-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.audio-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    background: white;
    width: 100%;
    text-align: left;
}

.audio-dropdown-item:hover {
    background: #f1f5f9;
}

.audio-dropdown-item i {
    width: 20px;
    font-size: 0.9rem;
}

.audio-dropdown-item.desligado {
    color: #ef4444;
}

.audio-dropdown-item.desligado i {
    color: #ef4444;
}

.audio-dropdown-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 4px 0;
}

/* ============================================ */
/* STATUS DE CONEXÃO */
/* ============================================ */
.status-conexao {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 5px 12px;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.2s;
}

.status-conexao.online {
    color: #10b981;
    border-left: 3px solid #10b981;
}

.status-conexao.offline {
    color: #ef4444;
    border-left: 3px solid #ef4444;
}

.status-conexao i {
    font-size: 0.7rem;
}

/* ============================================ */
/* NAVBAR */
/* ============================================ */
.navbar-premium {
    background: var(--cor-gradiente) !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 0.75rem 1.5rem;
}

.navbar-premium .navbar-brand {
    font-weight: 700;
    color: white !important;
    font-size: 1.3rem;
}

/* ============================================ */
/* MAIN CONTENT */
/* ============================================ */
.main-content {
    flex: 1;
    padding: 25px 30px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.header-title h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--cor-texto-principal);
    margin-bottom: 5px;
}

.header-title h1 i {
    color: var(--cor-primaria);
    margin-right: 10px;
}

.relogio {
    background: white;
    padding: 8px 20px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--cor-primaria);
    font-family: monospace;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* ============================================ */
/* STATS CARDS */
/* ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card-premium {
    background: white;
    border-radius: 24px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}

.stat-card-premium::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--cor-gradiente);
}

.stat-card-premium .value {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--cor-primaria);
    line-height: 1.2;
}

.stat-card-premium .label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--cor-texto-secundario);
    margin-top: 8px;
    font-weight: 600;
}

/* Espera média detalhada por departamento (quando há mais de um) */
.stat-card-premium .value.tempo-por-dep {
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
}

.tempo-dep {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.tempo-dep-nome {
    color: var(--cor-texto-secundario);
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%;
}

.tempo-dep-valor {
    color: var(--cor-primaria);
    font-weight: 800;
    white-space: nowrap;
}

/* ============================================ */
/* CARROSSEL DE CHAMADAS (SENHAS) */
/* ============================================ */
.chamada-carrossel {
    background: var(--cor-fundo-card-senha);
    border-radius: 32px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    position: relative;
    transition: all 0.3s ease;
    height: 100%;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Selo PRIORITÁRIO (+ motivo, se ligado em Configurações) na chamada principal — 2026-08-01.
   Ver painel_cliente/js/main.js, atualizarCarrossel. */
.chamada-prioritaria-badge {
    display: inline-block;
    background: #fee2e2;
    color: #991b1b;
    padding: 5px 16px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    margin-top: 6px;
}

/* Nome do órgão/departamento na chamada principal — só aparece quando o painel mostra mais de
   um departamento ao mesmo tempo (ver painel_cliente/js/main.js, atualizarCarrossel). */
.chamada-orgao {
    font-size: 1.1rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--cor-secundaria, #667eea);
    margin-top: 6px;
}

.chamada-numero {
    font-family: monospace;
    letter-spacing: 8px;
    margin: 20px 0;
}

.chamada-guiche {
    margin: 10px 0;
}

.chamada-status {
    display: inline-block;
    background: var(--cor-gradiente);
    color: white;
    padding: 8px 25px;
    border-radius: 50px;
    font-weight: 600;
    margin-top: 15px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.9;
        transform: scale(1.02);
    }
}

.nav-chamada {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}

.nav-chamada.prev {
    left: 15px;
}

.nav-chamada.next {
    right: 15px;
}

.nav-chamada:hover {
    background: var(--cor-primaria);
}

.multi-chamadas {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
}

.badge-chamada {
    display: inline-block;
    background: #f1f5f9;
    color: #475569;
    padding: 5px 12px;
    border-radius: 30px;
    margin: 3px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.badge-chamada:hover,
.badge-chamada.ativa {
    background: var(--cor-primaria);
    color: white;
}

.chamada-indicadores {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.indicador {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #cbd5e1;
    cursor: pointer;
    transition: all 0.2s;
}

.indicador.ativo {
    width: 25px;
    border-radius: 10px;
    background: var(--cor-primaria);
}

/* ============================================ */
/* CARROSSEL DE INFORMAÇÕES - CORRIGIDO */
/* ============================================ */
.info-carrossel {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    position: relative;
    margin-bottom: 20px;
}

.info-track {
    display: inline-block;
    white-space: nowrap;
    will-change: transform;
}

.info-carrossel:hover .info-track {
    animation-play-state: paused !important;
}

.info-item {
    display: inline-block;
    white-space: normal;
    word-break: keep-all;
    transition: all 0.2s ease;
}

.info-item:hover {
    transform: translateY(-2px);
}

.info-item i {
    margin-right: 6px;
}

/* ============================================ */
/* CARDS (Guichês, Fila, Histórico) */
/* ============================================ */
.card-premium {
    background: var(--cor-fundo-card);
    border-radius: var(--borda-arredondamento);
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    overflow: hidden;
    margin-bottom: 25px;
}

.card-premium .card-header {
    background: white;
    padding: 18px 24px;
    border-bottom: 1px solid #eef2f6;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.card-premium .card-header:hover {
    background: #f8fafc;
}

.card-premium .card-header i {
    margin-right: 8px;
}

.card-collapsible .card-body {
    transition: all 0.3s ease;
}

.card-collapsible.collapsed .card-body {
    display: none;
}

/* ============================================ */
/* GUICHÊS */
/* ============================================ */
.guiches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    padding: 5px;
}

.guiche-card {
    background: linear-gradient(135deg, #f8fafc, #ffffff);
    border-radius: 20px;
    padding: 15px;
    text-align: center;
    border: 1px solid #eef2f6;
    transition: all 0.2s;
}

.guiche-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

/* Nome do órgão/departamento no card do guichê — só aparece quando o painel mostra mais de
   um departamento ao mesmo tempo (ver painel_cliente/js/main.js, atualizarGuiches). */
.guiche-orgao {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--cor-secundaria, #667eea);
    opacity: 0.85;
    margin-bottom: 4px;
}

.guiche-numero {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--cor-primaria);
    margin-bottom: 10px;
}

.guiche-senha {
    font-family: monospace;
    font-weight: 700;
    font-size: 1rem;
    background: #f1f5f9;
    padding: 4px 12px;
    border-radius: 30px;
    display: inline-block;
}

.status-ocupado {
    color: #10b981;
    font-size: 0.7rem;
    margin-top: 6px;
}

.status-livre {
    color: #94a3b8;
    font-size: 0.7rem;
    margin-top: 6px;
}

/* Atendente no card do guichê (foto + nome) */
.guiche-atendente {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}
.guiche-atendente-foto {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--cor-primaria);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.guiche-atendente-foto img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.guiche-atendente-nome {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    text-align: left;
    line-height: 1.15;
}

/* Destaque do guichê que está chamando agora */
.guiche-card.guiche-chamando {
    border-color: var(--cor-primaria);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.04), 0 8px 22px rgba(0,0,0,0.10);
    animation: guichePulsa 1.4s ease-in-out infinite;
}
@keyframes guichePulsa {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* ============================================ */
/* FILA */
/* ============================================ */
.item-senha {
    background: var(--fila-cor-fundo-card);
    border-radius: var(--fila-borda-arredondamento);
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #eef2f6;
    transition: all 0.2s;
}

.item-senha:hover {
    transform: translateX(3px);
    border-color: var(--cor-primaria);
}

.item-senha .senha {
    font-family: monospace;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--fila-cor-senha);
}

.item-senha .posicao {
    background: #e2e8f0;
    padding: 2px 10px;
    border-radius: 30px;
    font-size: 0.7rem;
    font-weight: 600;
}

.item-senha.prioritario {
    background: #fef2f2;
    border-left: 3px solid #dc2626;
}

/* Nome do cliente (quando informado no totem) na lista de espera — pedido do usuário
   (2026-08-10), mesmo interruptor já usado na chamada principal (window.painelNomeMostrar).
   Largura máxima com reticências para não estourar a linha com um nome comprido. */
.fila-nome {
    font-size: 0.75rem;
    font-weight: 700;
    color: #334155;
    margin-left: 6px;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}

/* Motivo da prioridade na lista de espera (2026-08-01) — só aparece com o interruptor
   ligado em Configurações → Regras de Atendimento. Ver painel_cliente/js/main.js. */
.motivo-fila {
    font-size: 0.65rem;
    color: #dc2626;
    font-weight: 600;
    margin-left: 6px;
}

/* Nome do departamento na lista de espera (2026-08-01) — só aparece quando o painel mostra
   mais de um departamento ao mesmo tempo. A cor vem do departamento (inline, via JS). */
.fila-departamento {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-left: 6px;
}

/* ============================================ */
/* HISTÓRICO */
/* ============================================ */
.historico-lista {
    max-height: 300px;
    overflow-y: auto;
}

.historico-item {
    display: grid;
    /* Colunas fixas: senha+nome (flexível, trunca) | guichê | horário/status */
    grid-template-columns: minmax(0, 1fr) 88px 172px;
    align-items: center;
    column-gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid #eef2f6;
    transition: background 0.2s;
}

/* Quando o painel mostra mais de um departamento ao mesmo tempo, ganha uma coluna a mais
   (2026-08-01) — só nesse caso, pra não desperdiçar espaço/alinhar uma coluna vazia à toa
   num painel de departamento único. */
.historico-item.com-departamento {
    grid-template-columns: minmax(0, 1fr) 100px 88px 172px;
}

/* Cada coluna pode encolher para permitir o "..." no nome */
.historico-item > div { min-width: 0; }

/* Coluna principal: senha fixa + nome que trunca com reticências */
.hist-principal { display: flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; }
.hist-principal .historico-senha { flex: 0 0 auto; }
.historico-nome {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.historico-item .historico-horario { white-space: nowrap; }

.historico-item:hover {
    background: #f8fafc;
}

.historico-senha {
    font-family: monospace;
    font-weight: 700;
}

.historico-guiche {
    font-size: 0.7rem;
    background: #e2e8f0;
    padding: 2px 10px;
    border-radius: 30px;
}

/* Nome do departamento no histórico (2026-08-01) — coluna própria do grid (entre a senha e o
   guichê), alinhada verticalmente em todas as linhas do card. Só aparece quando o painel
   mostra mais de um departamento ao mesmo tempo. Importante especialmente aqui: número de
   guichê sozinho é ambíguo entre departamentos (cada um pode ter seu próprio "Guichê 3"). A
   cor vem do departamento (inline, via JS). */
.historico-departamento {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.historico-horario {
    font-size: 0.7rem;
    color: var(--cor-texto-secundario);
}

/* ============================================ */
/* BOTÕES ADMIN */
/* ============================================ */
.btn-admin {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 8px 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-admin:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    color: white;
}

/* ============================================ */
/* YOUTUBE */
/* ============================================ */
.youtube-container {
    width: 100%;
    height: 100%;
}

.youtube-container .card-premium {
    height: 100%;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 0;
}

.youtube-container iframe {
    width: 100%;
    height: 100%;
    min-height: 400px;
    border: none;
    display: block;
}

/* ============================================ */
/* LAYOUT 2 COLUNAS */
/* ============================================ */
.layout-2colunas {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.coluna-esquerda {
    flex: 1;
    min-width: 300px;
}

.coluna-direita {
    flex: 1;
    min-width: 300px;
}

.carrossel-full {
    width: 100%;
    max-width: 100%;
}

/* ============================================ */
/* RODAPÉ */
/* ============================================ */
.footer-premium {
    color: white;
    text-align: center;
    padding: 12px;
    font-size: 0.7rem;
    margin-top: auto;
    background: linear-gradient(135deg, var(--cor-primaria), var(--cor-secundaria));
}

/* ============================================ */
/* RESPONSIVIDADE */
/* ============================================ */
@media (max-width: 992px) {
    .stats-grid {
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 15px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .chamada-numero {
        font-size: 3rem;
        letter-spacing: 4px;
    }

    .guiches-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .layout-2colunas {
        flex-direction: column;
    }

    .coluna-esquerda,
    .coluna-direita {
        flex: auto;
    }

    .youtube-container .card-premium {
        min-height: 250px;
    }

    .chamada-carrossel {
        min-height: 300px;
    }
}

@media (max-width: 480px) {
    .guiches-grid {
        grid-template-columns: 1fr;
    }
}