/* ========================================
   DATA EXPLORER - Professional Dashboard
   Theme: Light with Blue Accent (like screenshot)
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    /* Light theme (default - mirip screenshot) */
    --bg-page:        #f0f2f5;
    --bg-sidebar:     #1c2333;
    --bg-card:        #ffffff;
    --bg-card-hover:  #f8fafc;
    --bg-header:      #ffffff;

    --border-color:   #e5e9f0;
    --border-subtle:  rgba(0,0,0,0.06);

    --text-primary:   #1a202c;
    --text-secondary: #64748b;
    --text-muted:     #a0aec0;
    --text-sidebar:   #a0aec0;
    --text-sidebar-active: #ffffff;

    --brand-blue:     #2563eb;
    --brand-blue-light: #3b82f6;
    --brand-blue-pale: #eff6ff;
    --brand-purple:   #7c3aed;
    --brand-indigo:   #4338ca;

    --accent-danger:  #ef4444;
    --accent-warning: #f59e0b;
    --accent-success: #10b981;
    --accent-info:    #06b6d4;

    --danger-pale:    #fef2f2;
    --warning-pale:   #fffbeb;
    --success-pale:   #ecfdf5;
    --info-pale:      #ecfeff;

    --shadow-sm:      0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:      0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg:      0 8px 24px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.06);
    --shadow-xl:      0 20px 48px rgba(0,0,0,0.12);

    --sidebar-width:  72px;
    --sidebar-expanded: 260px;
    --topbar-height:  64px;

    --radius-sm:      6px;
    --radius-md:      10px;
    --radius-lg:      16px;
    --radius-xl:      20px;

    --transition:     all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --font-primary:   'Inter', 'Outfit', sans-serif;
}

/* Dark mode override */
[data-theme="dark"] {
    --bg-page:        #0d1117;
    --bg-sidebar:     #0d1117;
    --bg-card:        #161b22;
    --bg-card-hover:  #1c2230;
    --bg-header:      #161b22;
    --border-color:   #21262d;
    --border-subtle:  rgba(255,255,255,0.06);
    --text-primary:   #e6edf3;
    --text-secondary: #8b949e;
    --text-muted:     #6e7681;
    --text-sidebar:   #8b949e;
    --text-sidebar-active: #ffffff;
    --brand-blue-pale: rgba(37, 99, 235, 0.15);
    --danger-pale:    rgba(239,68,68,0.12);
    --warning-pale:   rgba(245,158,11,0.12);
    --success-pale:   rgba(16,185,129,0.12);
    --info-pale:      rgba(6,182,212,0.12);
    --shadow-sm:      0 1px 3px rgba(0,0,0,0.3);
    --shadow-md:      0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg:      0 8px 24px rgba(0,0,0,0.5);
}

/* =====================================
   RESET & BASE
===================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-page);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* =====================================
   APP LAYOUT
===================================== */
.app-wrapper {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* =====================================
   SIDEBAR (Icon-based like screenshot)
===================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 0;
    gap: 0.25rem;
    flex-shrink: 0;
    z-index: 100;
    transition: width 0.3s ease;
    border-right: 1px solid rgba(255,255,255,0.05);
    overflow: hidden;
}

.sidebar-logo {
    width: 44px;
    height: 44px;
    background: var(--brand-blue);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(37,99,235,0.4);
}

.sidebar-logo i {
    font-size: 1.4rem;
    color: white;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: 100%;
    padding: 0 0.75rem;
    flex: 1;
}

.sidebar-link {
    width: 100%;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--text-sidebar);
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.sidebar-link:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.sidebar-link.active {
    background: var(--brand-blue);
    color: white;
    box-shadow: 0 4px 12px rgba(37,99,235,0.35);
}

.sidebar-link .tooltip {
    display: none;
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: #1e2a3a;
    color: white;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
    z-index: 999;
    pointer-events: none;
    box-shadow: var(--shadow-lg);
}

.sidebar-link:hover .tooltip {
    display: block;
}

.sidebar-divider {
    width: 40px;
    height: 1px;
    background: rgba(255,255,255,0.07);
    margin: 0.5rem auto;
    flex-shrink: 0;
}

.sidebar-bottom-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.75rem;
    width: 100%;
    padding-bottom: 0.5rem;
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.15);
    flex-shrink: 0;
    cursor: pointer;
}

.sidebar-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* =====================================
   MAIN AREA
===================================== */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-page);
}

