/* Custom Animations and Styles */

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

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes floatAnimation {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #0366d6;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #24292e;
}

/* Loading Animation */
#loading-screen {
    transition: opacity 0.5s ease-out;
}

/* Navigation Styles */
#navbar {
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.95);
}

.nav-link {
    position: relative;
    transition: all 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #0366d6, #28a745);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after {
    width: 100%;
}

/* Button Styles */
.cta-button {
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.cta-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
    z-index: -1;
}

.cta-button:hover::before {
    left: 100%;
}

/* Card Hover Effects */
.stat-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card:hover {
    transform: translateY(-5px) scale(1.02);
}

.toc-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toc-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Interactive Elements */
.feature-card {
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.feature-card:hover {
    border-color: #0366d6;
    transform: translateY(-5px);
}

.code-block {
    background: #1e1e1e;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.code-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(90deg, #ff5f56, #ffbd2e, #27ca3f);
    border-radius: 8px 8px 0 0;
}

.code-header {
    background: #2d2d30;
    padding: 8px 16px;
    font-size: 12px;
    color: #cccccc;
    border-bottom: 1px solid #3e3e42;
}

.code-content {
    padding: 20px;
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.6;
    color: #d4d4d4;
    overflow-x: auto;
}

/* Video Container */
.video-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Progress Bar */
#progress-bar {
    width: 0%;
}

/* Back to Top Button */
#back-to-top {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#back-to-top:hover {
    transform: translateY(-2px);
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.2rem;
    }
    
    .stat-card {
        margin-bottom: 1rem;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .auto-dark {
        background-color: #1a1a1a;
        color: #e1e1e1;
    }
}

/* Accessibility */
.focus-visible:focus-visible {
    outline: 2px solid #0366d6;
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .nav-link::after {
        background: #000;
    }
    
    .cta-button {
        border: 2px solid #000;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .bg-gradient-to-br {
        background: white !important;
    }
}

/* Interactive Hover States for Better UX */
.interactive-hover {
    transition: all 0.2s ease;
}

.interactive-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Custom Focus Indicators */
.custom-focus:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(3, 102, 214, 0.3);
}

/* Tooltip Styles */
.tooltip {
    position: relative;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 1000;
}

.tooltip::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.tooltip:hover::before,
.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
    bottom: calc(100% + 5px);
}

/* SMART CONTRAST IMPROVEMENTS - Keep beautiful gradients but ensure text is readable */

/* Only improve contrast where it's actually needed */
.text-gray-600 {
    color: #4b5563 !important; /* Slightly darker for better readability */
}

.text-gray-500 {
    color: #6b7280 !important;
}

/* Ensure small text is readable */
.text-xs.text-gray-600,
.text-sm.text-gray-600 {
    color: #374151 !important;
}

/* Improve readability on light gradient backgrounds only */
.bg-gradient-to-r.from-blue-50 .text-gray-600,
.bg-gradient-to-r.from-green-50 .text-gray-600,
.bg-gradient-to-r.from-yellow-50 .text-gray-600,
.bg-gradient-to-r.from-purple-50 .text-gray-600,
.bg-gradient-to-r.from-red-50 .text-gray-600 {
    color: #1f2937 !important;
}

/* Keep white cards readable */
.bg-white .text-gray-600 {
    color: #4b5563 !important;
}

.bg-white .text-sm {
    color: #374151 !important;
}

/* Source links styling - make them more visible but preserve beauty */
.source-link {
    color: #2563eb !important;
    text-decoration: underline;
    font-size: 0.75rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.source-link:hover {
    color: #1d4ed8 !important;
}

.sources-section {
    border-top: 1px solid #e5e7eb;
    padding-top: 1rem;
    margin-top: 1rem;
}

.sources-section h6 {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

/* Metric cards - improve without losing style */
.metric-card {
    border: 1px solid #e5e7eb;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.metric-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.metric-card .text-3xl {
    font-weight: 700 !important;
}

/* Tables - improve readability while keeping design */
.table-container {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    overflow: hidden;
}

.table-container th {
    background-color: #f9fafb;
    color: #374151 !important;
    font-weight: 600;
}

.table-container td {
    color: #1f2937 !important;
    border-bottom: 1px solid #e5e7eb;
}

/* ROI sections - ensure readability */
.roi-section .bg-white {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.roi-section .text-sm {
    color: #374151 !important;
    line-height: 1.5;
}

/* Only fix the most problematic contrast issues without destroying design */
.contrast-fix .text-gray-600 {
    color: #4b5563 !important;
}

.contrast-fix .text-xs {
    color: #374151 !important;
}

/* Preserve beautiful gradients but ensure text contrast */
.bg-gradient-to-br,
.bg-gradient-to-r {
    /* Keep the gradients! Just ensure text is dark enough */
}

.bg-gradient-to-br .text-gray-600,
.bg-gradient-to-r .text-gray-600 {
    color: #374151 !important;
}

/* Code blocks - dark background with light text */
.bg-gray-100 {
    background-color: #f3f4f6 !important;
    color: #1f2937 !important;
}

.font-mono {
    color: #1f2937 !important;
}