/* =========================================
   ORDER TRACKER WIDGET - OPTIMIZED FOR LIGHTHOUSE
   - Uses only transform/opacity for animations (GPU accelerated)
   - will-change hints for smoother animations
   - content-visibility for lazy rendering
   - Minimal reflows/repaints
   ========================================= */

.ot-tracker-container {
    font-family: system-ui, -apple-system, sans-serif;
    box-sizing: border-box;
    contain: layout style;
}

.ot-tracker-container * {
    box-sizing: border-box;
}

/* GPU acceleration hints - applied only when animated */
.ot-tracker-container.animated .ot-dot,
.ot-tracker-container.animated .ot-step-number,
.ot-tracker-container.animated .ot-arrow,
.ot-tracker-container.animated .ot-step-icon,
.ot-tracker-container.animated .ot-progress-fill {
    will-change: transform, opacity;
}

/* =========================================
   KEYFRAMES - GPU OPTIMIZED (transform/opacity only)
   ========================================= */

@keyframes otPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.9; }
}

@keyframes otBounce {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-6px); }
    50% { transform: translateY(0); }
    75% { transform: translateY(-3px); }
}

@keyframes otArrowSlide {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(5px); }
}

@keyframes otFadeInUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes otScaleBounce {
    0%, 100% { transform: scale(1); }
    30% { transform: scale(1.15); }
    60% { transform: scale(0.95); }
}

@keyframes otShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* =========================================
   STILE 1: MINIMAL LINE
   ========================================= */
.ot-minimal-line {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.ot-minimal-line .ot-step {
    text-align: center;
    flex-shrink: 0;
    min-width: 100px;
}

.ot-minimal-line .ot-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin: 0 auto 12px;
    transform: translateZ(0);
    background: #d1d5db; /* Default inactive */
}

.ot-minimal-line .ot-dot.active,
.ot-minimal-line .ot-dot.completed {
    background: #22c55e; /* Default green */
}

.ot-tracker-container.animated .ot-minimal-line .ot-dot.active {
    animation: otPulse 2s ease-in-out infinite;
}

.ot-minimal-line .ot-line {
    flex: 1;
    max-width: 120px;
    height: 2px;
    margin: 0 10px;
    margin-top: 5px;
    position: relative;
    overflow: hidden;
    background: #d1d5db; /* Default inactive */
}

.ot-minimal-line .ot-line.completed {
    background: #22c55e; /* Default green */
}

/* Shimmer effect - GPU optimized */
.ot-tracker-container.animated .ot-minimal-line .ot-line.completed::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
    animation: otShimmer 2s linear infinite;
}

/* =========================================
   STILE 2: GRADIENT LINE
   ========================================= */
.ot-gradient-line {
    display: flex;
    flex-direction: column;
}

.ot-gradient-line .ot-progress-container {
    margin-bottom: 24px;
}

.ot-gradient-line .ot-progress-bg {
    height: 6px;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    background: #e5e7eb; /* Default track */
}

.ot-gradient-line .ot-progress-fill {
    height: 100%;
    border-radius: 4px;
    position: relative;
    transform-origin: left;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    background: #22c55e; /* Default green */
}

.ot-tracker-container.animated .ot-gradient-line .ot-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: otShimmer 1.5s linear infinite;
}

.ot-gradient-line .ot-steps-row {
    display: flex;
    justify-content: space-between;
}

.ot-gradient-line .ot-step { flex: 1; }
.ot-gradient-line .ot-step:first-child { text-align: left; }
.ot-gradient-line .ot-step:last-child { text-align: right; }
.ot-gradient-line .ot-step:nth-child(2) { text-align: center; }

/* =========================================
   STILE 3: PROGRESS BAR
   ========================================= */
.ot-progress-bar .ot-steps-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
}

.ot-progress-bar .ot-step { flex: 1; }
.ot-progress-bar .ot-step:first-child { text-align: left; }
.ot-progress-bar .ot-step:last-child { text-align: right; }
.ot-progress-bar .ot-step:nth-child(2) { text-align: center; }

.ot-progress-bar .ot-progress-bg {
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    background: #e5e7eb; /* Default track */
}

.ot-progress-bar .ot-progress-fill {
    height: 100%;
    border-radius: 4px;
    position: relative;
    background: #22c55e; /* Default green */
}

.ot-tracker-container.animated .ot-progress-bar .ot-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: otShimmer 1.5s linear infinite;
}

