/* ========================================
   MLOps API Flow - Custom Styles
   ======================================== */

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    overflow-x: hidden;
    width: 100%;
    margin: 0;
    padding: 0;
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
    width: 100%;
    min-height: 100vh;
    margin: 0 !important;
    padding: 0 !important;
    position: relative;
}

/* Hide any horizontal scrollbar artifacts */
::-webkit-scrollbar:horizontal {
    display: none;
    height: 0;
}

/* Base Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideRight {
    from { 
        opacity: 0;
        transform: translateX(-20px);
    }
    to { 
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes flowLine {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5); }
    50% { box-shadow: 0 0 20px 10px rgba(59, 130, 246, 0); }
}

@keyframes dataFlow {
    0% { transform: translateX(-100%); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translateX(100%); opacity: 0; }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Navigation Pills - Active State */
[data-section].active {
    background: white !important;
    color: #2563eb !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Legacy nav-link support */
.nav-link {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #475569;
    border-radius: 0.5rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link:hover {
    color: #2563eb;
    background: #eff6ff;
}

.nav-link.active {
    color: #2563eb;
    background: #eff6ff;
}

/* Focus States for Accessibility */
.nav-link:focus,
.mobile-nav-link:focus,
button:focus {
    @apply outline-none ring-2 ring-primary-500 ring-offset-2;
}

/* Mobile Navigation */
.mobile-nav-link {
    @apply w-full flex items-center gap-3 px-4 py-3 text-left text-slate-700 hover:bg-primary-50 hover:text-primary-600 rounded-xl transition-all duration-200 font-medium;
}

.mobile-nav-link.active {
    @apply bg-primary-50 text-primary-600 border-l-4 border-primary-500;
}

.mobile-nav-link i:first-child {
    @apply w-8 h-8 bg-slate-100 rounded-lg flex items-center justify-center text-slate-600;
}

.mobile-nav-link:hover i:first-child {
    @apply bg-primary-100 text-primary-600;
}

/* Mobile Menu Animation */
#mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.2s ease-out;
    opacity: 0;
}

#mobile-menu.open {
    max-height: 400px;
    opacity: 1;
}

/* Hamburger Icon Animation */
#menu-icon {
    transition: transform 0.3s ease;
}

#menu-icon.open {
    transform: rotate(90deg);
}

/* Predict Tabs - Clean Design */
.predict-tab {
    @apply px-5 py-2.5 text-sm font-semibold rounded-full transition-all duration-200 flex items-center gap-2;
    @apply text-slate-600 hover:text-slate-800;
}

.predict-tab.active {
    @apply bg-white text-slate-800;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.predict-tab i {
    @apply text-base;
}

/* Predict Step Animation */
.predict-step {
    animation: slideUp 0.4s ease-out forwards;
    opacity: 0;
}

.predict-step:nth-child(1) { animation-delay: 0.05s; }
.predict-step:nth-child(2) { animation-delay: 0.1s; }
.predict-step:nth-child(3) { animation-delay: 0.15s; }
.predict-step:nth-child(4) { animation-delay: 0.2s; }
.predict-step:nth-child(5) { animation-delay: 0.25s; }
.predict-step:nth-child(6) { animation-delay: 0.3s; }

/* Flow Step Cards */
.flow-step {
    @apply relative p-6 rounded-2xl border-2 transition-all duration-300;
    animation: slideUp 0.5s ease-out forwards;
    opacity: 0;
}

.flow-step:hover {
    @apply transform -translate-y-2;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

.flow-step.step-start {
    @apply bg-gradient-to-br from-primary-50 to-primary-100 border-primary-300;
}

.flow-step.step-start:hover {
    box-shadow: 0 20px 40px rgba(59, 130, 246, 0.15);
}

.flow-step.step-process {
    @apply bg-gradient-to-br from-slate-50 to-slate-100 border-slate-300;
}

.flow-step.step-process:hover {
    box-shadow: 0 20px 40px rgba(100, 116, 139, 0.15);
}

.flow-step.step-decision {
    @apply bg-gradient-to-br from-amber-50 to-amber-100 border-amber-300;
}

.flow-step.step-decision:hover {
    box-shadow: 0 20px 40px rgba(245, 158, 11, 0.2);
}

.flow-step.step-success {
    @apply bg-gradient-to-br from-emerald-50 to-emerald-100 border-emerald-300;
}

.flow-step.step-success:hover {
    box-shadow: 0 20px 40px rgba(16, 185, 129, 0.2);
}

.flow-step.step-error {
    @apply bg-gradient-to-br from-red-50 to-red-100 border-red-300;
}

.flow-step.step-error:hover {
    box-shadow: 0 20px 40px rgba(239, 68, 68, 0.2);
}

.flow-step.step-cold {
    @apply bg-gradient-to-br from-cyan-50 to-cyan-100 border-cyan-300;
}

.flow-step.step-cold:hover {
    box-shadow: 0 20px 40px rgba(6, 182, 212, 0.2);
}

.flow-step.step-ml {
    @apply bg-gradient-to-br from-purple-50 to-purple-100 border-purple-300;
}

.flow-step.step-ml:hover {
    box-shadow: 0 20px 40px rgba(139, 92, 246, 0.2);
}

/* Step Number Badge */
.step-number {
    @apply absolute -top-3 -left-3 w-8 h-8 rounded-full flex items-center justify-center text-sm font-bold text-white shadow-lg;
}

/* Flow Connector Lines */
.flow-connector {
    @apply flex items-center justify-center py-4;
}

.flow-connector-line {
    @apply w-1 h-12 rounded-full;
    background: linear-gradient(180deg, #3b82f6, #10b981);
    position: relative;
    overflow: hidden;
}

.flow-connector-line::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.8), transparent);
    animation: dataFlow 1.5s ease-in-out infinite;
}

