/**
 * bi-dashboard.css — Responsive BI Tab Styles
 * InspectorPRO NR-13 — V151.2
 * Replaces all inline styles from the BI tab HTML
 */

/* === FIX: Panel flash on first load === */
.db-panel {
    display: none;
}
#db-panel-overview {
    display: block;
}

/* === BI GRID LAYOUTS === */
.bi-main-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.bi-duo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.bi-sidebar-stack {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* === BI CARD BASE === */
.bi-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 24px;
    padding: 24px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.bi-card-flex {
    flex: 1;
}

.bi-card-gradient {
    background: linear-gradient(135deg, rgba(var(--brand-accent-rgb, 0, 212, 255), 0.05), rgba(139, 92, 246, 0.05));
}

/* === BI CARD ELEMENTS === */
.bi-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 8px;
}

.bi-card-title {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 4px 0;
}

.bi-card-subtitle {
    color: #e2e8f0;
    font-size: 0.8rem;
    text-transform: uppercase;
    margin: 0;
}

.bi-card-highlight {
    color: var(--brand-accent, #00d4ff);
    font-weight: 700;
    font-size: 1.2rem;
}

.bi-card-footer {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* === BI CHART CONTAINER === */
.bi-chart-container {
    height: 300px;
    position: relative;
    min-height: 200px;
}

/* === BI TRENDS === */
.bi-trend-value {
    font-weight: 700;
    font-size: 1.1rem;
    color: #10b981;
}

.bi-trend-label {
    color: #e2e8f0;
    font-size: 0.8rem;
    margin-left: 8px;
}

/* === BI BADGES === */
.bi-badge {
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
}

.bi-badge-red {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.bi-badge-green {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.bi-badge-cyan {
    background: rgba(6, 182, 212, 0.2);
    color: var(--brand-accent, #00d4ff);
}

.bi-badge-purple {
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
}

/* === BI LIST CONTAINERS === */
.bi-list-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bi-list-scrollable {
    max-height: 400px;
    overflow-y: auto;
}

.bi-placeholder {
    color: #64748b;
    text-align: center;
    padding: 30px;
}

/* ================================================ */
/* RESPONSIVE: MOBILE-FIRST OVERRIDES               */
/* ================================================ */

/* Tablet landscape and below */
@media (max-width: 1024px) {
    .bi-main-grid {
        grid-template-columns: 1fr;
    }
    
    .bi-chart-container {
        height: 250px;
    }
}

/* Tablet portrait and phones */
@media (max-width: 768px) {
    .bi-main-grid,
    .bi-duo-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        margin-bottom: 16px;
    }
    
    .bi-card {
        padding: 16px;
        border-radius: 16px;
    }
    
    .bi-card-title {
        font-size: 0.95rem;
    }
    
    .bi-chart-container {
        height: 200px;
        min-height: 180px;
    }
    
    .bi-list-scrollable {
        max-height: 300px;
    }
    
    .bi-card-header {
        margin-bottom: 12px;
    }
    
    .bi-card-footer {
        margin-top: 12px;
        padding-top: 12px;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .bi-trend-value {
        font-size: 1rem;
    }
}

/* Very small phones */
@media (max-width: 400px) {
    .bi-card {
        padding: 12px;
        border-radius: 12px;
    }
    
    .bi-card-title {
        font-size: 0.85rem;
    }
    
    .bi-badge {
        font-size: 0.6rem;
        padding: 3px 8px;
    }
    
    .bi-chart-container {
        height: 180px;
        min-height: 150px;
    }
}

/* ═══════════════════════════════════════════════════════════════════ */
/* [HUB-INTELIGENCIA] Hub premium (AnalyticsEngine + ApexCharts)         */
/* ═══════════════════════════════════════════════════════════════════ */
.pc-hub { display: flex; flex-direction: column; gap: 20px; margin-bottom: 24px; }
.pc-hub-head {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 12px;
}
.pc-hub-title { color: #fff; font-size: 1.25rem; font-weight: 800; margin: 0; letter-spacing: -0.01em; }
.pc-hub-sub { color: #94a3b8; font-size: 0.82rem; margin: 2px 0 0; }
.pc-hub-filtros { display: flex; gap: 6px; flex-wrap: wrap; }
.pc-pill {
    padding: 6px 14px; border-radius: 10px; font-size: 0.72rem; font-weight: 700;
    cursor: pointer; transition: all 0.18s; border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03); color: #64748b; white-space: nowrap;
}
.pc-pill:hover { border-color: rgba(255,255,255,0.2); color: #cbd5e1; }
.pc-pill.active { border-color: rgba(var(--brand-accent-rgb, 0,212,255),0.45); background: rgba(var(--brand-accent-rgb, 0,212,255),0.12); color: var(--brand-accent, #00d4ff); }

/* Faixa de KPIs de saúde */
.pc-kpi-strip {
    display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px;
}
.pc-kpi {
    display: flex; align-items: center; gap: 10px;
    /* [R340 onda B] mesmo vocabulário premium dos .site-kpi-card (glass + trilho + sombra + hover) */
    background: var(--site-bg-card, rgba(255,255,255,0.03));
    backdrop-filter: var(--site-glass-blur, blur(10px));
    -webkit-backdrop-filter: var(--site-glass-blur, blur(10px));
    border: 1px solid rgba(255,255,255,0.06);
    border-left: 4px solid rgba(var(--brand-accent-rgb, 0,212,255), 0.9);
    border-radius: 16px; padding: 14px 16px; min-width: 0;
    box-sizing: border-box;
    box-shadow: var(--site-shadow-card, 0 8px 32px rgba(0,0,0,0.3));
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1), box-shadow 0.3s cubic-bezier(0.4,0,0.2,1);
}
.pc-kpi:hover {
    transform: translateY(-4px);
    box-shadow: var(--site-shadow-card-hover, 0 16px 48px rgba(0,0,0,0.45));
}
@media (prefers-reduced-motion: reduce) {
    .pc-kpi { transition: none; }
    .pc-kpi:hover { transform: none; }
}
.pc-kpi-ic {
    font-size: 1.15rem; width: 40px; height: 40px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(var(--brand-accent-rgb, 0,212,255),0.08); border-radius: 12px;
}
.pc-kpi-val { color: #fff; font-size: 1.15rem; font-weight: 800; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-kpi-lbl { color: #94a3b8; font-size: 0.68rem; margin-top: 2px; line-height: 1.2; }
.pc-kpi-trend { font-weight: 700; font-size: 0.66rem; }
.pc-kpi-trend.up { color: #10b981; } .pc-kpi-trend.down { color: #ef4444; }
.pc-kpi-muted { color: #64748b; font-weight: 600; }

/* Cards de gráfico */
.pc-grid { display: grid; gap: 20px; }
.pc-grid-2 { grid-template-columns: 1fr 1fr; }
.pc-grid-2-1 { grid-template-columns: 2fr 1fr; }
.pc-card {
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06);
    border-radius: 20px; padding: 20px; backdrop-filter: blur(10px);
}
.pc-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.pc-card-title { color: #f1f5f9; font-size: 1rem; font-weight: 700; margin: 0; }
.pc-card-hint { color: #64748b; font-size: 0.7rem; }
.pc-chart { width: 100%; }

/* Stats do funil */
.pc-funil-stats { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.pc-fstat { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: rgba(255,255,255,0.03); border-radius: 10px; }
.pc-fstat-lbl { color: #94a3b8; font-size: 0.78rem; }
.pc-fstat-val { font-weight: 800; font-size: 0.95rem; }

/* Itens de reativação/prospecção */
.pc-lac-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.05); border-radius: 12px; padding: 12px 14px; }
.pc-lac-nome { color: #e2e8f0; font-weight: 700; font-size: 0.88rem; }
.pc-lac-meta { color: #64748b; font-size: 0.74rem; margin-top: 3px; }
.pc-lac-btn { background: rgba(var(--brand-accent-rgb, 0,212,255),0.1); color: var(--brand-accent, #00d4ff); border: 1px solid rgba(var(--brand-accent-rgb, 0,212,255),0.25); padding: 6px 12px; border-radius: 8px; font-size: 0.75rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
.pc-lac-btn:hover { background: rgba(var(--brand-accent-rgb, 0,212,255),0.18); }

/* ── Responsivo ── */
@media (max-width: 1100px) {
    .pc-kpi-strip { grid-template-columns: repeat(3, 1fr); }
    .pc-grid-2, .pc-grid-2-1 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .pc-kpi-strip { grid-template-columns: repeat(2, 1fr); }
    .pc-hub-title { font-size: 1.1rem; }
    .pc-card { padding: 16px; border-radius: 16px; }
    .pc-kpi { padding: 12px; }
    .pc-kpi-val { font-size: 1rem; }
}
