/* Custom CSS */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-pulse {
    animation: pulse 0.5s ease-in-out;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    opacity: 0;
}

.accordion-content.active {
    max-height: 1000px;
    transition: max-height 0.6s ease-in, opacity 0.3s ease-in 0.1s;
    opacity: 1;
}

.rotate-180 {
    transform: rotate(180deg);
}

.transition-transform {
    transition: transform 0.3s ease;
}

/* Enhanced FAQ Styles */
.faq-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
    overflow: hidden;
}

.faq-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.1);
    border-color: #c7d2fe;
}

.faq-question {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid #e2e8f0;
    position: relative;
}

.faq-question::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: linear-gradient(180deg, #4f46e5 0%, #7c3aed 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.faq-card:hover .faq-question::before {
    opacity: 1;
}

.faq-icon {
    width: 24px;
    height: 24px;
    opacity: 0.7;
    transition: all 0.3s ease;
}

.faq-card:hover .faq-icon {
    opacity: 1;
    transform: scale(1.1);
}

.faq-answer {
    background: #ffffff;
    line-height: 1.7;
}

.faq-category-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
    opacity: 0.8;
}

.category-rules { background: #dbeafe; color: #1e40af; }
.category-stats { background: #dcfce7; color: #166534; }
.category-classes { background: #fef3c7; color: #92400e; }
.category-multiclass { background: #fce7f3; color: #be185d; }

/* ==================== ENHANCED ANIMATIONS ==================== */

/* Page Load Animations */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-180deg) scale(0.5);
    }
    to {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
}

/* Scroll-triggered Animation Classes */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

.slide-in-left {
    animation: slideInLeft 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.slide-in-right {
    animation: slideInRight 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.slide-in-up {
    animation: slideInUp 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.bounce-in {
    animation: bounceIn 1s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.rotate-in {
    animation: rotateIn 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Enhanced Button Animations */
.btn-hover-lift {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
}

.btn-hover-lift::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;
}

.btn-hover-lift:hover::before {
    left: 100%;
}

.btn-hover-lift:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

/* Loading Spinner Animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4f46e5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Pulse Animation for Notifications */
@keyframes gentlePulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.02);
        opacity: 0.8;
    }
}

.gentle-pulse {
    animation: gentlePulse 2s ease-in-out infinite;
}

/* Smooth Hover Transitions */
.hover-scale {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-rotate {
    transition: transform 0.3s ease;
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

/* Card Hover Effects */
.card-hover {
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.card-hover:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

/* Text Animation */
@keyframes typewriter {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: #4f46e5; }
}

.typewriter {
    overflow: hidden;
    border-right: 2px solid #4f46e5;
    white-space: nowrap;
    animation: typewriter 3s steps(40, end), blink-caret 0.75s step-end infinite;
}

/* Gradient Animation */
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.animated-gradient {
    background: linear-gradient(-45deg, #4f46e5, #7c3aed, #ec4899, #f59e0b);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

/* Floating Animation */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.float {
    animation: float 3s ease-in-out infinite;
}

/* Stagger Animation for Lists */
.stagger-item {
    opacity: 0;
    transform: translateY(20px);
    animation: slideInUp 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.stagger-item:nth-child(1) { animation-delay: 0.1s; }
.stagger-item:nth-child(2) { animation-delay: 0.2s; }
.stagger-item:nth-child(3) { animation-delay: 0.3s; }
.stagger-item:nth-child(4) { animation-delay: 0.4s; }
.stagger-item:nth-child(5) { animation-delay: 0.5s; }

/* Enhanced FAQ Animations */
.faq-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden;
    position: relative;
    opacity: 0;
    transform: translateY(30px);
}

.faq-card.animate {
    opacity: 1;
    transform: translateY(0);
}

.faq-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(79, 70, 229, 0.08), transparent);
    transition: left 0.8s ease;
    z-index: 1;
}

.faq-card:hover::before {
    left: 100%;
}

.faq-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 15px 35px rgba(99, 102, 241, 0.18);
    border-color: #c7d2fe;
}

/* FAQ Content Styling */
.faq-card .accordion-btn {
    position: relative;
    z-index: 2;
    background: transparent;
    padding: 1.5rem 2rem;
}

.faq-card .accordion-content {
    position: relative;
    z-index: 2;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
}

/* Number Counter Animation */
@keyframes countUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.counter-animate {
    animation: countUp 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Progress Bar Animation */
@keyframes progressFill {
    from { width: 0%; }
    to { width: var(--progress-width); }
}

.progress-fill {
    animation: progressFill 1.5s ease-out forwards;
}

/* Enhanced Button Styles with Animations */
.btn-primary {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    transform: translateY(0);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.4);
}

/* Smooth Scrolling Enhancement */
html {
    scroll-behavior: smooth;
}

/* Focus Animations */
.focus-ring:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.3);
    animation: focusPulse 1.5s ease-in-out infinite;
}

@keyframes focusPulse {
    0%, 100% {
        box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.3);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(79, 70, 229, 0.2);
    }
}

/* Loading States */
.loading-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Success/Error Animations */
@keyframes checkmark {
    0% {
        stroke-dasharray: 0, 100;
        opacity: 0;
    }
    100% {
        stroke-dasharray: 100, 0;
        opacity: 1;
    }
}

.checkmark {
    animation: checkmark 0.8s ease-in-out;
}

/* Mobile-specific Animations */
@media (max-width: 768px) {
    .animate-on-scroll {
        opacity: 1;
        transform: none;
    }

    .stagger-item {
        animation-delay: 0s;
        opacity: 1;
        transform: none;
    }
}

/* ==================== MOBILE RESPONSIVENESS ==================== */

/* Mobile-first responsive design */
@media (max-width: 640px) {
    /* Container adjustments */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Header responsive */
    header .container {
        padding: 0.75rem 1rem;
    }

    header .text-2xl {
        font-size: 1.25rem;
    }

    /* Navigation mobile menu */
    nav ul {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 1rem;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        border-radius: 0 0 0.5rem 0.5rem;
    }

    nav ul.active {
        display: flex;
    }

    nav .sm\:hidden {
        display: block;
    }

    /* Calculator section mobile */
    #calculator .max-w-3xl {
        margin: 0 0.5rem;
        padding: 1rem;
    }

    #calculator h2 {
        font-size: 1.5rem;
    }

    /* Grid responsive adjustments */
    .grid.md\:grid-cols-2 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .grid.md\:grid-cols-3 {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    /* Feature cards mobile */
    .grid.md\:grid-cols-3 {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .text-center.p-6 {
        padding: 1.5rem 1rem;
    }

    /* FAQ mobile adjustments */
    .faq-card {
        margin-bottom: 1rem;
    }

    .accordion-btn {
        padding: 1rem !important;
        font-size: 1rem;
    }

    .accordion-content {
        padding: 1rem !important;
    }

    /* Footer mobile */
    footer .grid.md\:grid-cols-3 {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }

    footer h3 {
        font-size: 1.5rem;
    }

    /* Button mobile adjustments */
    .btn-primary {
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }

    /* Results section mobile */
    #results .grid.md\:grid-cols-3 {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    /* Sponsor section mobile */
    .sponsor-section {
        padding: 2rem 1rem;
        text-align: center;
    }

    .sponsor-logo {
        max-width: 20px;
        height: 40px;
    }

    /* Desktop sponsor logo size */
    @media (min-width: 1025px) {
        .sponsor-logo {
            max-width: 30px;
        }
    }

    /* Mobile menu animations */
    #mobile-menu {
        transition: all 0.3s ease;
        transform-origin: top;
    }

    #mobile-menu.hidden {
        opacity: 0;
        transform: scaleY(0.8);
    }

    #mobile-menu.active {
        opacity: 1;
        transform: scaleY(1);
    }
}

