
/* Remove any global fixed gradient overlay on screen */
body::before, body::after {
    display: none !important;
    content: none !important;
}
/* ===================================================
   KONSUMSI IKAN MASYARAKAT — White + Soft Pastel Gradient
   Clean, Modern, Government Enterprise UI
   =================================================== */

/* ------ Page Background ------ */
.kim-page-bg {
    background: linear-gradient(150deg, #f8fafc 0%, #f1f5f9 60%, #f0fdf9 100%);
    min-height: 100vh;
}

/* ------ Page Title ------ */
.kim-page-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
    line-height: 1.3;
}
.kim-page-sub {
    font-size: 0.78rem;
    color: #64748b;
    margin-top: 2px;
}

/* ------ Reset Button ------ */
.kim-reset-btn {
    font-size: 0.78rem;
    font-weight: 600;
    color: #3b82f6;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 6px 16px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: all 0.15s;
    white-space: nowrap;
}
.kim-reset-btn:hover {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #93c5fd;
    box-shadow: 0 2px 6px rgba(59,130,246,0.12);
}

/* ------ Glass / Base Card ------ */
.kim-glass-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(15,23,42,0.03), 0 4px 14px rgba(15,23,42,0.03);
    transition: box-shadow 0.2s;
}
.kim-glass-card:hover {
    box-shadow: 0 4px 18px rgba(15,23,42,0.06);
}

/* ------ Typography ------ */
.kim-section-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #0f172a;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.kim-field-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 5px;
}

/* ------ Select ------ */
.kim-select {
    width: 100%;
    font-size: 0.8rem;
    color: #1e293b;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 7px 30px 7px 10px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 13px;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
    cursor: pointer;
}
.kim-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.14);
}
.kim-select:hover { border-color: #94a3b8; }

/* =============================================
   KPI CARDS — White with Soft Pastel Gradient
   ============================================= */
.kim-kpi-card {
    border-radius: 13px;
    padding: 15px 18px 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 110px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 4px rgba(15,23,42,0.04), 0 4px 12px rgba(15,23,42,0.02);
    transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
    animation: kimFadeUp 0.4s ease both;
    position: relative;
    overflow: hidden;
}
.kim-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(15,23,42,0.08);
}
.kim-kpi-card:nth-child(1) { animation-delay: 0.05s; }
.kim-kpi-card:nth-child(2) { animation-delay: 0.10s; }
.kim-kpi-card:nth-child(3) { animation-delay: 0.15s; }
.kim-kpi-card:nth-child(4) { animation-delay: 0.20s; }

/* Top colored accent line (subtle) */
.kim-kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}

