/* Cro Timeline Module - Block 9
 * Professional Design with Soft Animations
 * ------------------------------------------------------------------------------------------------------------------ */

.cro-timeline {
    --timeline-primary: var(--color-primary-normal-bg, #497beb);
    --timeline-primary-rgb: 73, 123, 235;
    --timeline-accent: var(--color-accent-normal-bg, #10B981);
    --timeline-accent-rgb: 16, 185, 129;
    --timeline-gray: 148, 163, 184;
}

.cro-timeline {
    background-color: var(--gray-50);
    padding: 3rem 1.5rem;
    overflow: hidden;
}

.cro-timeline .horizontal-timeline-container {
    max-width: 1000px;
    margin: 2rem auto 0;
    position: relative;
}

/* Timeline Nodes Container */
.cro-timeline .timeline-nodes {
    display: flex;
    justify-content: space-between;
    position: relative;
    z-index: 3;
    gap: 0.5rem;
}

/* Connection Line - Behind nodes */
.cro-timeline .timeline-nodes::before {
    content: '';
    position: absolute;
    top: 24px;
    left: 24px;
    right: 24px;
    height: 2px;
    background: rgba(var(--timeline-gray), 0.2);
    z-index: 1;
}

/* Progress Line - Shows completed progress up to current node */
.cro-timeline .timeline-nodes::after {
    content: '';
    position: absolute;
    top: 24px;
    left: 24px;
    height: 3px;
    background: linear-gradient(90deg, var(--timeline-accent), var(--timeline-primary));
    z-index: 2;
    width: 0%;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 2px;
}

/* Progress line width based on current step - instant transition to completed nodes */
.cro-timeline .timeline-nodes[data-step="1"]::after { width: 0%; }
.cro-timeline .timeline-nodes[data-step="2"]::after { width: 25%; }
.cro-timeline .timeline-nodes[data-step="3"]::after { width: 50%; }
.cro-timeline .timeline-nodes[data-step="4"]::after { width: 75%; }
.cro-timeline .timeline-nodes[data-step="5"]::after { width: calc(100% - 48px); }

/* Individual Node */
.cro-timeline .timeline-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    text-align: center;
    flex: 1;
    transition: transform 0.2s ease;
    position: relative;
    z-index: 4;
}

.cro-timeline .timeline-node:hover {
    transform: translateY(-2px);
}

/* Node Circle Wrapper - Positions both circle and progress ring */
.cro-timeline .node-circle-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Active state scales the wrapper for proper progress ring alignment */
.cro-timeline .timeline-node.active .node-circle-wrapper {
    transform: scale(1.15);
    transition: transform 0.3s ease;
}

/* Node Circle - Solid white background to hide line */
.cro-timeline .node-circle {
    width: 48px;
    height: 48px;
    background-color: #fff;
    border: 3px solid rgba(var(--timeline-gray), 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    font-weight: 700;
    color: rgba(var(--timeline-gray), 0.6);
    transition: all 0.3s ease;
    position: relative;
    z-index: 5;
    /* Ensure solid background covers timeline */
    box-shadow: 0 0 0 4px #fff, 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Node Circle with SVG Icon */
.cro-timeline .node-circle.has-icon {
    padding: 8px;
}

.cro-timeline .node-circle-svg {
    width: 22px;
    height: 22px;
    /* Solid color: Color Outline Primary Normal State Background Color (#f5c011) */
    color: var(--color-outline-primary-normal-bg, #f5c011);
    stroke: var(--color-outline-primary-normal-bg, #f5c011);
    stroke-width: 2;
    fill: none;
}

.cro-timeline .node-title {
    margin-top: 0.75rem;
    font-weight: 600;
    color: rgba(var(--timeline-gray), 0.7);
    transition: color 0.3s ease;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* =================================================================
   ACTIVE NODE - Seamless Inward Pulse Animation (5 Circles)
   Uses staggered animations for seamless infinite loop
   ================================================================= */

.cro-timeline .timeline-node.active .node-circle {
    background-color: #fff;
    border: 3px solid var(--timeline-primary);
    overflow: hidden;
    position: relative;
    animation: activeBreath 2s ease-in-out infinite, activeNumberColor 1.2s ease-out forwards;
}

/* =================================================================
   CIRCULAR PROGRESS LOADER - Outside ring that fills over 4s
   Uses SVG stroke-dasharray technique for clock-like animation
   ================================================================= */
.cro-timeline .node-circle-progress {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 62px;
    height: 62px;
    transform: translate(-50%, -50%) rotate(-90deg);
    pointer-events: none;
    z-index: 4;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cro-timeline .timeline-node.active .node-circle-progress {
    opacity: 1;
}

.cro-timeline .node-circle-progress svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* Track circle - 10% opacity background ring */
.cro-timeline .node-circle-progress .progress-track {
    fill: none;
    stroke: var(--timeline-primary);
    stroke-opacity: 0.15;
    stroke-width: 3;
}

/* Progress circle - animated fill with theme primary blue */
.cro-timeline .node-circle-progress .progress-fill {
    fill: none;
    stroke: var(--timeline-primary);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 201;
    stroke-dashoffset: 201;
    filter: drop-shadow(0 0 6px rgba(var(--timeline-primary-rgb), 0.6));
}

.cro-timeline .timeline-node.active .node-circle-progress .progress-fill {
    animation: progressStroke 4s linear forwards;
}

@keyframes progressStroke {
    0% { stroke-dashoffset: 201; }
    100% { stroke-dashoffset: 0; }
}

/* Number color transition: gray → green → blue */
@keyframes activeNumberColor {
    0% { color: rgba(var(--timeline-gray), 0.6); }
    40% { color: var(--timeline-accent); }
    100% { color: var(--timeline-primary); }
}


/* Inward pulse ring 1 - reaches center */
.cro-timeline .timeline-node.active .node-circle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120%;
    height: 120%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(circle, 
        rgba(73, 123, 235, 0.5) 0%, 
        rgba(73, 123, 235, 0.35) 25%, 
        rgba(73, 123, 235, 0.2) 50%, 
        rgba(73, 123, 235, 0.1) 75%, 
        transparent 100%);
    animation: inwardPulseActive 2s ease-in-out infinite;
}

/* Inward pulse ring 2 - offset */
.cro-timeline .timeline-node.active .node-circle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120%;
    height: 120%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(circle, 
        rgba(73, 123, 235, 0.4) 0%, 
        rgba(73, 123, 235, 0.25) 30%, 
        rgba(73, 123, 235, 0.12) 60%, 
        transparent 100%);
    animation: inwardPulseActive 2s ease-in-out infinite 0.5s;
}

/* Inward pulse - contracts to center with full visibility */
@keyframes inwardPulseActive {
    0% { 
        transform: translate(-50%, -50%) scale(1.5); 
        opacity: 0; 
    }
    15% { 
        opacity: 1; 
    }
    85% { 
        opacity: 0.6; 
    }
    100% { 
        transform: translate(-50%, -50%) scale(0.1); 
        opacity: 0; 
    }
}

/* Breathing box-shadow with inset rings */
@keyframes activeBreath {
    0%, 100% {
        box-shadow: 
            0 0 0 4px #fff,
            inset 0 0 0 3px rgba(73, 123, 235, 0.25),
            inset 0 0 0 8px rgba(73, 123, 235, 0.18),
            inset 0 0 0 14px rgba(73, 123, 235, 0.1),
            0 4px 16px rgba(73, 123, 235, 0.25);
    }
    50% {
        box-shadow: 
            0 0 0 4px #fff,
            inset 0 0 0 6px rgba(73, 123, 235, 0.3),
            inset 0 0 0 12px rgba(73, 123, 235, 0.22),
            inset 0 0 0 18px rgba(73, 123, 235, 0.12),
            0 4px 16px rgba(73, 123, 235, 0.25);
    }
}

.cro-timeline .timeline-node.active .node-title {
    color: var(--timeline-primary);
    font-weight: 700;
}

/* =================================================================
   COMPLETED NODES - Green Accent with Subtle Inward Animation
   Same style as active but green, slower, and more subtle
   ================================================================= */

.cro-timeline .timeline-node.completed .node-circle {
    background-color: #fff;
    border-color: var(--timeline-accent);
    color: var(--timeline-accent);
    overflow: hidden;
    position: relative;
    animation: completedBreath 3s ease-in-out infinite;
}

/* Completed node - Inward pulse ring 1 - reaches center */
.cro-timeline .timeline-node.completed .node-circle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 110%;
    height: 110%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(circle, 
        rgba(16, 185, 129, 0.35) 0%, 
        rgba(16, 185, 129, 0.22) 30%, 
        rgba(16, 185, 129, 0.1) 60%, 
        transparent 100%);
    animation: inwardPulseCompleted 3s ease-in-out infinite;
}

/* Completed node - Inward pulse ring 2 - offset */
.cro-timeline .timeline-node.completed .node-circle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 110%;
    height: 110%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(circle, 
        rgba(16, 185, 129, 0.28) 0%, 
        rgba(16, 185, 129, 0.15) 35%, 
        rgba(16, 185, 129, 0.06) 70%, 
        transparent 100%);
    animation: inwardPulseCompleted 3s ease-in-out infinite 0.75s;
}

/* Inward pulse for completed - contracts to center */
@keyframes inwardPulseCompleted {
    0% { 
        transform: translate(-50%, -50%) scale(1.4); 
        opacity: 0; 
    }
    20% { 
        opacity: 0.9; 
    }
    80% { 
        opacity: 0.4; 
    }
    100% { 
        transform: translate(-50%, -50%) scale(0.15); 
        opacity: 0; 
    }
}

/* Completed node breathing - green inset rings */
@keyframes completedBreath {
    0%, 100% {
        box-shadow: 
            0 0 0 4px #fff,
            inset 0 0 0 2px rgba(16, 185, 129, 0.18),
            inset 0 0 0 6px rgba(16, 185, 129, 0.1),
            inset 0 0 0 10px rgba(16, 185, 129, 0.05),
            0 2px 8px rgba(16, 185, 129, 0.15);
    }
    50% {
        box-shadow: 
            0 0 0 4px #fff,
            inset 0 0 0 4px rgba(16, 185, 129, 0.22),
            inset 0 0 0 9px rgba(16, 185, 129, 0.14),
            inset 0 0 0 14px rgba(16, 185, 129, 0.06),
            0 2px 8px rgba(16, 185, 129, 0.15);
    }
}

.cro-timeline .timeline-node.completed .node-title {
    color: var(--timeline-accent);
    font-weight: 600;
}

/* =================================================================
   CONTENT PANES
   ================================================================= */

.cro-timeline .timeline-content-panes {
    margin-top: 2.5rem;
}

.cro-timeline .timeline-pane {
    display: none;
    background: #fff;
    padding: 2rem 1.5rem;
    border-radius: 20px;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.1);
    border-top: 4px solid var(--timeline-primary);
    animation: paneFadeIn 0.4s ease;
    position: relative;
    overflow: hidden;
}

.cro-timeline .timeline-pane.active {
    display: block;
}

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

/* Progress bar removed - using timeline progress line instead */

.cro-timeline .pane-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    text-align: center;
}

/* Icon Container */
.cro-timeline .pane-icon {
    display: flex;
    justify-content: center;
    align-items: center;
}

.cro-timeline .pane-icon-wrapper {
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cro-timeline .pane-icon-inner {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: rgba(var(--timeline-accent-rgb), 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    transition: all 0.3s ease;
    border: 1px solid rgba(var(--timeline-accent-rgb), 0.15);
}

.cro-timeline .pane-icon-inner:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(var(--timeline-accent-rgb), 0.2);
}

.cro-timeline .pane-icon .timeline-svg-icon {
    width: 32px;
    height: 32px;
    filter: brightness(0) saturate(100%) invert(60%) sepia(61%) saturate(476%) hue-rotate(109deg) brightness(93%) contrast(92%);
    transition: transform 0.3s ease;
}

.cro-timeline .pane-icon-inner:hover .timeline-svg-icon {
    transform: scale(1.1);
}

/* Text Content */
.cro-timeline .pane-text h3 {
    font-size: 1.5rem;
    color: var(--color-secondary-normal-bg);
    margin-bottom: 0.5rem;
    font-weight: 800;
}

.cro-timeline .pane-text p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--gray-600);
    margin-bottom: 1rem;
}