.flow-connector-horizontal {
    @apply h-1 flex-1 rounded-full mx-4;
    background: linear-gradient(90deg, #3b82f6, #10b981);
    position: relative;
    overflow: hidden;
}

/* Flow Arrow */
.flow-arrow {
    @apply text-2xl text-primary-500;
    animation: bounce 1s ease-in-out infinite;
}

/* Decision Diamond */
.decision-diamond {
    @apply relative;
}

.decision-diamond::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    transform: translate(-50%, -50%) rotate(45deg);
    border-radius: 8px;
    z-index: -1;
}

/* Code Block */
.code-block {
    @apply bg-slate-900 text-slate-100 p-4 rounded-xl font-mono text-sm overflow-x-auto;
    @apply border border-slate-700;
    position: relative;
}

.code-block:hover .copy-btn {
    opacity: 1;
}

.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 6px;
    color: #94a3b8;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #e2e8f0;
}

.copy-btn.copied {
    background: rgba(16, 185, 129, 0.3);
    color: #10b981;
}

.code-block .keyword {
    @apply text-purple-400;
}

.code-block .string {
    @apply text-emerald-400;
}

.code-block .number {
    @apply text-amber-400;
}

.code-block .comment {
    @apply text-slate-500;
}

/* API Card */
.api-card {
    @apply p-4 rounded-xl transition-all duration-300 cursor-pointer;
    @apply bg-slate-700/50 hover:bg-slate-700 border border-slate-600;
}

.api-card:hover {
    @apply transform -translate-y-1;
}

.api-method {
    @apply px-2 py-1 text-xs font-bold rounded;
}

.api-method.get {
    @apply bg-emerald-500/20 text-emerald-400;
}

.api-method.post {
    @apply bg-amber-500/20 text-amber-400;
}

/* Startup Flow Specific */
.startup-step {
    @apply flex items-start gap-4 p-5 rounded-xl transition-all duration-300;
    @apply bg-white border border-slate-200;
    animation: slideUp 0.4s ease-out forwards;
    opacity: 0;
}

.startup-step:hover {
    @apply transform -translate-y-1 border-primary-300;
    box-shadow: 0 12px 30px rgba(59, 130, 246, 0.12);
}

.startup-step-wrapper {
    animation: fadeIn 0.5s ease-out forwards;
    opacity: 0;
}

.startup-step-wrapper:nth-child(1) { animation-delay: 0.1s; }
.startup-step-wrapper:nth-child(2) { animation-delay: 0.2s; }
.startup-step-wrapper:nth-child(3) { animation-delay: 0.3s; }
.startup-step-wrapper:nth-child(4) { animation-delay: 0.4s; }
.startup-step-wrapper:nth-child(5) { animation-delay: 0.5s; }
.startup-step-wrapper:nth-child(6) { animation-delay: 0.6s; }