/* Tablet responsiveness */
@media (min-width: 641px) and (max-width: 1024px) {
    .grid.md\:grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    #calculator .max-w-3xl {
        margin: 0 1rem;
    }

    .text-center.p-6 {
        padding: 1.5rem;
    }
}

/* Large screen optimizations */
@media (min-width: 1025px) {
    .container {
        max-width: 1200px;
    }

    /* Enhanced hover effects for desktop */
    .card-hover:hover {
        transform: translateY(-12px) scale(1.03);
    }

    .btn-hover-lift:hover {
        transform: translateY(-4px);
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .card-hover:hover,
    .btn-hover-lift:hover,
    .hover-scale:hover {
        transform: none;
        box-shadow: initial;
    }

    /* Increase touch targets */
    button, .btn-primary, a {
        min-height: 44px;
        min-width: 44px;
    }
}

/* High DPI display optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Sharper borders and shadows for retina displays */
    .faq-card, .card-hover {
        border-width: 0.5px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
    }

    .bg-gradient-to-br, .bg-gray-50, .bg-white {
        background: white !important;
    }

    .shadow-lg, .shadow {
        box-shadow: none !important;
    }
}

/* ==================== ENHANCED VISUAL EFFECTS ==================== */

/* Gradient animation for backgrounds */
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.animated-gradient-bg {
    background: linear-gradient(-45deg, #667eea, #764ba2, #f093fb, #4facfe);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

/* Card entrance animation */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-entrance {
    animation: slideUp 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Enhanced hover lift effect */
@keyframes lift {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-8px);
    }
}

.hover-lift:hover {
    animation: lift 0.6s ease-in-out;
}

/* Logo floating animation */
@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0px) scale(1);
    }
    50% {
        transform: translateY(-12px) scale(1.05);
    }
}