/* Blue — KIM (White with soft pastel blue gradient) */
.kim-kpi-blue {
    background: linear-gradient(135deg, #ffffff 60%, #eff6ff 100%);
    border-color: #dbeafe;
}
.kim-kpi-blue::before { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.kim-kpi-blue:hover { border-color: #bfdbfe; }

/* Teal — Serapan (White with soft pastel teal gradient) */
.kim-kpi-teal {
    background: linear-gradient(135deg, #ffffff 60%, #f0fdfa 100%);
    border-color: #ccfbf1;
}
.kim-kpi-teal::before { background: linear-gradient(90deg, #0d9488, #2dd4bf); }
.kim-kpi-teal:hover { border-color: #99f6e4; }

/* Indigo — Nilai (White with soft pastel indigo gradient) */
.kim-kpi-indigo {
    background: linear-gradient(135deg, #ffffff 60%, #f5f3ff 100%);
    border-color: #ede9fe;
}
.kim-kpi-indigo::before { background: linear-gradient(90deg, #6366f1, #a5b4fc); }
.kim-kpi-indigo:hover { border-color: #ddd6fe; }

/* Amber — Protein (White with soft pastel amber gradient) */
.kim-kpi-amber {
    background: linear-gradient(135deg, #ffffff 60%, #fffbeb 100%);
    border-color: #fef3c7;
}
.kim-kpi-amber::before { background: linear-gradient(90deg, #f59e0b, #fcd34d); }
.kim-kpi-amber:hover { border-color: #fde68a; }

/* KPI Typography */
.kim-kpi-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    line-height: 1.3;
}
.kim-kpi-value {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: #0f172a;
    margin: 4px 0;
}
.kim-kpi-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    flex-wrap: wrap;
}
.kim-kpi-unit {
    font-size: 0.68rem;
    font-weight: 500;
    color: #94a3b8;
}

/* ------ YoY Badge ------ */
.kim-yoy-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 700;
    white-space: nowrap;
}
.kim-yoy-badge.positive { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
.kim-yoy-badge.negative { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.kim-yoy-badge.neutral  { background: #f8fafc; color: #64748b; border: 1px solid #e2e8f0; }

/* =============================================
   CHART & TABLE CONTAINERS
   ============================================= */
.kim-chart-wrap {
    display: flex;
    flex-direction: column;
    height: 520px;
}

/* Header with exact matching height */
.kim-chart-header {
    height: 54px;
    padding: 0 18px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kim-chart-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.kim-chart-header-left .kim-section-label {
    font-size: 0.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 70%, #2563eb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.kim-chart-header-left .kim-section-label::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 13px;
    border-radius: 4px;
    background: #3b82f6;
    flex-shrink: 0;
}

.kim-chart-header-left .kim-chart-sub {
    font-size: 0.68rem;
    color: #64748b;
    font-weight: 600;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 2px 9px;
    border-radius: 20px;
}

/* ------ Legend Pills ------ */
.kim-legend-row {
    display: flex;
    gap: 5px;
    align-items: center;
}

.kim-legend-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.68rem;
    font-weight: 600;
    color: #475569;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    padding: 3px 8px;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}
.kim-legend-pill::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 2px;
    background: var(--dot, #64748b);
    flex-shrink: 0;
}
.kim-legend-pill:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}
.kim-legend-pill.kim-legend-faded {
    opacity: 0.45;
    background: #f8fafc;
}

/* ------ Chart Body ------ */
.kim-chart-body {
    flex: 1;
    padding: 14px 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.kim-chart-body .h-full { height: 100% !important; }

/* =============================================
   TABLE
   ============================================= */
.kim-table-wrap {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
}
.kim-table-wrap::-webkit-scrollbar { width: 4px; height: 4px; }
.kim-table-wrap::-webkit-scrollbar-track { background: transparent; }
.kim-table-wrap::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
.kim-table-wrap::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.kim-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.8rem;
}

.kim-table thead {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #f8fafc;
}

.kim-table thead th {
    height: 48px;
    padding: 6px 12px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #334155;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    vertical-align: middle !important;
    text-align: center;
    white-space: nowrap;
}

.kim-th-sub {
    display: block;
    font-size: 0.58rem;
    font-weight: 500;
    color: #94a3b8;
    text-transform: none;
    letter-spacing: 0;
    line-height: 1;
    margin-top: 2px;
}

.kim-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.12s;
}
.kim-table tbody tr:hover { background: #f8fafc; }

.kim-table tbody td {
    height: 44px;
    padding: 6px 10px;
    color: #1e293b;
    vertical-align: middle !important;
    text-align: center;
    font-size: 0.8rem;
    border-bottom: 1px solid #f1f5f9;
}

/* Explicit Column Alignments */
.kim-table .col-rank { width: 44px; text-align: center !important; }
.kim-table .col-komoditas { text-align: left !important; padding-left: 14px !important; font-weight: 600; color: #334155; }
.kim-table .col-kim { width: 95px; text-align: center !important; font-weight: 600; color: #0f172a; }
.kim-table .col-yoy { width: 85px; text-align: center !important; }
.kim-table .col-serapan { width: 105px; text-align: center !important; font-weight: 500; color: #475569; }
.kim-table .col-proporsi { width: 80px; text-align: center !important; }

/* Rank Badge */
.kim-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px; height: 22px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 800;
    background: #f1f5f9;
    color: #475569;
}
.kim-rank.r1 { background: #fef3c7; color: #78350f; border: 1px solid #fde68a; }
.kim-rank.r2 { background: #f1f5f9; color: #334155; border: 1px solid #cbd5e1; }
.kim-rank.r3 { background: #fed7aa; color: #7c2d12; border: 1px solid #fdba74; }

/* Proporsi Pill */
.kim-proporsi-pill {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(99,102,241,0.08);
    color: #4f46e5;
    font-weight: 700;
    font-size: 0.72rem;
}

/* ------ Animations ------ */
@keyframes kimFadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position:  200% 0; }
}
.shimmer-loading {
    background: linear-gradient(90deg, #f0f4f8 25%, #e8edf2 50%, #f0f4f8 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}
.kim-glass-card { animation: kimFadeUp 0.4s ease both; }

/* Legacy compat */
.konsumsi-card-premium { display: none; }
.wave-bg { display: none; }

/* ------ Responsive ------ */
@media (max-width: 768px) {
    .kim-page-title { font-size: 1.05rem; }
    .kim-kpi-value  { font-size: 1.1rem; }
    .kim-kpi-card   { padding: 12px 13px; }
    .kim-chart-wrap { height: 460px; }
    .kim-chart-header { height: auto; padding: 10px 14px; flex-direction: column; align-items: flex-start; gap: 8px; }
}
@media (max-width: 480px) {
    .kim-kpi-value { font-size: 0.95rem; }
    .kim-title-row { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* =============================================
   LIVE CHART FILTER BUTTONS & ACTIVE TAGS
   ============================================= */
.kim-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.kim-filter-btn .btn-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    transition: background 0.15s ease;
}

.kim-filter-btn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #334155;
}

/* Active states */
.kim-filter-btn.is-active.filter-kim {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}
.kim-filter-btn.is-active.filter-kim .btn-dot { background: #2563eb; }

.kim-filter-btn.is-active.filter-protein {
    background: #fffbeb;
    border-color: #fde68a;
    color: #b45309;
}
.kim-filter-btn.is-active.filter-protein .btn-dot { background: #f59e0b; }

.kim-filter-btn.is-active.filter-serapan {
    background: #f0fdf4;
    border-color: #a7f3d0;
    color: #047857;
}
.kim-filter-btn.is-active.filter-serapan .btn-dot { background: #10b981; }

.kim-filter-btn.is-active.filter-nilai {
    background: #f5f3ff;
    border-color: #ddd6fe;
    color: #6d28d9;
}
.kim-filter-btn.is-active.filter-nilai .btn-dot { background: #8b5cf6; }

/* Active Filter Tags Bar */
.kim-active-filters-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    margin-bottom: 8px;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    flex-wrap: wrap;
    min-height: 30px;
}

.active-bar-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.active-tags-list {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.kim-active-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    animation: kimFadeUp 0.2s ease both;
    cursor: pointer;
}

.kim-active-tag:hover {
    filter: brightness(0.95);
}

.kim-active-tag.tag-kim {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}
.kim-active-tag.tag-protein {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}
.kim-active-tag.tag-serapan {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}
.kim-active-tag.tag-nilai {
    background: #ede9fe;
    color: #5b21b6;
    border: 1px solid #ddd6fe;
}

.chart-canvas-container {
    flex: 1;
    min-height: 0;
    width: 100%;
}
