/* =================================
   TOXICITY PREDICTION AI DETECTION SYSTEM
   Custom CSS - Extracted and Organized
   ================================= */

/* =============================================================================
   1. BASE STYLES & UTILITIES
   ============================================================================= */

/* Smooth scrolling for the entire page */
html {
    scroll-behavior: smooth;
}

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

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

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
}

/* Navigation Styles */
.nav-link {
    color: #6b7280;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease-in-out;
    text-decoration: none;
}

.nav-link:hover,
.nav-link.active {
    color: #3b82f6;
    background-color: #eff6ff;
}

.mobile-nav-link {
    display: block;
    color: #6b7280;
    font-weight: 500;
    padding: 0.75rem 1rem;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
    color: #3b82f6;
    background-color: #eff6ff;
}

/* =============================================================================
   SCROLL TO TOP BUTTON - PROPERLY CIRCULAR
   ============================================================================= */

#scrollToTop {
    /* Position and Layout */
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;

    /* Perfect Circle Dimensions */
    width: 3.5rem;
    height: 3.5rem;
    min-width: 3.5rem;
    min-height: 3.5rem;

    /* Perfect Circle Shape */
    border-radius: 50%;

    /* Flexbox for Perfect Centering */
    display: flex;
    align-items: center;
    justify-content: center;

    /* Visual Styling */
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
        0 4px 6px -2px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.1);

    /* Remove default button styling */
    border: none;
    outline: none;

    /* Animation and Interaction */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    z-index: 1000;

    /* Initial Hidden State */
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.8);

    /* Prevent text selection */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Show State */
#scrollToTop.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Hover Effects */
#scrollToTop:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: translateY(-2px) scale(1.1);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2),
        0 10px 10px -5px rgba(0, 0, 0, 0.1);
}

/* Active State */
#scrollToTop:active {
    transform: translateY(0) scale(1.05);
}

/* Icon Styling */
#scrollToTop i {
    font-size: 1.25rem;
    line-height: 1;
}

/* Responsive Design */
@media (max-width: 640px) {
    #scrollToTop {
        bottom: 1rem;
        right: 1rem;
        width: 3rem;
        height: 3rem;
        min-width: 3rem;
        min-height: 3rem;
    }

    #scrollToTop i {
        font-size: 1rem;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    #scrollToTop {
        border-width: 1px;
    }
}

/* Focus Styles for Accessibility */
#scrollToTop:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Ensure Perfect Circle on All Browsers */
#scrollToTop {
    -webkit-border-radius: 50%;
    -moz-border-radius: 50%;
    border-radius: 50%;

    /* Prevent any padding or margin issues */
    padding: 0;
    margin: 0;

    /* Ensure proper box-sizing */
    box-sizing: border-box;

    /* Prevent any overflow issues */
    overflow: hidden;
}

/* =============================================================================
   3. HERO SECTION ANIMATIONS
   ============================================================================= */

/* Floating animations for background elements */
@keyframes float {
    0%,
    100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(5deg);
    }
}

@keyframes float-delayed {
    0%,
    100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-15px) rotate(-3deg);
    }
}

@keyframes smooth-slide-up {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

.animate-float-delayed {
    animation: float-delayed 8s ease-in-out infinite;
    animation-delay: 2s;
}

.animate-pulse-slow {
    animation: pulse 4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-fade-in {
    animation: fadeIn 1s ease-out forwards;
    opacity: 0;
}

.animate-slide-up {
    animation: slideUp 1s ease-out forwards;
    opacity: 0;
    transform: translateY(30px);
}

.animate-smooth-slide-up {
    animation: smooth-slide-up 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94)
        forwards;
    opacity: 0;
    transform: translateY(40px) scale(0.95);
}

/* =============================================================================
   4. MAIN ANIMATION KEYFRAMES
   ============================================================================= */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

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

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

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

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

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes glow {
    from {
        box-shadow: 0 0 5px rgba(59, 130, 246, 0.5);
    }
    to {
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.8);
    }
}

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

@keyframes loadingDots {
    0%,
    20% {
        content: "";
    }
    40% {
        content: ".";
    }
    60% {
        content: "..";
    }
    80%,
    100% {
        content: "...";
    }
}

/* =============================================================================
   5. ANIMATION UTILITY CLASSES
   ============================================================================= */

/* Animation class variations */
.animate-fade-in {
    animation: fadeIn 0.8s ease-in-out forwards;
}
.animate-slide-down {
    animation: slideDown 0.6s ease-out forwards;
}
.animate-slide-left {
    animation: slideLeft 0.6s ease-out forwards;
}
.animate-slide-right {
    animation: slideRight 0.6s ease-out forwards;
}
.animate-scale-up {
    animation: scaleUp 0.6s ease-out forwards;
}
.animate-bounce-gentle {
    animation: bounceGentle 2s ease-in-out infinite;
}
.animate-float {
    animation: float 6s ease-in-out infinite;
}
.animate-glow {
    animation: glow 2s ease-in-out infinite alternate;
}

/* Animation delays */
.animate-delay-100 {
    animation-delay: 0.1s;
}
.animate-delay-200 {
    animation-delay: 0.2s;
}
.animate-delay-300 {
    animation-delay: 0.3s;
}
.animate-delay-500 {
    animation-delay: 0.5s;
}

