/**
 * HeuriSight Progress System
 * Based on: mockups/apple-redesign/12-simulation-progress.html
 * 
 * Usage:
 *   <div class="hs-progress">
 *     <div class="hs-progress__fill" style="width: 75%"></div>
 *   </div>
 */

/* =============================================================================
   PROGRESS BAR
   ============================================================================= */

.hs-progress {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary, #F5F5F7);
    border-radius: var(--radius-full, 9999px);
    overflow: hidden;
}

.hs-progress__fill {
    height: 100%;
    background: var(--accent, #0071E3);
    border-radius: inherit;
    transition: width var(--duration-normal, 250ms) var(--ease-default);
}

/* =============================================================================
   PROGRESS BAR SIZES
   ============================================================================= */

.hs-progress--xs {
    height: 4px;
}

.hs-progress--sm {
    height: 6px;
}

.hs-progress--lg {
    height: 12px;
}

/* =============================================================================
   PROGRESS BAR VARIANTS
   ============================================================================= */

/* Success - Green */
.hs-progress--success .hs-progress__fill {
    background: var(--success, #34C759);
}

/* Warning - Orange */
.hs-progress--warning .hs-progress__fill {
    background: var(--warning, #FF9500);
}

/* Danger - Red */
.hs-progress--danger .hs-progress__fill {
    background: var(--destructive, #FF3B30);
}

/* Purple */
.hs-progress--purple .hs-progress__fill {
    background: var(--purple, #AF52DE);
}

/* =============================================================================
   PROGRESS BAR WITH LABEL
   ============================================================================= */

.hs-progress-labeled {
    display: flex;
    align-items: center;
    gap: var(--space-3, 12px);
}

.hs-progress-labeled .hs-progress {
    flex: 1;
}

.hs-progress-labeled__value {
    font-size: var(--text-sm, 13px);
    font-weight: 600;
    color: var(--text-primary, #1D1D1F);
    min-width: 40px;
    text-align: right;
}

/* =============================================================================
   INDETERMINATE PROGRESS
   ============================================================================= */

.hs-progress--indeterminate .hs-progress__fill {
    width: 30%;
    animation: hs-progress-indeterminate 1.5s infinite ease-in-out;
}

@keyframes hs-progress-indeterminate {
    0% {
        transform: translateX(-100%);
    }
    50% {
        transform: translateX(200%);
    }
    100% {
        transform: translateX(-100%);
    }
}

/* =============================================================================
   CIRCULAR PROGRESS (Spinner)
   ============================================================================= */

.hs-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 2px solid var(--bg-tertiary, #F5F5F7);
    border-top-color: var(--accent, #0071E3);
    border-radius: 50%;
    animation: hs-spin 0.8s linear infinite;
}

.hs-spinner--sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.hs-spinner--lg {
    width: 32px;
    height: 32px;
    border-width: 3px;
}

.hs-spinner--xl {
    width: 48px;
    height: 48px;
    border-width: 4px;
}

/* Spinner color variants */
.hs-spinner--white {
    border-color: rgba(255, 255, 255, 0.3);
    border-top-color: #FFFFFF;
}

.hs-spinner--success {
    border-top-color: var(--success, #34C759);
}

.hs-spinner--warning {
    border-top-color: var(--warning, #FF9500);
}

.hs-spinner--danger {
    border-top-color: var(--destructive, #FF3B30);
}

@keyframes hs-spin {
    to {
        transform: rotate(360deg);
    }
}

/* =============================================================================
   PROGRESS STEPS
   ============================================================================= */

.hs-steps {
    display: flex;
    align-items: center;
    gap: var(--space-2, 8px);
}

.hs-steps__item {
    display: flex;
    align-items: center;
    gap: var(--space-2, 8px);
}

.hs-steps__number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: var(--text-sm, 13px);
    font-weight: 600;
    background: var(--bg-tertiary, #F5F5F7);
    color: var(--text-secondary, #6E6E73);
}

.hs-steps__item--active .hs-steps__number {
    background: var(--accent, #0071E3);
    color: #FFFFFF;
}

.hs-steps__item--complete .hs-steps__number {
    background: var(--success, #34C759);
    color: #FFFFFF;
}

.hs-steps__label {
    font-size: var(--text-sm, 13px);
    color: var(--text-secondary, #6E6E73);
}

.hs-steps__item--active .hs-steps__label {
    color: var(--text-primary, #1D1D1F);
    font-weight: 500;
}

.hs-steps__connector {
    flex: 1;
    height: 2px;
    background: var(--border-light, rgba(0, 0, 0, 0.06));
    min-width: 24px;
}

.hs-steps__connector--complete {
    background: var(--success, #34C759);
}

/* =============================================================================
   SKELETON LOADER
   ============================================================================= */

.hs-skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-tertiary, #F5F5F7) 25%,
        var(--bg-secondary, #E8E8ED) 50%,
        var(--bg-tertiary, #F5F5F7) 75%
    );
    background-size: 200% 100%;
    animation: hs-skeleton-shimmer 1.5s infinite;
    border-radius: var(--radius-sm, 8px);
}

.hs-skeleton--text {
    height: 16px;
    border-radius: 4px;
}

.hs-skeleton--title {
    height: 24px;
    width: 60%;
}

.hs-skeleton--avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
}

.hs-skeleton--card {
    height: 120px;
}

.hs-skeleton--btn {
    height: 36px;
    width: 100px;
}

@keyframes hs-skeleton-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* =============================================================================
   DARK THEME
   ============================================================================= */

[data-theme="dark"] .hs-progress {
    background: var(--bg-tertiary, #3A3A3C);
}

[data-theme="dark"] .hs-spinner {
    border-color: var(--bg-tertiary, #3A3A3C);
    border-top-color: var(--accent, #0071E3);
}

[data-theme="dark"] .hs-steps__number {
    background: var(--bg-tertiary, #3A3A3C);
}

[data-theme="dark"] .hs-skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-secondary, #2C2C2E) 25%,
        var(--bg-tertiary, #3A3A3C) 50%,
        var(--bg-secondary, #2C2C2E) 75%
    );
    background-size: 200% 100%;
}

/* =============================================================================
   PROGRESS PANEL (Floating Task Panel)
   From: mockups/apple-redesign/09-ui-primitives.html
   ============================================================================= */

.hs-progress-panel {
    background: var(--bg-secondary, #F5F5F7);
    border: 1px solid var(--border-default, rgba(0, 0, 0, 0.1));
    border-radius: var(--radius-md, 12px);
    width: 320px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.hs-progress-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3, 12px) var(--space-4, 16px);
    border-bottom: 1px solid var(--border-default, rgba(0, 0, 0, 0.1));
    background: var(--bg-tertiary, #E8E8ED);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.hs-progress-panel__header-content {
    display: flex;
    align-items: center;
    gap: var(--space-2, 8px);
}

.hs-progress-panel__title {
    font-size: var(--text-sm, 13px);
    font-weight: 600;
    color: var(--text-primary, #1D1D1F);
}

.hs-progress-panel__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: var(--text-xs, 11px);
    font-weight: 600;
    background: var(--accent, #0071E3);
    color: white;
    border-radius: 9px;
}

.hs-progress-panel__body {
    max-height: 240px;
    overflow-y: auto;
}

/* Task Item */
.hs-progress-task {
    display: flex;
    gap: var(--space-3, 12px);
    padding: var(--space-3, 12px) var(--space-4, 16px);
    border-bottom: 1px solid var(--border-default, rgba(0, 0, 0, 0.1));
}

.hs-progress-task:last-child {
    border-bottom: none;
}

.hs-progress-task__icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    color: var(--accent, #0071E3);
}

.hs-progress-task__icon.spinning {
    animation: hs-spin 1s linear infinite;
}

.hs-progress-task__content {
    flex: 1;
    min-width: 0;
}

.hs-progress-task__title {
    font-size: var(--text-sm, 13px);
    font-weight: 500;
    color: var(--text-primary, #1D1D1F);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hs-progress-task__subtitle {
    font-size: var(--text-xs, 11px);
    color: var(--text-tertiary, #86868B);
    margin-top: 2px;
}

.hs-progress-task__bar {
    height: 4px;
    background: var(--bg-tertiary, #E8E8ED);
    border-radius: 2px;
    margin-top: var(--space-2, 8px);
    overflow: hidden;
}

.hs-progress-task__fill {
    height: 100%;
    background: var(--accent, #0071E3);
    border-radius: 2px;
    transition: width 300ms ease-out;
}

.hs-progress-task__meta {
    display: flex;
    justify-content: space-between;
    margin-top: var(--space-1, 4px);
    font-size: var(--text-xs, 11px);
    color: var(--text-tertiary, #86868B);
}

/* Task States */
.hs-progress-task--complete .hs-progress-task__icon { color: var(--success, #34C759); }
.hs-progress-task--complete .hs-progress-task__fill { background: var(--success, #34C759); }

.hs-progress-task--error .hs-progress-task__icon { color: var(--destructive, #FF3B30); }
.hs-progress-task--error .hs-progress-task__fill { background: var(--destructive, #FF3B30); }

/* =============================================================================
   ADDITIONAL SKELETON VARIANTS
   From: mockups/apple-redesign/09-ui-primitives.html
   ============================================================================= */

.skeleton-demo {
    display: flex;
    gap: var(--space-4, 16px);
    padding: var(--space-4, 16px);
    background: var(--bg-secondary, #F5F5F7);
    border-radius: var(--radius-md, 12px);
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--border-default) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: hs-skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-lines {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-2, 8px);
}

.skeleton-line {
    height: 12px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--border-default) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: hs-skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-line-title {
    width: 60%;
    height: 16px;
}

.skeleton-line-text {
    width: 100%;
}

.skeleton-short {
    width: 40%;
}

.skeleton-table {
    display: flex;
    flex-direction: column;
    gap: var(--space-3, 12px);
}

.skeleton-row {
    display: flex;
    gap: var(--space-3, 12px);
}

.skeleton-cell {
    height: 16px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--border-default) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: hs-skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-cell-sm { width: 60px; }
.skeleton-cell-md { width: 100px; }
.skeleton-cell-lg { flex: 1; }

.skeleton-chart {
    display: flex;
    align-items: flex-end;
    gap: var(--space-3, 12px);
    height: 100px;
    padding: var(--space-4, 16px);
    background: var(--bg-secondary, #F5F5F7);
    border-radius: var(--radius-md, 12px);
}

.skeleton-bar {
    flex: 1;
    border-radius: 4px 4px 0 0;
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--border-default) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: hs-skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-kpi {
    display: flex;
    flex-direction: column;
    gap: var(--space-2, 8px);
    padding: var(--space-5, 20px);
    background: var(--bg-secondary, #F5F5F7);
    border-radius: var(--radius-md, 12px);
}

/* =============================================================================
   MASTERY RING
   ============================================================================= */

.mastery-ring {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.mastery-ring svg {
    position: absolute;
    top: 0;
    left: 0;
}

.mastery-ring__bg {
    stroke: var(--border-light, rgba(0, 0, 0, 0.06));
}

.mastery-ring__progress {
    transition: stroke-dashoffset 1s ease-out;
}

.mastery-ring__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.mastery-ring__value {
    font-family: var(--font-display);
    font-size: var(--text-3xl, 28px);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
}

.mastery-ring__label {
    font-size: var(--text-xs, 11px);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary, #86868B);
    margin-top: var(--space-1, 4px);
}

/* =============================================================================
   LEARNING PATH
   ============================================================================= */

.learning-path {
    display: flex;
    flex-direction: column;
}

.learning-path__header {
    margin-bottom: var(--space-4, 16px);
}

.learning-path__title {
    font-size: var(--text-base, 15px);
    font-weight: 600;
    color: var(--text-primary, #1D1D1F);
    margin: 0;
}

.learning-path__steps {
    display: flex;
    flex-direction: column;
}

.learning-path__step {
    display: flex;
    gap: var(--space-4, 16px);
    padding: var(--space-3, 12px) 0;
}

.learning-path__indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.learning-path__icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full, 9999px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--duration-fast, 150ms) var(--ease-default);
}

.learning-path__step--completed .learning-path__icon {
    background: var(--success, #34C759);
    color: white;
}

.learning-path__step--current .learning-path__icon {
    background: var(--accent, #0071E3);
    color: white;
    box-shadow: 0 0 0 4px var(--accent-subtle, rgba(0, 113, 227, 0.15));
}

.learning-path__step--pending .learning-path__icon {
    background: var(--bg-tertiary, #E8E8ED);
    color: var(--text-tertiary, #86868B);
}

.learning-path__step--locked .learning-path__icon {
    background: var(--bg-tertiary, #E8E8ED);
    color: var(--text-tertiary, #86868B);
    opacity: 0.6;
}

.learning-path__connector {
    width: 2px;
    flex: 1;
    min-height: 24px;
    background: var(--border-light, rgba(0, 0, 0, 0.06));
    margin: var(--space-2, 8px) 0;
}

.learning-path__step--completed .learning-path__connector {
    background: var(--success, #34C759);
}

.learning-path__content {
    flex: 1;
    min-width: 0;
    padding-bottom: var(--space-2, 8px);
}

.learning-path__step-title {
    font-size: var(--text-sm, 13px);
    font-weight: 600;
    color: var(--text-primary, #1D1D1F);
    margin: 0 0 var(--space-1, 4px) 0;
}

.learning-path__step--locked .learning-path__step-title {
    color: var(--text-tertiary, #86868B);
}

.learning-path__step-desc {
    font-size: var(--text-sm, 13px);
    color: var(--text-secondary, #6E6E73);
    margin: 0 0 var(--space-2, 8px) 0;
    line-height: 1.4;
}

.learning-path__meta {
    display: flex;
    gap: var(--space-3, 12px);
    font-size: var(--text-xs, 11px);
    color: var(--text-tertiary, #86868B);
    margin-bottom: var(--space-2, 8px);
}

.learning-path__meta span::before {
    content: '•';
    margin-right: var(--space-1, 4px);
}

.learning-path__meta span:first-child::before {
    display: none;
}

.learning-path__progress {
    display: flex;
    align-items: center;
    gap: var(--space-2, 8px);
    margin: var(--space-2, 8px) 0;
}

.learning-path__progress-track {
    flex: 1;
    height: 4px;
    background: var(--bg-tertiary, #E8E8ED);
    border-radius: var(--radius-full, 9999px);
    overflow: hidden;
}

.learning-path__progress-fill {
    height: 100%;
    background: var(--accent, #0071E3);
    border-radius: inherit;
    transition: width var(--duration-normal, 250ms) var(--ease-default);
}

.learning-path__progress-label {
    font-size: var(--text-xs, 11px);
    font-weight: 500;
    color: var(--accent, #0071E3);
    min-width: 32px;
    text-align: right;
}

.learning-path__action {
    margin-top: var(--space-2, 8px);
}

.learning-path__empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-8, 32px);
    text-align: center;
    color: var(--text-tertiary, #86868B);
}

.learning-path__empty-state p {
    margin-top: var(--space-3, 12px);
    font-size: var(--text-sm, 13px);
}

/* Dark theme for mastery ring and learning path */
[data-theme="dark"] .mastery-ring__bg {
    stroke: var(--border-light, rgba(255, 255, 255, 0.08));
}

[data-theme="dark"] .learning-path__step--pending .learning-path__icon,
[data-theme="dark"] .learning-path__step--locked .learning-path__icon {
    background: var(--bg-tertiary, #3A3A3C);
}

[data-theme="dark"] .learning-path__progress-track {
    background: var(--bg-tertiary, #3A3A3C);
}

/* =============================================================================
   REDUCED MOTION
   ============================================================================= */

@media (prefers-reduced-motion: reduce) {
    .hs-progress__fill {
        transition: none;
    }
    
    .hs-progress--indeterminate .hs-progress__fill,
    .hs-spinner,
    .hs-skeleton,
    .hs-progress-task__icon.spinning,
    .skeleton-avatar,
    .skeleton-line,
    .skeleton-cell,
    .skeleton-bar {
        animation: none;
    }
    
    .hs-skeleton,
    .skeleton-avatar,
    .skeleton-line,
    .skeleton-cell,
    .skeleton-bar {
        background: var(--bg-tertiary, #F5F5F7);
    }
    
    .mastery-ring__progress {
        transition: none;
    }
    
    .learning-path__progress-fill {
        transition: none;
    }
}
