/* ── EXPLORER HEADER ── */
.explorer-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.5rem;
}

.explorer-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.explorer-subtitle {
    font-size: 14px;
    color: var(--text-tertiary);
    margin-top: 6px;
}

.back-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--blue);
    text-decoration: none;
    transition: color 0.2s;
}
.back-link:hover { color: var(--text-primary); }

/* ── TOOLBAR ── */
.explorer-toolbar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;  /* stack rows vertically */
    gap: 0;
    transition: background 0.2s, border-color 0.2s;
}

/* Top row: dataset, metric, dates, export */
.toolbar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1.5rem;
}

/* Bottom row: fuel checkboxes — only visible for prices dataset */
.toolbar-fuel-row {
    display: none;           /* shown by JS when dataset = prices */
    padding-top: 1.25rem;
    margin-top: 1.25rem;
    border-top: 1px solid var(--border);
    flex-direction: column;
    gap: 0.5rem;
}

.toolbar-fuel-row.visible { display: flex; }

.form-group {
    flex: 1;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.row-group {
    flex-direction: row;
    gap: 1rem;
}

.form-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.form-control {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--surface2);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    outline: none;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
    width: 100%;
}

.form-control:focus {
    border-color: var(--blue);
    background: var(--surface);
}

/* Date picker calendar icon in dark mode */
[data-theme="dark"] .form-control::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.6;
}

/* ── FUEL CHECKBOX GROUP ── */
/* Replaces the single <select> with a scrollable checkbox list */
.fuel-checkbox-group {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px 20px;
    padding: 4px 0;
    /* No max-height — expands naturally in its own row */
}

.fuel-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 0;
    transition: color 0.15s;
    user-select: none;
}

.fuel-checkbox-label:hover { color: var(--text-primary); }

.fuel-checkbox-label input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--blue);
    cursor: pointer;
    flex-shrink: 0;
}

.fuel-select-all {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--blue);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    font-family: 'Space Grotesk', sans-serif;
    margin-bottom: 4px;
    align-self: flex-start;
}

.fuel-select-all:hover { opacity: 0.7; }

/* ── METRIC SELECTOR ── */
/* Shown when dataset = prices */
.metric-group {
    display: none; /* shown via JS */
}

/* ── TOOLBAR META ROW ── */
/* Result count + export button aligned to the right of the toolbar */
.toolbar-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
    flex-shrink: 0;
}

.result-count {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    color: var(--text-tertiary);
    white-space: nowrap;
}

/* ── EXPORT BUTTON ── */
.btn-export {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--text-primary);
    color: var(--bg);
    border: none;
    border-radius: 8px;
    padding: 0.625rem 1.125rem;
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.btn-export:hover    { opacity: 0.75; }
.btn-export:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-export svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* ── CHART CARD ── */
.chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    transition: background 0.2s, border-color 0.2s;
}

/* ── PRICES / DATA TABLE CARD ── */
.prices-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    transition: background 0.2s, border-color 0.2s;
}

.prices-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.125rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface2);
}

.prices-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-primary);
}

.prices-meta { display: flex; align-items: center; gap: 10px; }

.prices-legend { font-size: 13px; color: var(--text-secondary); }

.eppo-badge {
    background: var(--blue-bg);
    border: 1px solid var(--blue-border);
    border-radius: 5px;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--blue);
}

/* ── TABLE SCROLL WRAPPER ── */
/* Prevents wide tables overflowing the card on small viewports */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Subtle scrollbar styling */
.table-scroll::-webkit-scrollbar { height: 4px; }
.table-scroll::-webkit-scrollbar-track { background: transparent; }
.table-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

/* ── PRICE TABLE ── */
.price-table {
    width: 100%;
    border-collapse: collapse;
    /* Prevent table from squishing below readable width */
    min-width: 720px;
}

.price-table thead th {
    padding: 0.625rem 1.5rem;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    text-align: right;
    border-bottom: 1px solid var(--border);
    background: var(--surface2);
    white-space: nowrap;
}

.price-table thead th:first-child { text-align: left; }

.price-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}

.price-table tbody tr:last-child { border-bottom: none; }
.price-table tbody tr:hover { background: var(--surface2); }

.price-table td {
    padding: 0.9rem 1.5rem;
    font-size: 14px;
    text-align: right;
    color: var(--text-secondary);
    white-space: nowrap;
}

.price-table td:first-child {
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
}

/* Monospace numeric cells — replaces inline style="font-family:..." */
.price-table td.mono,
.mono {
    font-family: 'Space Mono', monospace;
    font-size: 13px;
}

.price-table td.retail {
    font-family: 'Space Mono', monospace;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

/* ── OIL FUND PILLS ── */
.oil-pill {
    display: inline-block;
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
}

.oil-pill.subsidy { background: var(--red-bg);     color: var(--red);           border: 1px solid var(--red-border);     }
.oil-pill.levy    { background: var(--green-bg);   color: var(--green);         border: 1px solid var(--green-border);   }
.oil-pill.neutral { background: var(--neutral-bg); color: var(--text-tertiary); border: 1px solid var(--neutral-border); }

/* ── EMPTY STATE ── */
.empty-cell {
    padding: 2.5rem !important;
    text-align: center !important;
    color: var(--text-tertiary);
    font-size: 13px;
}

/* ── UTILITY ── */
.hidden { display: none !important; }