/**
 * Transaction Progress - Beautiful animated styles for 6-phase transaction processing
 * Modular CSS component with animations and responsive design
 */

/* ===== MAIN CONTAINER ===== */
.transaction-progress-container {
    background: #ffffff;
    border-radius: 8px;
    padding: 24px;
    margin: 16px 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #f5f2ed;
    opacity: 1;
    transform: translateY(0);
    transition: none;
    position: relative;
    overflow: hidden;
}

.transaction-progress-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg, 
        transparent, 
        rgba(255, 255, 255, 0.05), 
        transparent
    );
    animation: shimmer 3s infinite;
    z-index: 1;
}

.transaction-progress-container.active {
    opacity: 1;
    transform: translateY(0);
    border-color: #9a4054;
    box-shadow: 0 0 0 1px #9a4054;
}

.transaction-progress-container.completed {
    background: rgba(243, 244, 246, 0.5);
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: 
        0 1px 3px rgba(16, 185, 129, 0.1),
        0 1px 2px rgba(16, 185, 129, 0.06);
}

.transaction-progress-container.hiding {
    opacity: 0;
    transform: translateY(-20px);
}

/* ===== PROGRESS HEADER ===== */
.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    position: relative;
    z-index: 2;
}

.progress-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    color: #1a1a1a;
    font-size: 1.25rem;
    font-weight: 600;
}

.title-icon {
    font-size: 1.5rem;
    animation: pulse 2s infinite;
}

.progress-summary {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.transaction-counter {
    color: #6b6b6b;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    transition: all 0.2s ease;
}

.transaction-counter.updated {
    color: #10b981;
    transform: scale(1.1);
}

.progress-percentage {
    color: #6b6b6b;
    font-size: 0.875rem;
    font-weight: 500;
}

/* ===== PHASE INDICATOR ===== */
.phase-indicator-container {
    margin-bottom: 24px;
    position: relative;
    z-index: 2;
}

.phase-indicator {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    position: relative;
}

.phase-indicator::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    height: 2px;
    background: rgba(148, 163, 184, 0.2);
    z-index: 0;
}

.phase-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
    z-index: 1;
}

.phase-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #d4d0c8;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    position: relative;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.phase-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: all 0.2s ease;
}

.phase-icon svg {
    width: 18px;
    height: 18px;
}

.phase-progress-ring {
    position: absolute;
    top: -3px;
    left: -3px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: all 0.4s ease;
}

.phase-label {
    text-align: center;
    max-width: 120px;
}

.phase-name {
    color: #6b6b6b;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 2px;
    transition: color 0.3s ease;
}

.phase-description {
    color: #6b6b6b;
    font-size: 0.625rem;
    line-height: 1.2;
    transition: color 0.3s ease;
}

/* Phase States */
.phase-step.completed .phase-circle {
    background: #9a4054;
    border-color: #9a4054;
    box-shadow: none;
}

.phase-step.completed .phase-icon {
    opacity: 1;
}

.phase-step.completed .phase-icon svg {
    stroke: #ffffff;
}

.phase-step.completed .phase-name {
    color: #10b981;
}

.phase-step.active .phase-circle {
    background: #ffffff;
    border-color: #9a4054;
    border-width: 2px;
    box-shadow: 0 0 0 4px rgba(154, 64, 84, 0.1);
    animation: none;
}

