/* InsightPulse — dashboard
 * Vertical layout: tabs (top) → chart grid (middle) → Chart Generator (bottom)
 */

.ip-dashboard {
    display: flex;
    flex-direction: column;
    gap: 22px;
    font-family: inherit;
    color: var(--ip-ink, #e7efe9);
    background: var(--ip-bg, #070d0b);
    padding: 22px;
    border-radius: 14px;
    box-sizing: border-box;
}
.ip-dashboard * { box-sizing: border-box; }

/* ── Top tabs (parent categories) ────────────────────────── */
.ip-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    border-bottom: 1px solid var(--ip-line, #1c2b25);
     scrollbar-width: thin;                                           /* Firefox */
    scrollbar-color: #1c2b25 transparent;
        padding-bottom: 10px;
}
.ip-tabs::-webkit-scrollbar {
    height: 6px;
}
.ip-tabs::-webkit-scrollbar-track {
    background: var(--ip-line, #1c2b25);
    border-radius: 10px;
}
.ip-tabs::-webkit-scrollbar-thumb {
    background: var(--ip-accent, #39d3a8);
    border-radius: 10px;
}
.ip-tabs::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--ip-accent, #39d3a8) 80%, #fff 20%);
}
.ip-tab {
    padding: 12px 18px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--ip-muted, #7e948b);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
}
.ip-tab:hover { color: var(--ip-ink, #e7efe9); }
.ip-tab.active {
    color: var(--ip-accent, #39d3a8);
    border-bottom-color: var(--ip-accent, #39d3a8);
}

/* Category dropdown (replaces the scrolling tab strip when there are many categories) */
.ip-tab-select {
    width: 100%;
    max-width: 460px;
    padding: 12px 14px;
    background: var(--ip-card, #0c1512);
    color: var(--ip-ink, #e7efe9);
    border: 1px solid var(--ip-line, #1c2b25);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.ip-tab-select:focus { outline: none; border-color: var(--ip-accent, #39d3a8); }
.ip-tab-select option { color: #111; background: #fff; }   /* native menu is light */

/* ── Middle: chart grid (2 columns, 6 per page) ──────────── */
.ip-display { min-width: 0; }
.ip-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}
.ip-dashboard-card {
    background: var(--ip-card, #0c1512);
    border: 1px solid var(--ip-line, #1c2b25);
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}
.ip-dashboard-canvas-wrap {
    position: relative;
}

/* Empty state */
.ip-dash-empty {
    background: var(--ip-card, #0c1512);
    border: 1px dashed var(--ip-line, #1c2b25);
    border-radius: 16px;
    padding: 48px 24px;
    text-align: center;
    color: var(--ip-ink, #e7efe9);
}
.ip-dash-empty p { margin: 0; font-size: 16px; font-weight: 600; }

/* ── Pagination ──────────────────────────────────────────── */
.ip-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 24px;
}
.ip-page-info { font-size: 13px; color: var(--ip-muted, #7e948b); }
.ip-page-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ip-page-btn {
    min-width: 38px;
    padding: 8px 12px;
    background: var(--ip-card, #0c1512);
    border: 1px solid var(--ip-line, #1c2b25);
    color: var(--ip-ink, #e7efe9);
    border-radius: 9px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.ip-page-btn:hover:not(:disabled) { border-color: var(--ip-accent, #39d3a8); }
.ip-page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ip-page-btn.active {
    background: var(--ip-accent, #39d3a8);
    border-color: var(--ip-accent, #39d3a8);
    color: #00120c;
}
.ip-page-dots { padding: 0 4px; color: var(--ip-muted, #7e948b); }

/* ── Bottom: Chart Generator panel ───────────────────────── */
.ip-generator {
    background: var(--ip-card, #0c1512);
    border: 1px solid var(--ip-line, #1c2b25);
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.ip-gen-title {
    font-size: 19px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 18px;
    color: var(--ip-ink, #e7efe9);
}

/* Category / chart filter box */
.ip-gen-search {
    width: 100%;
    padding: 11px 14px;
    margin-bottom: 14px;
    background: var(--ip-bg, #070d0b);
    border: 1px solid var(--ip-line, #1c2b25);
    border-radius: 10px;
    color: var(--ip-ink, #e7efe9);
    font-size: 14px;
}
.ip-gen-search::placeholder { color: var(--ip-muted, #7e948b); }
.ip-gen-search:focus { outline: none; border-color: var(--ip-accent, #39d3a8); }

.ip-acc-list { display: flex; flex-direction: column; gap: 2px; }

/* Accordion — parent */
.ip-acc-parent { border-radius: 10px; }
.ip-acc-parent-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 6px 4px 10px;
    border-radius: 10px;
    transition: background 0.15s;
}
.ip-acc-parent-row:hover { background: rgba(255, 255, 255, 0.04); }
.ip-acc-parent-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    min-width: 0;
    background: none;
    border: none;
    color: var(--ip-ink, #e7efe9);
    padding: 12px 4px 12px 0;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
}
.ip-acc-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ip-caret {
    display: inline-flex;
    color: var(--ip-muted, #7e948b);
    margin-left: 8px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}
.ip-caret.open { transform: rotate(180deg); color: var(--ip-accent, #39d3a8); }

/* Accordion — children */
.ip-acc-children {
    display: none;
    padding: 2px 0 8px 18px;
    margin-left: 12px;
    border-left: 1px solid var(--ip-line, #1c2b25);
}
.ip-acc-parent.expanded .ip-acc-children { display: block; }

.ip-acc-child { margin-bottom: 2px; }
.ip-acc-child-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 6px 7px 4px;
    border-radius: 8px;
    transition: background 0.15s;
}
.ip-acc-child-row:hover { background: rgba(255, 255, 255, 0.04); }
.ip-acc-child-label {
    flex: 1;
    min-width: 0;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ip-muted, #7e948b);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Individual chart rows */
.ip-acc-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13.5px;
    padding: 7px 6px 7px 4px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--ip-ink, #e7efe9);
    transition: background 0.15s;
}
.ip-acc-item:hover { background: rgba(255, 255, 255, 0.04); }
.ip-acc-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Checkboxes */
.ip-cb {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--ip-accent, #39d3a8);
    cursor: pointer;
}

/* Download buttons */
.ip-gen-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--ip-line, #1c2b25);
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.ip-dl-btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    color: #fff;
    transition: transform 0.12s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.ip-dl-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35); }
.ip-dl-btn:active:not(:disabled) { transform: translateY(0); }
.ip-dl-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.ip-dl-pdf {
    background: var(--ip-accent, #39d3a8);
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--ip-accent, #39d3a8) 88%, #fff 12%),
        color-mix(in srgb, var(--ip-accent, #39d3a8) 78%, #000 22%));
    color: #00120c;
}
.ip-dl-xls {
    background: var(--ip-card, #0c1512);
    border: 1px solid color-mix(in srgb, var(--ip-accent, #39d3a8) 55%, transparent);
    color: var(--ip-ink, #e7efe9);
}

/* Link to the standalone Chart Generator page */
.ip-dash-footer { display: flex; justify-content: center; margin-top: 4px; }
.ip-generator-link {
    display: inline-block;
    padding: 14px 30px;
    background: var(--ip-accent, #39d3a8);
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--ip-accent, #39d3a8) 88%, #fff 12%),
        color-mix(in srgb, var(--ip-accent, #39d3a8) 78%, #000 22%));
    color: #00120c;
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    border-radius: 12px;
    transition: transform 0.12s ease, box-shadow 0.2s ease;
}
.ip-generator-link:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35); }
.ip-generator-link:active { transform: translateY(0); }

/* ── Print layout for PDF (fixed A4, not responsive) ─────── */
.ip-print-layout {
    position: absolute;
    top: -9999px;
    left: -9999px;
    width: 794px;            /* A4 width at 96 DPI */
    background: #fff;
    color: #000;
}
.ip-print-page {
    width: 794px;
    height: 1123px;          /* A4 height at 96 DPI */
    padding: 40px;
    box-sizing: border-box;
    page-break-after: always;
    position: relative;
}
.ip-print-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}
.ip-print-chart-card {
    margin-bottom: 40px;
    page-break-inside: avoid;
}
.ip-print-chart-card h3 { margin: 0 0 10px; font-size: 16px; color: #333; }
.ip-print-canvas-wrap { height: 350px; width: 100%; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
    .ip-charts-grid { grid-template-columns: 1fr; }   /* single column on tablets/phones */
}

@media (max-width: 768px) {
    .ip-dashboard { padding: 14px; gap: 16px; }
    .ip-tab { padding: 10px 14px; font-size: 12px; }
}

@media (max-width: 420px) {
    .ip-dashboard { padding: 10px; }
    .ip-dashboard-card { padding: 12px;         min-width: 100% !important;}
    .ip-generator { padding: 16px; }
}