.logo-float:hover {
    animation: logoFloat 0.6s ease-in-out;
}

/* Glowing border effect */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.4), 0 0 40px rgba(240, 147, 251, 0.2);
    }
    50% {
        box-shadow: 0 0 30px rgba(102, 126, 234, 0.6), 0 0 60px rgba(240, 147, 251, 0.3);
    }
}

.glow-border {
    animation: glow 3s ease-in-out infinite;
}

/* Badge pulse animation */
@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.badge-pulse {
    animation: badgePulse 2s ease-in-out infinite;
}

/* Animated button gradient */
@keyframes buttonGradient {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

.btn-gradient {
    background: linear-gradient(90deg, #667eea, #764ba2, #f093fb);
    background-size: 200% 200%;
    animation: buttonGradient 3s ease infinite;
}

/* Spotlight hover effect */
@keyframes spotlight {
    0% {
        background-position: -200% center;
    }
    100% {
        background-position: 200% center;
    }
}

.spotlight:hover {
    background-image: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    background-size: 200% 100%;
    animation: spotlight 0.6s ease;
}

/* Enhanced sponsor section animations */
.sponsor-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
}

.sponsor-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(102, 126, 234, 0.05), transparent);
    transform: rotate(-45deg);
    transition: all 0.6s ease;
    opacity: 0;
}

.sponsor-card:hover::before {
    opacity: 1;
    animation: gradientShift 3s ease-in-out;
}

.sponsor-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.15);
    border-color: #c7d2fe;
}

/* Enhanced logo animations */
.sponsor-logo {
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.1));
}

.sponsor-logo:hover {
    transform: scale(1.1) rotate(2deg);
    filter: drop-shadow(0 4px 12px rgba(102, 126, 234, 0.3));
}

/* Text glow effect */
@keyframes textGlow {
    0%, 100% {
        text-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
    }
    50% {
        text-shadow: 0 0 20px rgba(102, 126, 234, 0.5), 0 0 30px rgba(240, 147, 251, 0.3);
    }
}

.text-glow:hover {
    animation: textGlow 2s ease-in-out infinite;
}

/* Button enhancements */
.btn-sponsor {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    transform: translateY(0);
}

.btn-sponsor::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.btn-sponsor:hover::before {
    left: 100%;
}

.btn-sponsor:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* Responsive animation adjustments */
@media (max-width: 768px) {
    .card-entrance {
        animation: slideUp 0.6s ease-out;
    }

    .sponsor-card:hover {
        transform: translateY(-4px) scale(1.01);
    }

    .btn-sponsor {
        padding: 10px 20px;
        font-size: 0.875rem;
    }

    .sponsor-logo {
        max-width: 50px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .animate-on-scroll {
        opacity: 1;
        transform: none;
    }
}