.phase-step.active .phase-progress-ring {
    border: 2px solid #3b82f6;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

.phase-step.active .phase-icon {
    opacity: 1;
    animation: none;
}

.phase-step.active .phase-icon svg {
    stroke: #9a4054;
}

.phase-step.active .phase-name {
    color: #c4576a;
}

.phase-step.active .phase-description {
    color: #6b6b6b;
}

/* ===== MAIN PROGRESS SECTION ===== */
.main-progress-section {
    margin-bottom: 24px;
    position: relative;
    z-index: 2;
}

.main-progress-container {
    margin-bottom: 16px;
}

.progress-bar-wrapper {
    position: relative;
    height: 12px;
    margin-bottom: 8px;
}

.progress-bar-track {
    width: 100%;
    height: 8px;
    background: #faf8f5;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    border: none;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: #9a4054;
    border-radius: 4px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-bar-fill::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: progressShimmer 2s infinite;
}

.progress-bar-glow {
    position: absolute;
    top: -4px;
    left: 0;
    width: 0%;
    height: 20px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.progress-bar-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 6px;
    pointer-events: none;
}

.progress-particle {
    position: absolute;
    top: 2px;
    width: 4px;
    height: 8px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 2px;
    animation: particle linear;
}

.progress-markers {
    display: flex;
    justify-content: space-between;
    position: relative;
    height: 4px;
    margin-top: 4px;
}

.progress-marker {
    width: 1px;
    height: 4px;
    background: rgba(148, 163, 184, 0.3);
    position: absolute;
    top: 0;
}

/* ===== CURRENT PHASE DISPLAY ===== */
.current-phase-display {
    background: #ffffff;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #d4d0c8;
}

.current-phase-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.current-phase-icon {
    font-size: 1.5rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 50%;
    border: 2px solid rgba(59, 130, 246, 0.2);
}

.current-phase-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.current-phase-name {
    color: #3d3d3d;
    font-size: 1.125rem;
    font-weight: 600;
}

.current-phase-description {
    color: #6b6b6b;
    font-size: 0.875rem;
}

.phase-spinner {
    width: 32px;
    height: 32px;
    position: relative;
}

.spinner-ring {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(59, 130, 246, 0.2);
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ===== STATS GRID ===== */
.progress-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
    position: relative;
    z-index: 2;
}

.stats-card {
    background: #ffffff;
    border-radius: 8px;
    padding: 16px 12px;
    text-align: center;
    border: 1px solid #d4d0c8;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.5), transparent);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.stats-card:hover::before {
    transform: translateX(0);
}

.stat-icon {
    font-size: 1.25rem;
    margin-bottom: 6px;
    opacity: 0.8;
}

.stat-icon svg {
    display: inline-block;
    vertical-align: middle;
    width: 20px;
    height: 20px;
}

.stat-value {
    color: #3d3d3d;
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    margin-bottom: 4px;
    transition: all 0.3s ease;
}

.stat-value.updating {
    color: #10b981;
    transform: scale(1.1);
}

.stat-label {
    color: #6b6b6b;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Platform-specific stat cards (Xero contacts/tracking, QB vendors/customers/classes) */
.stats-card-platform {
    border: 1px solid #e0f2fe;
    background: linear-gradient(135deg, #ffffff, #f0f9ff);
}

.stats-card-platform::before {
    background: linear-gradient(90deg, transparent, rgba(14, 165, 233, 0.5), transparent);
}

.stats-card-platform:hover {
    border-color: #0ea5e9;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.15);
}

/* ===== PROGRESS FOOTER ===== */
.progress-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 2;
}

.estimated-time {
    color: #6b6b6b;
    font-size: 0.875rem;
    font-weight: 500;
}

.processing-status {
    color: #6b6b6b;
    font-size: 0.875rem;
    font-style: italic;
}

/* ===== ANIMATIONS ===== */
@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

@keyframes progressShimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

@keyframes neonGlow {
    0%, 100% { 
        background-position: 0% 50%;
        filter: brightness(1);
    }
    50% { 
        background-position: 100% 50%;
        filter: brightness(1.1);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-4px); }
    60% { transform: translateY(-2px); }
}

@keyframes activePhase {
    0%, 100% { box-shadow: 0 0 20px rgba(139, 92, 246, 0.4); }
    50% { box-shadow: 0 0 30px rgba(139, 92, 246, 0.6); }
}

@keyframes particle {
    0% { left: 0%; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { left: 100%; opacity: 0; }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .transaction-progress-container {
        padding: 16px;
        margin: 16px 0;
    }
    
    .progress-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .progress-summary {
        align-items: flex-start;
    }
    
    .phase-indicator {
        gap: 4px;
    }
    
    .phase-circle {
        width: 32px;
        height: 32px;
    }
    
    .phase-name {
        font-size: 0.625rem;
    }
    
    .phase-description {
        display: none;
    }
    
    .progress-stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .stats-card {
        padding: 12px 8px;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .current-phase-display {
        padding: 12px;
    }
    
    .current-phase-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
    
    .match-item {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .match-description,
    .match-account {
        flex: 1;
        min-width: 120px;
    }
}

@media (max-width: 480px) {
    .progress-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .phase-label {
        max-width: 80px;
    }
}

/* ===== COMPLETION CONTENT ===== */
.completion-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
}

.completion-message {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.125rem;
    font-weight: 600;
    color: #059669;
}

.success-icon {
    background: #10b981;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.btn-review-transactions {
    background: linear-gradient(135deg, #9a4054, #9a4054);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(154, 64, 84, 0.3);
}

.btn-review-transactions:hover {
    background: linear-gradient(135deg, #c4576a, #c4576a);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(196, 87, 106, 0.4);
}

.btn-review-transactions:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(154, 64, 84, 0.3);
}

@media (max-width: 480px) {
    .completion-content {
        gap: 12px;
    }

    .completion-message {
        font-size: 1rem;
    }

    .btn-review-transactions {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

/* ===== RIQ ENHANCEMENT SECTION ===== */
.riq-enhancement-section {
    margin-top: 20px;
    padding: 16px;
    background: linear-gradient(135deg, #fdf5f7 0%, #fae8ec 50%, #ede9fe 100%);
    border-radius: 12px;
    border: 1px solid #d8b4fe;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.riq-enhancement-section.visible {
    opacity: 1;
    transform: translateY(0);
}

.riq-enhancement-container {
    display: flex;
    align-items: center;
    gap: 16px;
}

.riq-avatar-container {
    position: relative;
    flex-shrink: 0;
}

.riq-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: contain;
    background: white;
    padding: 4px;
    box-shadow: 0 4px 12px rgba(154, 64, 84, 0.2);
    border: 2px solid #d8b4fe;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.riq-enhancement-section.active .riq-avatar {
    animation: riq-pulse 2s ease-in-out infinite;
}

.riq-enhancement-section.completed .riq-avatar {
    border-color: #10b981;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

@keyframes riq-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.riq-thinking-indicator {
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 3px;
    background: white;
    padding: 4px 8px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.riq-enhancement-section.completed .riq-thinking-indicator {
    display: none;
}

.thinking-dot {
    width: 6px;
    height: 6px;
    background: #9a4054;
    border-radius: 50%;
    animation: thinking-bounce 1.4s ease-in-out infinite;
}

.thinking-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.thinking-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes thinking-bounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.riq-enhancement-content {
    flex: 1;
    min-width: 0;
}

.riq-enhancement-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.riq-label {
    font-weight: 600;
    font-size: 14px;
    color: #9a4054;
}

.riq-badge {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    background: linear-gradient(135deg, #9a4054, #9333ea);
    color: white;
    border-radius: 10px;
}

.riq-enhancement-status {
    font-size: 13px;
    color: #4c1d95;
    margin-bottom: 10px;
    min-height: 18px;
}

.riq-enhancement-section.completed .riq-enhancement-status {
    color: #047857;
    font-weight: 500;
}

.riq-enhancement-progress {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.riq-progress-bar {
    height: 6px;
    background: rgba(154, 64, 84, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.riq-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #9a4054, #9333ea, #a855f7);
    border-radius: 3px;
    transition: width 0.5s ease;
    position: relative;
}

.riq-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: shimmer-riq 1.5s infinite;
}

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

.riq-enhancement-section.completed .riq-progress-fill {
    background: linear-gradient(90deg, #10b981, #34d399);
}

.riq-enhancement-section.completed .riq-progress-fill::after {
    animation: none;
}

.riq-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #6b6b6b;
}

.riq-stat-divider {
    color: #c4c0b8;
}

.riq-stat-highlight {
    color: #9a4054;
    font-weight: 600;
}

.riq-stat-highlight.has-enhancements {
    color: #059669;
}

/* Responsive */
@media (max-width: 480px) {
    .riq-enhancement-container {
        flex-direction: column;
        text-align: center;
    }

    .riq-enhancement-header {
        justify-content: center;
    }

    .riq-avatar {
        width: 56px;
        height: 56px;
    }
}