/* Highlight Badge */
.cro-timeline .pane-highlight {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(var(--timeline-accent-rgb), 0.08);
    color: var(--timeline-accent);
    font-weight: 600;
    padding: 0.4rem 0.85rem;
    border-radius: 50px;
    font-size: 0.75rem;
    border: 1px solid rgba(var(--timeline-accent-rgb), 0.15);
    transition: all 0.2s ease;
}

.cro-timeline .pane-highlight .highlight-svg-icon {
    width: 12px;
    height: 12px;
    filter: brightness(0) saturate(100%) invert(60%) sepia(61%) saturate(476%) hue-rotate(109deg) brightness(93%) contrast(92%);
    flex-shrink: 0;
}

/* Clickable Highlight Pill - Opens smart-form */
.cro-timeline .pane-highlight-link {
    text-decoration: none;
    cursor: pointer;
}

.cro-timeline .pane-highlight-link:hover {
    background: rgba(var(--timeline-accent-rgb), 0.15);
    border-color: rgba(var(--timeline-accent-rgb), 0.3);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(var(--timeline-accent-rgb), 0.2);
}

.cro-timeline .pane-highlight-link .highlight-arrow {
    flex-shrink: 0;
    opacity: 0.7;
    transition: transform 0.2s ease, opacity 0.2s ease;
    stroke: var(--timeline-accent);
}