/* =====================================
   TOP HEADER
===================================== */
.top-header {
    height: var(--topbar-height);
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    gap: 1rem;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
    z-index: 90;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.page-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.page-title span {
    color: var(--brand-blue);
}

.tab-group {
    display: flex;
    background: var(--bg-page);
    border-radius: var(--radius-lg);
    padding: 4px;
    gap: 2px;
    border: 1px solid var(--border-color);
}

.tab-btn {
    padding: 0.45rem 1.1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.tab-btn.active {
    background: var(--brand-blue);
    color: white;
    box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}

.tab-btn:not(.active):hover {
    background: rgba(37,99,235,0.08);
    color: var(--brand-blue);
}

.header-center {
    flex: 1;
    max-width: 400px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0 1rem;
    height: 38px;
    transition: var(--transition);
}

.search-box:focus-within {
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
    background: var(--bg-card);
}

.search-box i {
    color: var(--text-muted);
    font-size: 1rem;
    flex-shrink: 0;
}

.search-box input {
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    width: 100%;
    outline: none;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
    position: relative;
    flex-shrink: 0;
}

.icon-btn:hover {
    border-color: var(--brand-blue);
    color: var(--brand-blue);
    background: var(--brand-blue-pale);
}

.icon-btn .badge-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--accent-danger);
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}

.lang-btn {
    padding: 0 0.85rem;
    width: auto;
    font-size: 0.78rem;
    font-weight: 600;
    gap: 0.35rem;
    letter-spacing: 0.5px;
}

.btn-preview-report {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 1.1rem;
    background: var(--brand-blue);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(37,99,235,0.25);
    flex-shrink: 0;
}

.btn-preview-report:hover {
    background: var(--brand-indigo);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37,99,235,0.35);
}

.btn-preview-report i {
    font-size: 0.95rem;
}

/* =====================================
   CONTENT WRAPPER (Sub-header + Body)
===================================== */
.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* =====================================
   SUB-HEADER / FILTER BAR (like screenshot)