/* Scroll-triggered animations */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease-out;
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

/* =============================================================================
   6. SPECIAL EFFECTS & TEXT ANIMATIONS
   ============================================================================= */

/* Gradient text animation */
.gradient-text {
    background: linear-gradient(45deg, #3b82f6, #8b5cf6, #10b981);
    background-size: 200% 200%;
    animation: gradientShift 3s ease-in-out infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Enhanced hover effects */
.hover-lift {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Loading animation improvements */
.loading-dots {
    display: inline-block;
}

.loading-dots::after {
    content: "";
    animation: loadingDots 1.5s infinite;
}

/* =============================================================================
   7. BUTTON ENHANCEMENTS
   ============================================================================= */

/* Enhanced button hover effects with smoother transitions */
.group:hover .group-hover\:animate-bounce {
    animation: bounce 1s infinite;
}

/* Smooth button transformations */
button {
    transform-origin: center;
    will-change: transform;
}

/* =============================================================================
   8. RESPONSIVE DESIGN ADJUSTMENTS
   ============================================================================= */

/* Responsive adjustments for hero section */
@media (max-width: 640px) {
    .hero-title {
        font-size: 2.5rem !important;
        line-height: 1.1;
        margin-bottom: 1.5rem !important;
    }

    .hero-description {
        font-size: 1.25rem !important;
        margin-bottom: 2rem !important;
    }

    .animate-smooth-slide-up {
        animation-duration: 0.8s;
    }
}

@media (max-height: 600px) {
    .hero-title {
        font-size: 2rem !important;
        margin-bottom: 1rem !important;
    }

    .hero-description {
        font-size: 1rem !important;
        margin-bottom: 1.5rem !important;
    }

    .hero-buttons {
        margin-bottom: 2rem !important;
    }
}

/* =============================================================================
   9. SAMPLE IMAGES & CARDS
   ============================================================================= */

.sample-image-card {
    transform-origin: center;
    will-change: transform;
}

.sample-image-card:hover {
    transform: scale(1.05);
}

/* =============================================================================
   10. PERFORMANCE OPTIMIZATIONS
   ============================================================================= */

/* Optimize animations for better performance */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* GPU acceleration for animations */
.animate-fade-in,
.animate-slide-up,
.animate-slide-down,
.animate-slide-left,
.animate-slide-right,
.animate-scale-up,
.hover-lift {
    will-change: transform, opacity;
}

/* =============================================================================
   11. PRINT STYLES
   ============================================================================= */

@media print {
    .animate-fade-in,
    .animate-slide-up,
    .animate-bounce-gentle {
        animation: none !important;
    }

    #scrollToTop,
    .loading-overlay {
        display: none !important;
    }
}

/* =============================================================================
   ALGORITHM PAGE SPECIFIC STYLES
   ============================================================================= */

/* Workflow placeholder styling */
.workflow-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 2px dashed #cbd5e0;
    border-radius: 1rem;
    color: #718096;
    font-size: 1.1rem;
    padding: 2rem;
    transition: all 0.3s ease;
}

.workflow-placeholder:hover {
    border-color: #a0aec0;
    background: linear-gradient(135deg, #edf2f7 0%, #e2e8f0 100%);
}

.workflow-placeholder i {
    margin-bottom: 1rem;
    opacity: 0.7;
}

/* Algorithm section animations */
.algorithm-section {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.8s ease-out forwards;
}

.algorithm-section:nth-child(2) {
    animation-delay: 0.1s;
}
.algorithm-section:nth-child(3) {
    animation-delay: 0.2s;
}
.algorithm-section:nth-child(4) {
    animation-delay: 0.3s;
}

/* Stage cards hover effects */
.stage-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stage-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Innovation cards */
.innovation-card {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.innovation-card::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;
}

.innovation-card:hover::before {
    left: 100%;
}

/* Performance metrics grid */
.performance-metric {
    transition: all 0.3s ease;
}

.performance-metric:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Technical architecture cards */
.tech-card {
    transition: all 0.3s ease;
    position: relative;
}

.tech-card:hover {
    transform: translateY(-10px);
}

.tech-card .tech-icon {
    transition: all 0.3s ease;
}

.tech-card:hover .tech-icon {
    transform: scale(1.1);
}

/* Responsive adjustments for algorithm page */
@media (max-width: 768px) {
    .workflow-placeholder {
        min-height: 300px;
        font-size: 1rem;
        padding: 1.5rem;
    }

    .stage-card {
        margin-bottom: 1.5rem;
    }

    .performance-metric {
        margin-bottom: 1rem;
    }
}

/* Navigation spy active states */
.nav-spy-active {
    background: white !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) !important;
    transform: scale(1.05);
}

/* Smooth scroll behavior for algorithm page */
html {
    scroll-behavior: smooth;
}

/* Loading states for workflow image */
.workflow-image-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

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

/* Enhanced focus states for accessibility */
.algorithm-nav-link:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Print styles for algorithm page */
@media print {
    .workflow-placeholder {
        border: 1px solid #000;
        background: none;
    }

    .stage-card,
    .innovation-card,
    .tech-card {
        break-inside: avoid;
        margin-bottom: 1rem;
    }
}
