/* <Progress /> — default styling, lm-progress-* convention.
 *
 * One custom prop (--lm-progress-color) drives everything: the bar/arc
 * takes it solid, the track derives from it via color-mix at low opacity —
 * so every color variant (and any theme accent) gets a matching soft
 * track automatically, in light AND dark mode. The data-color rules only
 * swap that one prop. */
.lm-progress {
    --lm-progress-color: var(--lm-main-color, #2563eb);
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.lm-progress[data-type='circular'] {
    display: inline-flex;
    width: auto;
}

/* Linear: pill track + bar */
.lm-progress .lm-progress-track {
    position: relative;
    overflow: hidden;
    flex: 1;
    height: 6px;
    border-radius: 999px;
    background: var(--lm-background-color-highlight, #e5e7eb);
    background: color-mix(in srgb, var(--lm-progress-color) 16%, transparent);
}

.lm-progress .lm-progress-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    border-radius: inherit;
    background: var(--lm-progress-color);
    transition: width 0.3s var(--lm-ease, cubic-bezier(0.4, 0, 0.2, 1));
}

.lm-progress[data-indeterminate='true'] .lm-progress-bar {
    width: 40%;
    transition: none;
    animation: lm-progress-linear-sweep 1.4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes lm-progress-linear-sweep {
    0% {
        left: -40%;
    }
    100% {
        left: 100%;
    }
}

/* Circular: SVG stroke arc */
.lm-progress .lm-progress-circular {
    position: relative;
    display: inline-flex;
    width: 40px;
    height: 40px;
}

.lm-progress .lm-progress-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg); /* arc starts at 12 o'clock */
}

.lm-progress .lm-progress-circle-track {
    stroke: var(--lm-background-color-highlight, #e5e7eb);
    stroke: color-mix(in srgb, var(--lm-progress-color) 16%, transparent);
}

.lm-progress .lm-progress-circle-bar {
    stroke: var(--lm-progress-color);
    stroke-linecap: round;
    transition: stroke-dashoffset 0.3s var(--lm-ease, cubic-bezier(0.4, 0, 0.2, 1));
}

.lm-progress[data-indeterminate='true'] .lm-progress-svg {
    animation: lm-progress-circular-rotate 1.4s linear infinite;
}

@keyframes lm-progress-circular-rotate {
    0% {
        transform: rotate(-90deg);
    }
    100% {
        transform: rotate(270deg);
    }
}

/* Label: beside the linear track, centered inside the circular ring;
   tabular numerals so a running percentage does not jitter */
.lm-progress .lm-progress-label {
    font: 12px/1 system-ui, sans-serif;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    color: var(--lm-font-color, #3f3f46);
}

.lm-progress .lm-progress-circular .lm-progress-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Colors — swap the single driving prop */
.lm-progress[data-color='green'] {
    --lm-progress-color: var(--lm-color-success, #16a34a);
}

.lm-progress[data-color='orange'] {
    --lm-progress-color: var(--lm-color-warning, #ea580c);
}

.lm-progress[data-color='red'] {
    --lm-progress-color: var(--lm-color-danger, #dc2626);
}

.lm-progress[data-color='purple'] {
    --lm-progress-color: var(--lm-color-purple, #9333ea);
}