/* =========================================
   STILE 4: COMPACT ROW
   ========================================= */
.ot-compact-row {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
}

.ot-compact-row .ot-step-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.ot-compact-row .ot-step {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ot-compact-row .ot-step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
    transform: translateZ(0);
    background: #d1d5db; /* Default inactive */
}

.ot-compact-row .ot-step-number.active,
.ot-compact-row .ot-step-number.completed {
    background: #22c55e; /* Default green */
}

.ot-tracker-container.animated .ot-compact-row .ot-step-number.active {
    animation: otScaleBounce 2s ease-in-out infinite;
}

.ot-compact-row .ot-step-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ot-compact-row .ot-separator {
    font-size: 24px;
    color: #d1d5db;
    font-weight: 300;
    transform: translateZ(0);
}

.ot-tracker-container.animated .ot-step-group:has(.ot-step.completed) .ot-separator {
    animation: otArrowSlide 1s ease-in-out infinite;
    color: #22c55e;
}

/* =========================================
   STILE 5: SIMPLE ARROWS
   ========================================= */
.ot-simple-arrows {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
}

.ot-simple-arrows .ot-step {
    text-align: center;
    padding: 0 10px;
    transform: translateZ(0);
}

.ot-tracker-container.animated .ot-simple-arrows .ot-step.active {
    animation: otBounce 2s ease-in-out infinite;
}

.ot-simple-arrows .ot-arrow {
    font-size: 24px;
    font-weight: 300;
    display: inline-block;
    transform: translateZ(0);
    color: #d1d5db; /* Default inactive */
}

.ot-simple-arrows .ot-arrow.completed,
.ot-simple-arrows .ot-arrow.active {
    color: #22c55e; /* Default green */
}

.ot-tracker-container.animated .ot-simple-arrows .ot-arrow.completed,
.ot-tracker-container.animated .ot-simple-arrows .ot-arrow.active {
    animation: otArrowSlide 1s ease-in-out infinite;
}

/* =========================================
   ELEMENTI COMUNI
   ========================================= */
.ot-step-label {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.3;
    color: #111827; /* Default dark */
}

.ot-step.active .ot-step-label,
.ot-step.completed .ot-step-label {
    color: #111827;
}

.ot-step.inactive .ot-step-label {
    color: #9ca3af;
}

.ot-step-date {
    font-size: 12px;
    margin-top: 4px;
    color: #6b7280; /* Default gray */
}

.ot-step-icon {
    font-size: 28px;
    margin-bottom: 8px;
    line-height: 1;
    display: inline-block;
    transform: translateZ(0);
}

.ot-tracker-container.animated .ot-step.active .ot-step-icon {
    animation: otBounce 2s ease-in-out infinite;
}

.ot-compact-row .ot-step-icon {
    margin-bottom: 0;
    font-size: 20px;
}

/* =========================================
   STATI
   ========================================= */
.ot-step.inactive {
    opacity: 0.5;
}

.ot-step.active .ot-step-label {
    font-weight: 700;
}

/* =========================================
   HOVER - transform only
   ========================================= */
.ot-step:hover .ot-dot {
    transform: scale(1.4);
}

.ot-step:hover .ot-step-number {
    transform: scale(1.15);
}

.ot-step:hover .ot-step-icon {
    transform: scale(1.2);
}

.ot-simple-arrows .ot-step:hover {
    transform: translateY(-3px);
}

/* =========================================
   FADE IN - Delayed stagger (solo frontend, non editor)
   ========================================= */
.ot-tracker-container.animated.awaiting-view .ot-step {
    opacity: 0;
    transform: translateY(15px);
}

.ot-tracker-container.animated.in-view .ot-step {
    animation: otFadeInUp 0.4s ease-out forwards;
}

