/* HISTORY_PANEL.CSS
   Painel "Vistos Recentemente".

   O history_handler.js já montava este painel, mas as regras base nunca
   existiram — só havia um reposicionamento em mobile_styles.css. Sem elas o
   painel aparecia sem formatação nenhuma no desktop. */

#history-panel {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: var(--z-floating-panel, 20000);
    width: 260px;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 14px;
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.18);
    overflow: hidden;
    font-family: 'Inter', sans-serif;
    transition: transform .25s cubic-bezier(0.34, 1.2, 0.64, 1);
}

/* Fechado, some deixando só a barra de título à mostra */
#history-panel.collapsed {
    transform: translateY(calc(100% - 42px));
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    cursor: pointer;
    user-select: none;
    background: rgba(241, 245, 249, 0.9);
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.history-header:hover {
    background: rgba(226, 232, 240, 0.95);
}

.history-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 800;
    color: #0f172a;
}

.history-toggle {
    font-size: 11px;
    color: #64748b;
    transition: transform .25s ease;
}

#history-panel.collapsed .history-toggle {
    transform: rotate(180deg);
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    transition: background .15s ease;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item:hover {
    background: rgba(37, 99, 235, 0.07);
}

.history-icon {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
    font-size: 11px;
}

.history-empty {
    padding: 18px 14px;
    text-align: center;
    font-size: 11px;
    color: #94a3b8;
}

/* Impressão do relatório de área: só a tabela vai para o papel */
#area-report-print {
    display: none;
}

@media print {
    body > *:not(#area-report-print) {
        display: none !important;
    }

    #area-report-print {
        display: block !important;
        position: static;
        color: #000;
        font-family: 'Inter', Arial, sans-serif;
    }

    @page {
        margin: 12mm;
        size: A4 landscape;
    }
}

/* Modo escuro do app */
.dark-theme #history-panel {
    background: rgba(15, 23, 42, 0.95);
    border-color: rgba(148, 163, 184, 0.22);
}

.dark-theme .history-header {
    background: rgba(30, 41, 59, 0.9);
    border-bottom-color: rgba(148, 163, 184, 0.18);
}

.dark-theme .history-title {
    color: #e2e8f0;
}

.dark-theme .history-item {
    border-bottom-color: rgba(148, 163, 184, 0.12);
}

.dark-theme .history-item:hover {
    background: rgba(37, 99, 235, 0.18);
}