===================================== */
.filter-bar {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    padding: 0.6rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.filter-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

.filter-select {
    height: 32px;
    padding: 0 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: var(--transition);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 2rem;
}

.filter-select:focus {
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 2px rgba(37,99,235,0.1);
}

.date-range-btns {
    display: flex;
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    flex-shrink: 0;
}

.date-btn {
    height: 32px;
    width: 36px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.date-btn.active {
    background: var(--brand-blue);
    color: white;
}

.date-btn:not(.active):hover {
    background: var(--brand-blue-pale);
    color: var(--brand-blue);
}

.filter-separator {
    height: 24px;
    width: 1px;
    background: var(--border-color);
    flex-shrink: 0;
}

/* =====================================
   MAIN BODY (Sidebar Tree + Content)
===================================== */
.body-area {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Left panel: dataset tree */
.dataset-panel {
    width: 40%;
    min-width: 260px;
    max-width: 420px;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.panel-header {
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.panel-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
}

.panel-icon-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: var(--transition);
}

.panel-icon-btn:hover {
    background: var(--brand-blue-pale);
    color: var(--brand-blue);
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
}

.panel-body::-webkit-scrollbar {
    width: 4px;
}
.panel-body::-webkit-scrollbar-track {
    background: transparent;
}
.panel-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

/* Tree items */
.tree-container {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.tree-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    font-size: 0.83rem;
    border: 1px solid transparent;
    white-space: normal;
    word-break: break-word;
    overflow: visible;
    line-height: 1.4;
}

.tree-item:hover {
    background: var(--brand-blue-pale);
    color: var(--brand-blue);
    border-color: rgba(37,99,235,0.12);
}

.tree-item.active {
    background: var(--brand-blue);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(37,99,235,0.25);
}

.tree-item i {
    font-size: 1.05rem;
    flex-shrink: 0;
}

.tree-item.folder i {
    color: #f59e0b;
}

.tree-item.active i {
    color: white;
}

.tree-item.file i {
    color: var(--brand-blue-light);
}

.tree-item.active.folder i,
.tree-item.active.file i {
    color: white !important;
}

.tree-children {
    display: flex;
    flex-direction: column;
    padding-left: 1.2rem;
    border-left: 2px solid var(--border-color);
    margin-left: 1.1rem;
    margin-top: 1px;
    gap: 1px;
}

/* =====================================
   CONTENT PANEL (main display area)
===================================== */
.content-panel {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* When vis-container is active (class added by JS), disable scroll */
.content-panel.vis-active {
    overflow: hidden;
    padding: 0;
    gap: 0;
}

.content-panel::-webkit-scrollbar {
    width: 6px;
}
.content-panel::-webkit-scrollbar-track {
    background: transparent;
}
.content-panel::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 6px;
}

/* =====================================
   WELCOME / LANDING
===================================== */
.welcome-section {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    animation: fadeSlideUp 0.4s ease-out;
}

.welcome-hero {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 50%, #06b6d4 100%);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    color: white;
    position: relative;
    overflow: hidden;
}

.welcome-hero::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 180px;
    height: 180px;
    background: rgba(255,255,255,0.08);
    border-radius: 50%;
}

.welcome-hero::after {
    content: '';
    position: absolute;
    bottom: -60px;
    right: 60px;
    width: 250px;
    height: 250px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}

.welcome-hero h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
    position: relative;
    z-index: 1;
}

.welcome-hero p {
    font-size: 0.92rem;
    opacity: 0.85;
    max-width: 500px;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

.welcome-hero .hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255,255,255,0.2);
    padding: 0.3rem 0.85rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

/* =====================================
   STATS ROW (like screenshot top row)
===================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
}

@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    cursor: default;
}

.stat-card::after {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    border-radius: 3px 0 0 3px;
    background: var(--stat-color, var(--brand-blue));
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: color-mix(in srgb, var(--stat-color, var(--brand-blue)) 20%, transparent);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.6rem;
}

.stat-value {
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.stat-value i {
    font-size: 1.3rem;
    color: var(--stat-color, var(--brand-blue));
}

.stat-sub {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.stat-sub .trend {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.trend.up   { color: var(--accent-success); }
.trend.down { color: var(--accent-danger); }
.trend.warn { color: var(--accent-warning); }

/* =====================================
   HOW TO USE GUIDE (Penjelasan)
===================================== */
.guide-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.guide-section-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.guide-section-title i {
    color: var(--brand-blue);
    font-size: 1.05rem;
}

.guide-steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

@media (max-width: 1100px) {
    .guide-steps { grid-template-columns: repeat(2, 1fr); }
}

.guide-step {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    padding: 1rem;
    background: var(--bg-page);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    transition: var(--transition);
}

.guide-step:hover {
    border-color: var(--brand-blue);
    background: var(--brand-blue-pale);
    transform: translateY(-1px);
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brand-blue);
    color: white;
    font-size: 0.78rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.step-content h4 {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.step-content p {
    font-size: 0.77rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* =====================================
   CHART EXPLANATION CARDS
===================================== */
.chart-explainer {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.chart-explainer-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chart-explainer-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.chart-explainer-title i {
    font-size: 1.15rem;
    color: var(--brand-blue);
}

.chart-explainer-title h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
}

.chart-explainer-title p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 1px;
}

.chart-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--brand-blue-pale);
    color: var(--brand-blue);
    border: 1px solid rgba(37,99,235,0.15);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.insight-box {
    padding: 1rem 1.25rem;
    background: var(--bg-page);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.insight-box i {
    font-size: 1rem;
    color: var(--brand-blue);
    flex-shrink: 0;
    margin-top: 1px;
}

.insight-box p {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* =====================================
   VISUALIZATION IFRAME WRAPPER
===================================== */
.iframe-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;          /* stretch to fill #vis-container */
    min-height: 0;
}

/* vis-container: fill the content-panel when active */
#vis-container {
    display: flex;
    flex-direction: column;
    position: absolute;
    inset: 0;         /* fill content-panel which becomes position:relative when vis is active */
    overflow: hidden;
}

.iframe-topbar {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-header);
    flex-shrink: 0;
}

.iframe-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.iframe-title i {
    color: var(--brand-blue);
    font-size: 1.05rem;
}

.iframe-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.file-pill {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.75rem;
    background: var(--brand-blue-pale);
    border: 1px solid rgba(37,99,235,0.2);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--brand-blue);
}

.file-pill i {
    font-size: 0.85rem;
}

.iframe-body {
    flex: 1;
    position: relative;
    min-height: 0;       /* allow shrink below content */
    height: 100%;
}

#vis-iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* =====================================
   LOADING & EMPTY STATES
===================================== */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.loading-indicator i {
    font-size: 2.5rem;
    color: var(--brand-blue);
    animation: spin 1.5s linear infinite;
}

.error-state {
    text-align: center;
    padding: 2rem;
    color: var(--accent-danger);
}

