/* ============================================================================
   CUSTOM ANIMATIONS & TRANSITIONS
   ============================================================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes draw {
    from {
        stroke-dashoffset: 1000;
    }
    to {
        stroke-dashoffset: 0;
    }
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

.fade-in {
    animation: fadeIn 0.8s ease-out forwards;
}

.slide-in-right {
    animation: slideInRight 0.8s ease-out forwards;
}

.slide-in-left {
    animation: slideInLeft 0.8s ease-out forwards;
}

.float {
    animation: float 3s ease-in-out infinite;
}

/* ============================================================================
   NAVIGATION
   ============================================================================ */

.nav-btn {
    position: relative;
    color: #64748b;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    color: #3b82f6;
}

.nav-btn.active {
    color: #3b82f6;
    font-weight: 600;
}

.nav-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    border-radius: 2px;
}

/* Dark mode navigation */
.dark .nav-btn {
    color: #94a3b8;
}

.dark .nav-btn:hover,
.dark .nav-btn.active {
    color: #60a5fa;
}

/* ============================================================================
   CARDS & CONTAINERS
   ============================================================================ */

.stat-card {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.1), transparent);
    transition: left 0.5s ease;
}

.stat-card:hover::before {
    left: 100%;
}

.feature-card {
    position: relative;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.feature-card:hover {
    transform: translateY(-5px);
    border-color: #3b82f6;
}

.dark .feature-card:hover {
    border-color: #60a5fa;
}

/* ============================================================================
   FLOW DIAGRAMS
   ============================================================================ */

.flow-container {
    position: relative;
    padding: 2rem;
    background: #f8fafc;
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

.dark .flow-container {
    background: #0f172a;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid #334155;
}

.flow-step {
    position: relative;
    padding: 1.5rem;
    background: white;
    border-radius: 0.75rem;
    border: 3px solid #cbd5e1;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.dark .flow-step {
    background: #1e293b;
    border-color: #475569;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.flow-step:hover {
    transform: scale(1.05);
    border-color: #3b82f6;
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.2);
}

.flow-step.active {
    background: #eff6ff;
    border-color: #3b82f6;
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.3);
}

.dark .flow-step.active {
    background: #1e3a8a;
    border-color: #60a5fa;
    box-shadow: 0 10px 30px rgba(96, 165, 250, 0.5);
}

.flow-arrow {
    position: relative;
    height: 3px;
    background: linear-gradient(90deg, #cbd5e1, #3b82f6);
    margin: 1rem 0;
}

.dark .flow-arrow {
    background: linear-gradient(90deg, #475569, #60a5fa);
}

.flow-arrow::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid #3b82f6;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

.dark .flow-arrow::after {
    border-left-color: #60a5fa;
}

.flow-vertical-arrow {
    position: relative;
    width: 3px;
    height: 40px;
    background: linear-gradient(180deg, #cbd5e1, #3b82f6);
    margin: 0 auto;
}

.dark .flow-vertical-arrow {
    background: linear-gradient(180deg, #475569, #60a5fa);
}

.flow-vertical-arrow::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-top: 8px solid #3b82f6;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
}

.dark .flow-vertical-arrow::after {
    border-top-color: #60a5fa;
}

/* ============================================================================
   STEP ICONS
   ============================================================================ */

.step-icon {
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
}

.step-icon.blue {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.step-icon.purple {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
}

.step-icon.green {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.step-icon.orange {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.step-icon.red {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.step-icon.pink {
    background: linear-gradient(135deg, #ec4899, #db2777);
    color: white;
}

.flow-step:hover .step-icon {
    transform: scale(1.1) rotate(5deg);
}

/* ============================================================================
   TOOLTIP
   ============================================================================ */

.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltip-text {
    visibility: hidden;
    position: absolute;
    z-index: 100;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background-color: #1e293b;
    color: white;
    text-align: center;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    transition: all 0.3s ease;
}

.tooltip .tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #1e293b transparent transparent transparent;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* ============================================================================
   BADGE
   ============================================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 1rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-blue {
    background-color: #3b82f6;
    color: white;
}

.dark .badge-blue {
    background-color: #2563eb;
    color: white;
}

.badge-green {
    background-color: #10b981;
    color: white;
}

.dark .badge-green {
    background-color: #059669;
    color: white;
}

.badge-purple {
    background-color: #8b5cf6;
    color: white;
}

.dark .badge-purple {
    background-color: #7c3aed;
    color: white;
}

.badge-orange {
    background-color: #f59e0b;
    color: white;
}

.dark .badge-orange {
    background-color: #d97706;
    color: white;
}

.badge-red {
    background-color: #ef4444;
    color: white;
}

.dark .badge-red {
    background-color: #dc2626;
    color: white;
}

.badge-pink {
    background-color: #ec4899;
    color: white;
}

.dark .badge-pink {
    background-color: #db2777;
    color: white;
}

/* ============================================================================
   TIMELINE
   ============================================================================ */

.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, #3b82f6, #8b5cf6);
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -2.4rem;
    top: 0.3rem;
    width: 0.8rem;
    height: 0.8rem;
    border-radius: 50%;
    background: #3b82f6;
    border: 2px solid white;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.dark .timeline-item::before {
    border-color: #1e293b;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.3);
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
    .flow-step {
        padding: 1rem;
    }
    
    .step-icon {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.25rem;
    }
    
    .stat-card {
        padding: 1rem !important;
    }
}

/* ============================================================================
   SCROLL BEHAVIOR
   ============================================================================ */

html {
    scroll-behavior: smooth;
}

section {
    scroll-margin-top: 5rem;
}

/* ============================================================================
   LOADING ANIMATION
   ============================================================================ */

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(59, 130, 246, 0.3);
    border-radius: 50%;
    border-top-color: #3b82f6;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
    nav,
    footer {
        display: none;
    }
    
    section {
        page-break-inside: avoid;
        margin-bottom: 2rem;
    }
    
    .flow-step {
        box-shadow: none !important;
        border: 1px solid #e2e8f0 !important;
    }
}

/* ============================================================================
   ENHANCED TEXT VISIBILITY
   ============================================================================ */

/* Section titles */
section h2 {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dark section h2 {
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Flow step titles */
.flow-step h3 {
    letter-spacing: -0.025em;
    line-height: 1.2;
}

/* Flow step descriptions */
.flow-step p {
    line-height: 1.6;
}

/* Detail list items */
.step-details li {
    line-height: 1.7;
}

/* Improved readability for dark mode */
.dark .flow-step {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.dark .flow-step:hover {
    box-shadow: 0 8px 24px rgba(96, 165, 250, 0.25);
}
