/* ---------- GLOBAL ---------- */
.cpb-wrapper {
    position: relative;
    margin-bottom: 30px;
    width: 100%;
}
.cpb-label {
    margin: 0 0 8px 0;
    font-size: 1.1em;
    font-weight: 600;
}
.cpb-number {
    font-weight: bold;
    font-size: 20px;
    z-index: 3;
}

/* ---------- BAR TRACK ---------- */
.cpb-bar {
    width: 100%;
    background: #e6d6cc;
    border-radius: 25px;
    overflow: hidden;
    position: relative;
}
.cpb-bar.horizontal {
    height: 75px;
}
.cpb-bar.vertical {
    height: 250px;
    width: 75px;
    margin: 0 auto;
    border-radius: 25px;
}
.cpb-fill {
    height: 100%;
    width: 0%;
    background: #f39c7b;
    border-radius: 25px;
    transition: width 1.5s ease, height 1.5s ease;
    position: relative;
}
.cpb-bar.vertical .cpb-fill {
    width: 100%;
    height: 0%;
    position: absolute;
    bottom: 0;
    left: 0;
    border-radius: 25px;
}

/* ---------- CIRCULAR ---------- */
.cpb-circle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.cpb-circle-wrap {
    position: relative;
    width: 200px;
    height: 200px;
}
.cpb-circle-wrap svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}
.cpb-circle-bg {
    fill: none;
    stroke: #e6d6cc;
    stroke-width: 15;
}
.cpb-circle-fill {
    fill: none;
    stroke: #f39c7b;
    stroke-width: 15;
    stroke-linecap: round;
    stroke-dasharray: 534.07;
    stroke-dashoffset: 534.07;
    transition: stroke-dashoffset 1.5s ease;
}
.cpb-circle .cpb-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 28px;
}

/* ---------- ICON INSIDE BAR ---------- */
.cpb-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    z-index: 4;
    pointer-events: none;
    opacity: 0.8;
}
.cpb-bar.horizontal .cpb-icon {
    left: 10%;
}
.cpb-bar.vertical .cpb-icon {
    top: 10%;
    left: 50%;
}
.cpb-circle .cpb-icon {
    top: 55%;
    left: 50%;
}

/* ---------- STYLES (Striped / Gradient) ---------- */
.cpb-fill.style-striped {
    background-image: repeating-linear-gradient(
        45deg,
        rgba(255,255,255,0.25) 0px,
        rgba(255,255,255,0.25) 20px,
        transparent 20px,
        transparent 40px
    );
    background-size: 56px 56px;
    animation: move-stripes 1.5s linear infinite;
}
@keyframes move-stripes {
    0% { background-position: 0 0; }
    100% { background-position: 56px 0; }
}
.cpb-fill.style-gradient {
    background: linear-gradient(90deg, #f39c7b, #ff4d4d, #4d79ff, #f39c7b);
    background-size: 300% 100%;
    animation: move-gradient 4s ease infinite;
}
@keyframes move-gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.cpb-circle.style-gradient .cpb-circle-fill {
    stroke: url(#cpb-grad);
}

/* ---------- MILESTONE ---------- */
.cpb-horizontal .cpb-milestone {
    position: absolute;
    top: -10px;
    width: 3px;
    height: calc(100% + 20px);
    background: #222;
    z-index: 5;
    pointer-events: none;
}
.cpb-horizontal .cpb-milestone::after {
    content: "🏁";
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 16px;
}
.cpb-vertical .cpb-milestone {
    position: absolute;
    bottom: 0;
    left: -10px;
    height: 3px;
    width: calc(100% + 20px);
    background: #222;
    z-index: 5;
    pointer-events: none;
}
.cpb-vertical .cpb-milestone::after {
    content: "🏁";
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
}
.cpb-circle .cpb-milestone {
    position: absolute;
    pointer-events: none;
    z-index: 5;
}
.cpb-circle .cpb-milestone::after {
    content: "🏁";
    font-size: 22px;
}

/* ---------- GROUP ---------- */
.cpb-group {
    display: grid;
    gap: 30px;
}
.cpb-group-cols-2 { grid-template-columns: 1fr 1fr; }
.cpb-group-cols-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 768px) {
    .cpb-group-cols-2, .cpb-group-cols-3 { grid-template-columns: 1fr; }
}

/* ---------- TRIGGERS ---------- */
.cpb-trigger-hover .cpb-fill,
.cpb-trigger-hover .cpb-circle-fill {
    transition: none !important;
}
.cpb-trigger-hover:hover .cpb-fill {
    transition: width 1.5s ease !important;
}
.cpb-trigger-hover:hover .cpb-circle-fill {
    transition: stroke-dashoffset 1.5s ease !important;
}
.cpb-trigger-click .cpb-fill,
.cpb-trigger-click .cpb-circle-fill {
    transition: none !important;
}
.cpb-trigger-click.active .cpb-fill {
    transition: width 1.5s ease !important;
}
.cpb-trigger-click.active .cpb-circle-fill {
    transition: stroke-dashoffset 1.5s ease !important;
}

/* ---------- READING MODE (sticky) ---------- */
.cpb-mode-reading {
    position: sticky;
    top: 0;
    z-index: 999;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(4px);
    padding: 10px 20px;
    margin: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.cpb-mode-reading .cpb-label {
    margin-bottom: 4px;
}

/* ---------- CONFETTI ---------- */
.cpb-confetti-piece {
    position: fixed;
    width: 10px;
    height: 10px;
    z-index: 9999;
    pointer-events: none;
    top: 50%;
    left: 50%;
    animation: confetti-fall 1.5s ease-out forwards;
}
@keyframes confetti-fall {
    0% { opacity: 1; transform: translateY(0) rotate(0deg) scale(1); }
    100% { opacity: 0; transform: translateY(calc(-100vh - 100px)) rotate(720deg) scale(0.4); }
}

/* ---------- THEME.JSON VAR FALLBACK (Tier 4) ---------- */
.cpb-fill {
    background: var(--cpb-color, #f39c7b);
}
.cpb-circle-fill {
    stroke: var(--cpb-color, #f39c7b);
}



/* ============================================================
   CHARTS
   ============================================================ */
.cpb-chart-wrapper {
    margin: 20px 0;
    position: relative;
    border-radius: 8px;
    transition: box-shadow 0.3s ease;
}

.cpb-chart-wrapper:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.cpb-chart-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #1d2327;
    text-align: center;
}

.cpb-chart-wrapper canvas {
    max-width: 100%;
    border-radius: 8px;
    background: #fff;
}

/* Responsive charts */
@media (max-width: 768px) {
    .cpb-chart-wrapper {
        height: 250px !important;
    }
    .cpb-chart-title {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .cpb-chart-wrapper {
        height: 200px !important;
        padding: 10px !important;
    }
    .cpb-chart-title {
        font-size: 14px;
    }
}


/* 3-column layout for admin */
@media (max-width: 1200px) {
    .cpb-admin-wrap .cpb-grid-3 {
        grid-template-columns: 1fr 1fr !important;
    }
}

@media (max-width: 768px) {
    .cpb-admin-wrap .cpb-grid-3 {
        grid-template-columns: 1fr !important;
    }
}