.startup-icon {
    @apply w-12 h-12 rounded-xl flex items-center justify-center text-xl flex-shrink-0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

/* Timeline dot pulse animation */
@keyframes timelinePulse {
    0%, 100% { 
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
    }
    50% { 
        box-shadow: 0 0 0 8px rgba(59, 130, 246, 0);
    }
}

.startup-step-wrapper .absolute > div {
    animation: timelinePulse 2s ease-in-out infinite;
}

/* Interactive Flow Path */
.flow-path {
    @apply relative;
}

.flow-path::after {
    content: '';
    position: absolute;
    left: 28px;
    top: 60px;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #e2e8f0, #cbd5e1);
    border-radius: 2px;
}

.flow-path:last-child::after {
    display: none;
}

/* Decision Tree */
.decision-tree {
    @apply relative flex flex-col items-center;
}

.decision-branch {
    @apply flex gap-8 mt-4;
}

.branch-line {
    position: absolute;
    top: 100%;
    width: 2px;
    height: 30px;
    background: linear-gradient(180deg, #f59e0b, #3b82f6);
}

.branch-line.left {
    left: 25%;
    transform: translateX(-50%);
}

.branch-line.right {
    right: 25%;
    transform: translateX(50%);
}

/* Response Preview */
.response-preview {
    @apply bg-slate-50 border border-slate-200 rounded-xl p-4 mt-4;
}

.response-preview pre {
    @apply text-sm font-mono text-slate-700 whitespace-pre-wrap;
}

/* Tooltip */
.tooltip {
    @apply absolute z-50 px-3 py-2 text-sm text-white bg-slate-900 rounded-lg shadow-xl;
    @apply opacity-0 invisible transition-all duration-200;
    @apply -top-2 left-1/2 transform -translate-x-1/2 -translate-y-full;
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #0f172a;
}

.has-tooltip:hover .tooltip {
    @apply opacity-100 visible;
}

/* Loading Animation */
.loading-dots {
    @apply flex gap-1;
}

.loading-dots span {
    @apply w-2 h-2 bg-primary-500 rounded-full;
    animation: bounce 0.6s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.1s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.2s;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    @apply bg-slate-100 rounded;
}

::-webkit-scrollbar-thumb {
    @apply bg-slate-300 rounded hover:bg-slate-400;
}

/* Flow Container Animations */
.flow-step:nth-child(1) { animation-delay: 0.1s; }
.flow-step:nth-child(2) { animation-delay: 0.2s; }
.flow-step:nth-child(3) { animation-delay: 0.3s; }
.flow-step:nth-child(4) { animation-delay: 0.4s; }
.flow-step:nth-child(5) { animation-delay: 0.5s; }
.flow-step:nth-child(6) { animation-delay: 0.6s; }

/* Mobile Responsive */
/* Section Improvements */
.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6366f1;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.section-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(148, 163, 184, 0.3), transparent);
    margin: 4rem 0;
}

/* Floating action button for scroll to top */
.scroll-top-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    z-index: 50;
}

.scroll-top-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-top-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
}

/* Tooltip */
.tooltip {
    position: relative;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    padding: 0.5rem 0.75rem;
    background: #1e293b;
    color: white;
    font-size: 0.75rem;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.tooltip:hover::before {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 768px) {
    .decision-branch {
        @apply flex-col gap-4;
    }
    
    .flow-connector-horizontal {
        @apply hidden;
    }
    
    .predict-tab {
        @apply px-4 py-2 text-xs;
    }
}

/* Interactive Highlight */
.highlight-active {
    @apply ring-4 ring-primary-500/50;
    animation: pulseGlow 2s infinite;
}

/* Status Indicators */
.status-dot {
    @apply w-3 h-3 rounded-full;
}

.status-dot.success {
    @apply bg-emerald-500;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.status-dot.warning {
    @apply bg-amber-500;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

.status-dot.error {
    @apply bg-red-500;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

/* Feature Badge */
.feature-badge {
    @apply inline-flex items-center gap-1 px-2 py-1 text-xs font-medium rounded-full;
}

.feature-badge.required {
    @apply bg-red-100 text-red-700;
}

.feature-badge.optional {
    @apply bg-slate-100 text-slate-600;
}

.feature-badge.calculated {
    @apply bg-purple-100 text-purple-700;
}

/* Fix overflow issues */
header, main, section, footer, nav {
    max-width: 100vw;
    overflow-x: hidden;
    position: relative;
}

/* Ensure no outline or border artifacts */
*:focus {
    outline-offset: -2px;
}

/* Hero background pattern fix */
header .absolute {
    pointer-events: none;
}

/* Remove any potential border artifacts */
header, nav, main, footer, section {
    border: none !important;
    outline: none !important;
}