.ot-tracker-container.animated.in-view .ot-step:nth-child(1),
.ot-tracker-container.animated.in-view .ot-step-group:nth-child(1) .ot-step { animation-delay: 0s; }
.ot-tracker-container.animated.in-view .ot-step:nth-child(2),
.ot-tracker-container.animated.in-view .ot-step-group:nth-child(2) .ot-step { animation-delay: 0.1s; }
.ot-tracker-container.animated.in-view .ot-step:nth-child(3),
.ot-tracker-container.animated.in-view .ot-step-group:nth-child(3) .ot-step { animation-delay: 0.2s; }

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 768px) {
    .ot-minimal-line {
        flex-direction: column;
        align-items: center;
    }
    
    .ot-minimal-line .ot-line {
        width: 2px;
        height: 30px;
        margin: 10px 0;
        max-width: none;
    }
    
    .ot-simple-arrows {
        flex-direction: column;
        gap: 15px;
    }
    
    .ot-simple-arrows .ot-arrow {
        transform: rotate(90deg);
    }
    
    .ot-tracker-container.animated .ot-simple-arrows .ot-arrow.completed,
    .ot-tracker-container.animated .ot-simple-arrows .ot-arrow.active {
        animation: none;
        transform: rotate(90deg);
    }
    
    .ot-compact-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .ot-compact-row .ot-step-group {
        width: 100%;
    }
    
    .ot-compact-row .ot-separator {
        display: none;
    }
    
    .ot-gradient-line .ot-steps-row,
    .ot-progress-bar .ot-steps-labels {
        flex-direction: column;
        gap: 15px;
    }
    
    .ot-gradient-line .ot-step,
    .ot-progress-bar .ot-step {
        text-align: left !important;
    }
}

@media (max-width: 480px) {
    .ot-step-label { font-size: 13px; }
    .ot-step-date { font-size: 11px; }
    .ot-step-icon { font-size: 24px; }
}

/* =========================================
   REDUCED MOTION - ACCESSIBILITÀ
   ========================================= */
@media (prefers-reduced-motion: reduce) {
    .ot-tracker-container.animated *,
    .ot-tracker-container.animated *::before,
    .ot-tracker-container.animated *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .ot-tracker-container.animated .ot-step {
        opacity: 1;
        transform: none;
    }
}

/* =========================================
   LAYOUT VERTICALE
   ========================================= */
.ot-tracker-container.ot-vertical .ot-tracker-wrapper {
    flex-direction: column;
    align-items: flex-start;
}

.ot-tracker-container.ot-vertical .ot-minimal-line .ot-line {
    width: 2px;
    height: 40px;
    margin: 10px 0 10px 5px;
    max-width: none;
}

.ot-tracker-container.ot-vertical .ot-step {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
    text-align: left;
}

.ot-tracker-container.ot-vertical .ot-minimal-line .ot-dot {
    margin: 0;
}

.ot-tracker-container.ot-vertical .ot-simple-arrows .ot-arrow {
    transform: rotate(90deg);
}

/* =========================================
   SOTTOTITOLI
   ========================================= */
.ot-step-subtitle {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 2px;
    font-weight: 400;
}

.ot-step.active .ot-step-subtitle {
    color: #6b7280;
}

/* =========================================
   ICONE ELEMENTOR
   ========================================= */
.ot-step-icon-elementor {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ot-step-icon-elementor i {
    font-size: inherit;
}

.ot-step-icon-elementor svg {
    width: 1em;
    height: 1em;
    fill: currentColor;
}

/* =========================================
   POSIZIONE ICONE
   ========================================= */
.ot-tracker-container.ot-icon-left .ot-step {
    flex-direction: row;
}

.ot-tracker-container.ot-icon-left .ot-step-icon {
    margin-bottom: 0;
    margin-right: 10px;
}

.ot-tracker-container.ot-icon-right .ot-step {
    flex-direction: row-reverse;
}

.ot-tracker-container.ot-icon-right .ot-step-icon {
    margin-bottom: 0;
    margin-left: 10px;
}

.ot-tracker-container.ot-icon-below .ot-step-icon {
    order: 10;
    margin-bottom: 0;
    margin-top: 8px;
}

/* =========================================
   POSIZIONE DATE
   ========================================= */
.ot-tracker-container.ot-date-above .ot-step-date {
    order: -1;
    margin-top: 0;
    margin-bottom: 4px;
}

.ot-tracker-container.ot-date-inline .ot-step-label {
    display: inline;
}

.ot-tracker-container.ot-date-inline .ot-step-date {
    display: inline;
    margin-left: 8px;
    margin-top: 0;
}

/* =========================================
   STEP CONTENT FLEX
   ========================================= */
.ot-step {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ot-tracker-container.ot-icon-left .ot-step,
.ot-tracker-container.ot-icon-right .ot-step {
    flex-direction: row;
    align-items: center;
}

.ot-tracker-container.ot-icon-left .ot-step .ot-step-content-wrapper,
.ot-tracker-container.ot-icon-right .ot-step .ot-step-content-wrapper {
    display: flex;
    flex-direction: column;
}
