/* ================================================================
   section_history.css
   Stylesheet untuk Section 2 – Riwayat & Grafik Kualitas Udara

   Urutan bagian:
     1. History Wrapper (layout utama)
     2. Timeline Forecast 24 Jam
     3. Tabel Historis (HD Card)
        3a. Header & Eyebrow
        3b. Toolbar Controls (toggle, export, search)
        3c. Tabel & Status Pill
        3d. Empty State
        3e. Footer & Pagination
     4. Grafik Tren (History Chart)
     5. Responsive (mobile ≤ 600 px)
================================================================ */


/* ================================================================
   1. HISTORY WRAPPER
   Kontainer utama yang membungkus semua elemen section.
================================================================ */
.history-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Card dasar yang dipakai oleh tabel dan grafik */
.history-card-box {
    width: 100%;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 16px 12px 12px;
    box-shadow: 0 4px 12px rgba(1, 21, 63, 0.16);
    overflow: hidden;
}


/* ================================================================
   2. TIMELINE FORECAST 24 JAM
   Card scrollable horizontal berisi kartu per jam.
================================================================ */
.timeline-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 24px 28px 18px;
    box-shadow: 0 4px 12px rgba(1, 21, 63, 0.16);
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.timeline-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

/* Badge "N AQHI sekarang" di pojok kanan header */
.timeline-now-badge {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    align-self: center;
}

