/* ===== Skeleton base ===== */
.chart-card .chart-skeleton {
    position: absolute;
    inset: 12px;
    border-radius: 14px;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: rgba(148, 163, 184, .12);
}

.chart-card .chart-skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .08), transparent);
    transform: translateX(-100%);
    animation: skelSweep 1.1s infinite;
}

@keyframes skelSweep {
    to {
        transform: translateX(100%);
    }
}

/* BAR */
.chart-skeleton .bars {
    width: 88%;
    height: 72%;
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.chart-skeleton .bars .rect {
    flex: 1;
    min-width: 10px;
    border-radius: 10px 10px 0 0;
    background: rgba(255, 255, 255, .12);
}

/* PIE */
.chart-skeleton .pie {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: conic-gradient(rgba(255, 255, 255, .12) 0 25%, rgba(255, 255, 255, .06) 0 50%, rgba(255, 255, 255, .12) 0 75%, rgba(255, 255, 255, .06) 0 100%);
    animation: spinPie 1.4s linear infinite;
}

@keyframes spinPie {
    to {
        transform: rotate(360deg);
    }
}

/* LINE */
.chart-skeleton .line {
    width: 88%;
    height: 72%;
}

.chart-skeleton .line svg {
    width: 100%;
    height: 100%;
}

.chart-skeleton .line polyline {
    fill: none;
    stroke: rgba(255, 255, 255, .20);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chart-skeleton .line circle {
    fill: rgba(255, 255, 255, .18);
}

/* ===== Visual tweak: grid halus + kontras batang ===== */
.chart-card .chart-skeleton {
    background: #eef2f6;
}

.chart-card .chart-skeleton::before {
    content: "";
    position: absolute;
    inset: 16px;
    border-radius: 12px;
    pointer-events: none;
    background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, .06), rgba(0, 0, 0, .06) 1px, transparent 1px, transparent 34px);
}

.chart-card .chart-skeleton::after {
    animation: skelSweep 1.1s linear infinite;
}

/* linear = mulus */
.chart-card .chart-skeleton .bars .rect {
    background: rgba(0, 0, 0, .12);
}

/* dark */
body.dark-mode .chart-card .chart-skeleton {
    background: #0b1220;
}

body.dark-mode .chart-card .chart-skeleton::before {
    background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, .09), rgba(255, 255, 255, .09) 1px, transparent 1px, transparent 34px);
}

body.dark-mode .chart-card .chart-skeleton .bars .rect {
    background: rgba(255, 255, 255, .18);
}

/* layer order */
.chart-card {
    position: relative;
}

.chart-card canvas {
    position: relative;
    z-index: 1;
}

.chart-card .chart-skeleton {
    z-index: 2;
}

/* stop shimmer saat error */
.chart-card .chart-skeleton.no-animate::after {
    animation: none;
    opacity: 0;
}

.chart-card .chart-skeleton.no-animate .pie {
    animation: none;
}

/* gaya kotak error */
.chart-card .chart-skeleton.is-error {
    display: grid;
    place-items: center;
    padding: 12px;
}

.chart-card .chart-skeleton .error-box {
    max-width: 92%;
    border-radius: 10px;
    padding: 10px 12px;
    background: rgba(220, 53, 69, .08);
    border: 1px dashed rgba(220, 53, 69, .35);
    text-align: center;
    line-height: 1.4;
}

.chart-card .chart-skeleton .error-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.chart-card .chart-skeleton .error-msg {
    font-size: .9rem;
    opacity: .85;
    margin-bottom: 8px;
}
