/**
 * Enhanced dark theme styles for AI Agents Challenge
 * A modern, elegant dark theme with improved animations and effects
 */

/* Base animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(20px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

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

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* New animations for modern interactions */
@keyframes floatUp {
    0% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0);
    }
}

@keyframes fadeScale {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes borderGlow {
    0% {
        box-shadow: 0 0 5px rgba(114, 137, 218, 0.2);
    }

    50% {
        box-shadow: 0 0 15px rgba(114, 137, 218, 0.4);
    }

    100% {
        box-shadow: 0 0 5px rgba(114, 137, 218, 0.2);
    }
}

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

    100% {
        background-position: 200% 0;
    }
}

/* Page transitions */
.enter-animation {
    animation: fadeIn 0.4s ease-out;
}

.exit-animation {
    animation: fadeOut 0.3s ease-in forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* Navigation link styling with improved animated underline */
.nav-link {
    color: #b3b3b3;
    font-weight: 500;
    position: relative;
    transition: all 0.3s ease;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: #7289da;
    transition: width 0.3s cubic-bezier(0.65, 0, 0.35, 1);
}

.nav-link:hover,
.active-nav {
    color: #ffffff;
    background-color: rgba(114, 137, 218, 0.1);
}

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

/* Enhanced card styling with glass effect */
.glass-card {
    background-color: rgba(44, 47, 51, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(64, 68, 75, 0.7);
    border-radius: 0.75rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden;
}

.glass-card:hover {
    border-color: rgba(114, 137, 218, 0.4);
}

/* Glass card with hover animation */
.glass-card.hover-animate {
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.glass-card.hover-animate:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Featured card with glow effect */
.glass-card.featured {
    border-color: rgba(114, 137, 218, 0.5);
    animation: borderGlow 3s infinite ease-in-out;
}

/* Glass card variations */
.glass-card.primary {
    border-left: 4px solid #7289da;
}

.glass-card.success {
    border-left: 4px solid #43b581;
}

.glass-card.warning {
    border-left: 4px solid #faa61a;
}

.glass-card.danger {
    border-left: 4px solid #f04747;
}

/* Custom button styles with improved interactions */
.btn-primary {
    background-color: #7289da;
    color: #ffffff;
    font-weight: 500;
    padding: 0.6rem 1.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: none;
    box-shadow: 0 2px 10px rgba(114, 137, 218, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    background-color: #5f73bc;
    box-shadow: 0 4px 15px rgba(114, 137, 218, 0.4);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(1px);
    box-shadow: 0 2px 8px rgba(114, 137, 218, 0.3);
}

/* Button ripple effect */
.btn-primary::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%, -50%);
    transform-origin: 50% 50%;
}

.btn-primary:focus:not(:active)::after {
    animation: ripple 1s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }

    100% {
        transform: scale(20, 20);
        opacity: 0;
    }
}

.btn-secondary {
    background-color: #2c2f33;
    color: #ffffff;
    font-weight: 500;
    padding: 0.6rem 1.5rem;
    border-radius: 0.5rem;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid rgba(114, 137, 218, 0.2);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
    background-color: #23272a;
    border-color: rgba(114, 137, 218, 0.5);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.btn-secondary:active {
    transform: translateY(1px);
}

.btn-danger {
    background-color: rgba(220, 38, 38, 0.2);
    color: #ef4444;
    border: 1px solid rgba(220, 38, 38, 0.3);
    font-weight: 500;
    padding: 0.6rem 1.5rem;
    border-radius: 0.5rem;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.btn-danger:hover {
    background-color: rgba(220, 38, 38, 0.3);
    border-color: rgba(220, 38, 38, 0.5);
    transform: translateY(-2px);
}

.btn-danger:active {
    transform: translateY(1px);
}

/* Form elements with improved focus states */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
textarea,
select {
    background-color: #2c2f33;
    border: 1px solid #40444b;
    color: #ffffff;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    outline: none;
    width: 100%;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    font-size: 1rem;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    border-color: #7289da;
    box-shadow: 0 0 0 3px rgba(114, 137, 218, 0.3);
    background-color: #23272a;
}

/* Code blocks with enhanced styling */
code,
pre {
    font-family: 'Fira Code', 'Courier New', monospace;
    background-color: #1e1e1e;
    border: 1px solid #40444b;
    border-radius: 0.5rem;
}

code {
    padding: 0.2rem 0.4rem;
    font-size: 0.875rem;
    color: #e879f9;
}

pre {
    padding: 1.25rem;
    overflow-x: auto;
    line-height: 1.6;
}

pre code {
    background: none;
    border: none;
    padding: 0;
    color: #e5e7eb;
}

/* Enhanced leaderboard table */
.leaderboard-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.5rem 0;
}

.leaderboard-table th {
    background-color: #1e1e1e;
    color: #7289da;
    text-align: left;
    padding: 1rem 1.5rem;
    border-bottom: 2px solid #40444b;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

.leaderboard-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #40444b;
    transition: background-color 0.2s ease;
}

.leaderboard-table tr:hover td {
    background-color: rgba(114, 137, 218, 0.08);
}

.leaderboard-table .rank-1 {
    background-color: rgba(255, 215, 0, 0.08);
}

.leaderboard-table .rank-2 {
    background-color: rgba(192, 192, 192, 0.08);
}

.leaderboard-table .rank-3 {
    background-color: rgba(205, 127, 50, 0.08);
}

.leaderboard-table .rank-1 td:first-child,
.leaderboard-table .rank-2 td:first-child,
.leaderboard-table .rank-3 td:first-child {
    position: relative;
}

.leaderboard-table .rank-1 td:first-child::before {
    content: '🏆';
    margin-right: 0.5rem;
}

.leaderboard-table .rank-2 td:first-child::before {
    content: '🥈';
    margin-right: 0.5rem;
}

.leaderboard-table .rank-3 td:first-child::before {
    content: '🥉';
    margin-right: 0.5rem;
}

/* Loader animation with gradient */
.loader {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(to right, #7289da, #5f73bc);
    animation: spin 1s linear infinite;
    position: relative;
}

.loader::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    background: #1e1e1e;
    border-radius: 50%;
}

.loader::after {
    content: '';
    position: absolute;
    top: 0;
    left: 45%;
    width: 10%;
    height: 10%;
    border-radius: 50%;
    background-color: #7289da;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Badge styles with subtle hover effect */
.badge {
    font-size: 0.75rem;
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    transition: all 0.2s ease;
}

.badge:hover {
    transform: translateY(-1px);
}

.badge-primary {
    background-color: rgba(114, 137, 218, 0.2);
    color: #7289da;
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.badge-warning {
    background-color: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.badge-error {
    background-color: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.badge-secondary {
    background-color: rgba(75, 85, 99, 0.2);
    color: #9ca3af;
}

.text-secondary {
    color: #9ca3af;
}

/* Time-related styles */
.time-badge {
    font-family: monospace;
    background-color: rgba(75, 85, 99, 0.15);
    color: #9ca3af;
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.8rem;
}

.time-efficient {
    color: #10b981;
    /* Green for fast times */
}

.time-average {
    color: #f59e0b;
    /* Yellow/orange for average times */
}

.time-slow {
    color: #ef4444;
    /* Red for slow times */
}

/* Progress bar with animation */
.progress-container {
    background-color: #1e1e1e;
    border-radius: 9999px;
    height: 0.5rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #7289da);
    border-radius: 9999px;
    transition: width 1.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Bouncy animation */
}

/* Progress bar fill that uses CSS custom properties */
.progress-bar-fill {
    width: var(--score-width, 0%);
    background: linear-gradient(90deg, #6366f1, #7289da);
    position: relative;
    overflow: hidden;
    transition: width 1.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Bouncy animation */
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.2) 50%,
            rgba(255, 255, 255, 0) 100%);
    animation: shimmer 2s infinite;
    background-size: 200% 100%;
    animation: shimmerEffect 2.5s infinite linear;
}

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

    100% {
        transform: translateX(100%);
    }
}

/* Animate on scroll elements */
.will-animate {
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.will-animate.fade-up {
    transform: translateY(20px);
}

.will-animate.fade-right {
    transform: translateX(-20px);
}

.will-animate.fade-left {
    transform: translateX(20px);
}

.will-animate.scale-up {
    transform: scale(0.95);
}

.will-animate.appeared {
    opacity: 1;
    transform: translate(0) scale(1);
}

/* Hero section styling */
.hero-section {
    position: relative;
    background-color: #1a1a1a;
    background-image: radial-gradient(circle, rgba(114, 137, 218, 0.1) 1px, transparent 1px);
    background-size: 30px 30px;
    overflow: hidden;
}

.hero-title {
    transition: transform 0.3s ease-out;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(114, 137, 218, 0.1) 0%, rgba(0, 0, 0, 0) 100%);
}

/* Gradient text */
.gradient-text {
    background: linear-gradient(90deg, #7289da, #5f73bc);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: inline-block;
}

/* Typing cursor effect */
.typed-text {
    display: inline-block;
}

/* Advanced card hover effects */
.feature-card {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    z-index: 1;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(114, 137, 218, 0.15) 0%, rgba(0, 0, 0, 0) 100%);
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.feature-card:hover::before {
    opacity: 1;
}

/* Subtle scrollbar styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #1e1e1e;
}

::-webkit-scrollbar-thumb {
    background: #40444b;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #7289da;
}

/* Business Leader and Developer buttons */
.glass-card.bg-blue-500 {
    background-color: #3b82f6;
    border-color: #60a5fa;
    transition: all 0.3s ease;
}

.glass-card.bg-blue-500:hover {
    background-color: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.5);
}

.glass-card.bg-black {
    background-color: #000000;
    border-color: #374151;
    transition: all 0.3s ease;
}

.glass-card.bg-black:hover {
    background-color: #111827;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

/* Modal styling */
.fixed.inset-0.bg-gray-900 {
    z-index: 50;
    animation: fadeIn 0.3s ease-out;
}

.fixed.inset-0.hidden {
    display: none;
}

/* Leaderboard lines styling */
.border-b.border-gray-700 .flex {
    padding: 8px 0;
}

/* Flip Card Styles */
.flip-card-container {
    perspective: 1000px;
    width: 100%;
}

.flip-card {
    width: 100%;
    position: relative;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    cursor: pointer;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: left;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    border-radius: 0.75rem;
}

.flip-card:hover .flip-card-inner,
.flip-card:focus .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 0.75rem;
    overflow: hidden;
}

.flip-card-front {
    background-color: #2c2f33;
    color: white;
}

.flip-card-back {
    background-color: #202225;
    color: white;
    transform: rotateY(180deg);
}

/* Mobile responsiveness for flip cards */
@media (max-width: 640px) {
    .flip-card {
        height: 280px !important;
    }
}