/* ── Scroll container ── */
.fc-scroll {
    overflow-x: auto;
    padding-bottom: 6px;
    margin-bottom: 20px;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
.fc-scroll::-webkit-scrollbar        { height: 4px; }
.fc-scroll::-webkit-scrollbar-track  { background: transparent; }
.fc-scroll::-webkit-scrollbar-thumb  { background: #cbd5e1; border-radius: 4px; }

.fc-timeline {
    display: flex;
    gap: 6px;
    min-width: max-content;
    padding: 2px 2px 4px;
}

/* ── Kartu jam ── */
.fc-hour {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 8px;
    min-width: 58px;
    border: 0.5px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.fc-hour:hover  { border-color: #94a3b8; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.fc-hour.active { border-width: 1.5px;   box-shadow: 0 2px 10px rgba(0,0,0,0.08); }

/* Indikator titik pada jam sekarang */
.fc-hour.is-now .fc-h-time::after {
    content: ' ●';
    font-size: 7px;
    vertical-align: middle;
    color: inherit;
}

.fc-h-time  { font-size: 11px; color: #94a3b8; font-weight: 500; }

.fc-h-bar-wrap {
    width: 24px;
    height: 52px;           /* tinggi tetap, batang tumbuh dari bawah */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}
.fc-h-bar {
    width: 18px;
    border-radius: 4px;
    transition: height 0.3s ease;
}

.fc-h-val   { font-size: 12px; font-weight: 600; }
.fc-h-label { font-size: 9px; color: #94a3b8; text-align: center; line-height: 1.2; }


/* ================================================================
   3. TABEL HISTORIS (HD CARD)
================================================================ */

/* Card pembungkus tabel dengan background abu-abu muda */
.hd-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 22px;
    padding: 22px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

/* ── 3a. Header & Eyebrow ── */
.hd-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 24px 28px 18px;
    gap: 16px;
}

.hd-title-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Label kecil di atas judul (mis. "HISTORICAL DATA") */
.hd-eyebrow {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #64748b;
}

.hd-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
}

/* ── 3b. Toolbar Controls ── */
.hd-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 0 28px 14px;
    border-bottom: 1px solid #e2e8f0;
}

/* Toggle Per Jam / Per Hari */
.hd-toggle {
    display: flex;
    background: #f8fafc;
    border: 1px solid #dbe2ea;
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
}

.hd-tab {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
}
.hd-tab.active            { background: #3b82f6; color: #ffffff; }
.hd-tab:not(.active):hover { background: #e2e8f0; color: #0f172a; }

/* Toolbar export icon (copy, csv, excel, pdf, print) */
.hd-export-toolbar { display: flex; align-items: center; gap: 4px; }

.hd-export-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 6px;
    background: transparent;
    color: #64748b;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.hd-export-btn:hover    { background: rgba(148, 163, 184, 0.12); }
.hd-btn-copy:hover      { color: #6366f1; border-color: #6366f1; }
.hd-btn-csv:hover       { color: #10b981; border-color: #10b981; }
.hd-btn-excel:hover     { color: #22c55e; border-color: #22c55e; }
.hd-btn-pdf:hover       { color: #ef4444; border-color: #ef4444; }
.hd-btn-print:hover     { color: #3b82f6; border-color: #3b82f6; }

/* Kotak pencarian */
.hd-search-wrap { position: relative; margin-left: auto; }

.hd-search {
    background: #f8fafc;
    border: 1px solid #dbe2ea;
    border-radius: 40px;
    padding: 9px 36px 9px 38px;
    width: 240px;
    font-size: 13px;
    color: #0f172a;
    outline: none;
    transition: all 0.2s;
}
.hd-search::placeholder { color: #94a3b8; }
.hd-search:focus {
    border-color: #3b82f6;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.hd-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 13px;
    pointer-events: none;
}

.hd-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 13px;
    cursor: pointer;
    display: none;
    line-height: 1;
}
.hd-clear:hover { color: #ef4444; }

/* ── 3c. Inner Table Card ── */

/* Pembungkus putih di dalam hd-card */
.hd-inner-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    overflow: hidden;
    margin-top: 18px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
    transition: box-shadow 0.2s;
}
.hd-inner-card:hover { box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08); }

/* Wrapper tabel dengan scroll dua arah */
.hd-tbl-wrap {
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
}
.hd-tbl-wrap::-webkit-scrollbar       { width: 5px; height: 5px; }
.hd-tbl-wrap::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* Tabel utama */
.hd-tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.hd-tbl thead th {
    padding: 11px 14px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
    background: #f1f5f9;
    text-align: center;
    white-space: nowrap;
    border-bottom: 1px solid #cbe3fc;
    position: sticky;
    top: 0;             /* header tetap terlihat saat scroll vertikal */
}

.hd-tbl tbody tr {
    border-bottom: 1px solid #dfdfdf;
    transition: background 0.12s;
}
.hd-tbl tbody tr:last-child  { border-bottom: none; }
.hd-tbl tbody tr:hover       { background: #f8fafc; }
.hd-tbl tbody tr.today-row   { background: rgba(59, 130, 246, 0.08); }

.hd-tbl td {
    padding: 13px 14px;
    color: #334155;
    font-family: 'DM Mono', 'Fira Mono', monospace;
    font-size: 12.5px;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}

/* Variasi warna kolom khusus */
.hd-tbl td.td-time,
.hd-tbl td.td-date { color: #64748b; font-weight: 600; }
.hd-tbl td.td-aqhi { color: #0f172a; font-weight: 700; }
.hd-tbl td.td-loc  { color: #64748b; font-size: 12px; }

/* ── Status Pill ── */
.pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
}
.pill-low   { background: rgba(59,  130, 246, 0.12); color: #2563eb; }
.pill-mod   { background: rgba(234, 179, 8,   0.15); color: #ca8a04; }
.pill-high  { background: rgba(239, 68,  68,  0.14); color: #dc2626; }
.pill-vhigh { background: rgba(127, 29,  29,  0.18); color: #7f1d1d; }

/* ── 3d. Empty State ── */
.hd-empty {
    display: none;          /* ditampilkan via JS saat filter kosong */
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 48px 20px;
    color: #64748b;
    font-size: 13px;
}
.hd-empty i { font-size: 28px; color: #cbd5e1; }

/* ── 3e. Footer & Pagination ── */
.hd-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border-top: 1px solid #eef2f7;
    background: #fcfdff;
}

.hd-entries {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
}
.hd-entries select {
    border: 1px solid #dbe2ea;
    background: #ffffff;
    border-radius: 10px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    outline: none;
    cursor: pointer;
    transition: 0.15s;
}
.hd-entries select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.hd-footer-info {
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
}


/* ================================================================
   4. GRAFIK TREN (HISTORY CHART)
================================================================ */

/* Header grafik: judul + tombol toggle bar/line */
.daily-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 16px;
    position: relative;
    z-index: 5;         /* pastikan tombol bisa diklik di atas canvas */
}
.daily-card-header h4 { margin: 0; font-size: 22px; font-weight: 700; color: #0f172a; }

/* Toggle bar / line */
.graph-toggle {
    display: flex;
    gap: 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 4px;
    position: relative;
    z-index: 10;
}

.graph-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 10px;
    font-size: 14px;
    color: #64748b;
    cursor: pointer;
    transition: 0.18s ease;
}
.graph-btn.active          { background: #3b82f6; color: #ffffff; box-shadow: 0 4px 10px rgba(59,130,246,0.22); }
.graph-btn:hover:not(.active) { background: #eff6ff; color: #2563eb; }

/* Panel info (nilai aktif + deskripsi) */
.rwh-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.rwh-highlight { display: flex; align-items: center; gap: 10px; }

/* Dot warna metrik aktif */
.rwh-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #f97316;
    flex-shrink: 0;
    transition: background 0.3s;
}

.rwh-val-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rwh-val     { font-size: 15px; font-weight: 600; color: #1e293b; }
.rwh-desc    { font-size: 13px; color: #64748b; }
.rwh-meta    { font-size: 11px; color: #94a3b8; margin-top: 2px; }

/* Grup kanan: tab periode + select metrik */
.rwh-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.rwh-tabs {
    display: flex;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 2px;
    gap: 1px;
}
.rwh-tab          { border: none; background: transparent; font-size: 12px; color: #64748b; padding: 4px 10px; border-radius: 6px; cursor: pointer; transition: all 0.15s; }
.rwh-tab.active   { background: #fff; color: #1e293b; font-weight: 600; border: 0.5px solid #e2e8f0; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }

.rwh-select {
    font-size: 12px;
    color: #1e293b;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 5px 10px;
    cursor: pointer;
    outline: none;
}

/* Card pembungkus canvas */
.mini-chart-card {
    background: #ffffff;
    border: 1px solid #ffffff;
    border-radius: 12px;
    padding: 14px 14px 12px;
    margin: 10px auto 0;
    max-width: 700px;
    position: relative;
    z-index: 1;
}

/* Wrapper canvas dengan tinggi tetap */
.rwh-canvas-wrap {
    position: relative;
    width: 100%;
    height: 240px;
}

#rwhChart { position: relative; z-index: 1; }


/* ================================================================
   5. RESPONSIVE (mobile ≤ 600 px)
================================================================ */
@media (max-width: 600px) {
    .hd-tbl td,
    .hd-tbl th    { padding: 10px 12px; }
    .hd-tbl       { font-size: 12px; }

    .rwh-canvas-wrap { height: 180px; }
    .rwh-controls    { flex-direction: column; align-items: flex-start; }
}