.cro-timeline .pane-highlight-link:hover .highlight-arrow {
    transform: translateX(2px);
    opacity: 1;
}

/* CTA Button - Compact Professional Design */
.cro-timeline .pane-cta {
    background: var(--timeline-primary);
    color: #fff;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.25s ease;
    margin-top: 0.75rem;
    box-shadow: 0 2px 8px rgba(var(--timeline-primary-rgb), 0.2);
}

.cro-timeline .pane-cta:hover {
    background: var(--color-primary-hover-bg);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--timeline-primary-rgb), 0.3);
}

.cro-timeline .pane-cta::after {
    content: '→';
    font-size: 0.9em;
    transition: transform 0.2s ease;
}

.cro-timeline .pane-cta:hover::after {
    transform: translateX(3px);
}

/* =================================================================
   RESPONSIVE - Desktop
   ================================================================= */

@media (min-width: 768px) {
    .cro-timeline {
        padding: 4rem 2rem;
    }

    .cro-timeline .timeline-nodes::before,
    .cro-timeline .timeline-nodes::after {
        top: 30px;
        left: 30px;
        right: 30px;
    }

    .cro-timeline .pane-grid {
        grid-template-columns: 100px 1fr;
        text-align: left;
        align-items: flex-start;
        gap: 2rem;
    }

    .cro-timeline .pane-icon {
        justify-content: flex-start;
    }

    .cro-timeline .pane-icon-wrapper {
        width: 90px;
        height: 90px;
    }

    .cro-timeline .pane-icon-inner {
        width: 72px;
        height: 72px;
        border-radius: 20px;
    }

    .cro-timeline .pane-icon .timeline-svg-icon {
        width: 36px;
        height: 36px;
    }

    .cro-timeline .pane-text h3 {
        font-size: 1.75rem;
    }

    .cro-timeline .pane-text p {
        font-size: 1.05rem;
    }

    .cro-timeline .node-circle {
        width: 60px;
        height: 60px;
        font-size: 1.25rem;
    }

    .cro-timeline .node-circle-progress {
        width: 76px;
        height: 76px;
    }

    .cro-timeline .node-title {
        font-size: 0.875rem;
    }

    .cro-timeline .timeline-pane {
        padding: 2.5rem;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .cro-timeline *, .cro-timeline *::before, .cro-timeline *::after {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }
}