.error-state i {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    display: block;
}

.error-state p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

/* =====================================
   MARKDOWN BODY (README content)
===================================== */
.markdown-body {
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 0.875rem;
}

.markdown-body h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.6rem;
    margin-bottom: 1rem;
    letter-spacing: -0.3px;
}

.markdown-body h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--brand-blue);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.markdown-body h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.markdown-body p {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.markdown-body ul, .markdown-body ol {
    color: var(--text-secondary);
    padding-left: 1.5rem;
    margin-bottom: 0.75rem;
}

.markdown-body li {
    margin-bottom: 0.3rem;
}

.markdown-body strong {
    color: var(--text-primary);
    font-weight: 600;
}

.markdown-body code {
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    padding: 0.15rem 0.4rem;
    border-radius: var(--radius-sm);
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.82em;
    color: var(--brand-blue);
}

.markdown-body pre {
    background: var(--bg-sidebar);
    color: #e6edf3;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin-bottom: 1rem;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.82rem;
    line-height: 1.6;
}

.markdown-body pre code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    font-size: 0.82rem;
}

.markdown-body th {
    background: var(--bg-page);
    padding: 0.6rem 0.9rem;
    font-weight: 600;
    text-align: left;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.73rem;
    letter-spacing: 0.5px;
}

.markdown-body td {
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.markdown-body tr:hover td {
    background: var(--bg-page);
}

/* =====================================
   ANIMATIONS
===================================== */
@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}

.animate-fade { animation: fadeSlideUp 0.35s ease-out; }

/* =====================================
   RESPONSIVE
===================================== */
@media (max-width: 1100px) {
    .dataset-panel { width: 240px; }
}

@media (max-width: 900px) {
    .dataset-panel { display: none; }
    .sidebar { width: var(--sidebar-width); }
}

@media (max-width: 768px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .guide-steps { grid-template-columns: 1fr; }
    .top-header { padding: 0 1rem; }
    .content-panel { padding: 1rem; }
    .filter-bar { padding: 0.5rem 1rem; }
}

/* =====================================
   DARK THEME ADJUSTMENTS
===================================== */
[data-theme="dark"] .sidebar {
    background: #0d1117;
    border-right-color: #21262d;
}

[data-theme="dark"] .top-header,
[data-theme="dark"] .filter-bar,
[data-theme="dark"] .iframe-topbar {
    background: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .tree-item.folder i {
    color: #f59e0b;
}

[data-theme="dark"] .welcome-hero {
    background: linear-gradient(135deg, #1e3a5f 0%, #1d4ed8 50%, #0e7490 100%);
}

[data-theme="dark"] .stat-card,
[data-theme="dark"] .guide-section,
[data-theme="dark"] .chart-explainer,
[data-theme="dark"] .iframe-wrapper {
    background: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .search-box {
    background: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .tab-group {
    background: #0d1117;
    border-color: var(--border-color);
}

[data-theme="dark"] .guide-step {
    background: #0d1117;
    border-color: var(--border-color);
}

[data-theme="dark"] .guide-step:hover {
    background: rgba(37,99,235,0.1);
}

[data-theme="dark"] .filter-select {
    background: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b949e' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

[data-theme="dark"] .date-range-btns {
    background: #0d1117;
    border-color: var(--border-color);
}

[data-theme="dark"] .dataset-panel {
    background: var(--bg-card);
    border-right-color: var(--border-color);
}

[data-theme="dark"] .panel-header {
    border-bottom-color: var(--border-color);
}

/* =====================================
   UTILITY CLASSES
===================================== */
.flex { display: flex; }
.items-center { align-items: center; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.text-muted { color: var(--text-muted); }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.85rem; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 0.35rem; }
.hidden { display: none !important; }

/* =====================================
   RESPONSIVE BREAKPOINTS
===================================== */
@media (max-width: 1400px) {
    .dataset-panel {
        width: 35%;
        max-width: 380px;
    }
}

@media (max-width: 1100px) {
    .dataset-panel {
        width: 320px;
        min-width: 260px;
        max-width: 320px;
    }
    .guide-steps {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .dataset-panel {
        width: 260px;
        min-width: 220px;
        max-width: 260px;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .dataset-panel {
        display: none;
    }
    .top-header {
        padding: 0 1rem;
    }
    .content-panel {
        padding: 1rem;
    }
    .filter-bar {
        padding: 0.5rem 1rem;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    .guide-steps {
        grid-template-columns: 1fr;
    }
}
