@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: hsl(237, 100%, 71%);
    --secondary: #4ecdc4;
    --accent: #ffffff;
    --dark: #2c3e50;
    --light: hsl(0, 0%, 100%);
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #c68abf 100%);
    --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --shadow: 0 10px 40px rgba(0,0,0,0.1);
    --shadow-hover: 0 20px 60px rgba(0,0,0,0.2);
}

body {
    font-family: 'Nunito', sans-serif;
    background: var(--light);
    color: var(--dark);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Hero Section */
.hero {
    background: var(--gradient-1);
    padding: 80px 20px 120px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320'%3E%3Cpath fill='%23ffffff' fill-opacity='0.1' d='M0,96L48,112C96,128,192,160,288,186.7C384,213,480,235,576,213.3C672,192,768,128,864,128C960,128,1056,192,1152,208C1248,224,1344,192,1392,176L1440,160L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z'%3E%3C/path%3E%3C/svg%3E") no-repeat bottom;
    background-size: cover;
}

.hero-content {
    position: relative;
    z-index: 1;
    animation: fadeInUp 1s ease;
}

.hero h1 {
    font-size: 10.5rem;
    font-weight: 800;
    color: rgb(255, 0, 0);
    text-shadow: 30px 33px 60px rgba(8, 226, 255, 0.479);
    margin-bottom: 20px;
}

.subtitle {
    font-size: 1.4rem;
    color: rgba(255,255,255,0.9);
    max-width: 600px;
    margin: 0 auto;
}

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

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

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes wiggle {
    0%, 100% { transform: rotate(-3deg); }
    50% { transform: rotate(3deg); }
}

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

/* Filter Navigation */
.filter-nav {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 30px 20px;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.filter-btn {
    padding: 12px 28px;
    border: none;
    border-radius: 50px;
    background: white;
    color: var(--dark);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.filter-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.filter-btn.active {
    background: var(--gradient-2);
    color: white;
}

/* Container & Grid */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
}

.animals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

/* Animal Cards */
.animal-card {
    background: white;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    position: relative;
}

.animal-card:hover {
    transform: translateY(-15px) scale(1.02);
    box-shadow: var(--shadow-hover);
}

.animal-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: var(--gradient-2);
    border-radius: 24px 24px 0 0;
}

.card-image {
    width: 100%;
    height: 220px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8eb 100%);
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.animal-card:hover .card-image img {
    transform: scale(1.1);
}

.card-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to top, white, transparent);
    pointer-events: none;
}

.card-image .emoji {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 2rem;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.2));
    z-index: 2;
}

.animal-card:hover .emoji {
    animation: wiggle 0.5s ease-in-out infinite;
    transform: scale(1.15);
}

.card-content {
    padding: 25px;
}

.card-content h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--dark);
}

.card-content .scientific-name {
    font-style: italic;
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.card-content p {
    color: #666;
    font-size: 0.95rem;
    line-height: 1.7;
}

.card-tags {
    display: flex;
    gap: 8px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.tag {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.tag-habitat {
    background: #e8f5e9;
    color: #2e7d32;
}

.tag-diet {
    background: #fff3e0;
    color: #ef6c00;
}

.tag-status {
    background: #e3f2fd;
    color: #1565c0;
}

.status-endangered {
    background: #ffebee !important;
    color: #c62828 !important;
}

/* Fun Facts Section */
.fun-facts {
    background: var(--gradient-1);
    padding: 80px 20px;
    text-align: center;
}

.fun-facts h2 {
    color: white;
    font-size: 2.5rem;
    margin-bottom: 40px;
}

.facts-carousel {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
    height: 200px;
}

.fact-card {
    position: absolute;
    width: 100%;
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.5s ease;
}

.fact-card.active {
    opacity: 1;
    transform: translateX(0);
}

.fact-emoji {
    font-size: 4rem;
    display: block;
    margin-bottom: 20px;
}

.fact-card p {
    font-size: 1.2rem;
    color: var(--dark);
    font-weight: 600;
}

.fact-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
}

.fact-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    cursor: pointer;
    transition: all 0.3s ease;
}

.fact-dot.active {
    background: white;
    transform: scale(1.3);
}

/* Quiz Section */
.quiz-section {
    padding: 80px 20px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    text-align: center;
}

.quiz-section h2 {
    font-size: 2.5rem;
    margin-bottom: 40px;
    color: #ffffff;
}

.quiz-container {
    max-width: 600px;
    margin: 0 auto;
    background: #212121;
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 10px 60px rgba(0, 0, 0, 0.5);
}

.quiz-question {
    min-height: 200px;
}

#questionText {
    font-size: 1.3rem;
    margin-bottom: 30px;
    color: #ffffff;
}

.quiz-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.quiz-option {
    padding: 20px;
    border: 3px solid #444;
    border-radius: 16px;
    background: #333;
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quiz-option:hover {
    border-color: var(--secondary);
    background: #2a2a2a;
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(78, 205, 196, 0.3);
}

.quiz-option.correct {
    border-color: #4caf50;
    background: #1b5e20;
    color: #ffffff;
    animation: pulse 0.5s ease;
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.4);
}

.quiz-option.wrong {
    border-color: #f44336;
    background: #b71c1c;
    color: #ffffff;
    animation: wiggle 0.5s ease;
    box-shadow: 0 0 20px rgba(244, 67, 54, 0.4);
}

.quiz-score {
    margin-top: 30px;
    font-size: 1.3rem;
    color: #ffffff;
}

/* Footer */
footer {
    background: var(--dark);
    color: white;
    text-align: center;
    padding: 40px 20px;
    font-size: 1.1rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 24px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: var(--dark);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--primary);
    transform: rotate(90deg);
}

.modal-body {
    padding: 40px;
}

.modal-image {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: 16px;
    margin-bottom: 20px;
}

.modal-emoji {
    font-size: 120px;
    text-align: center;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

.modal-body h2 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--dark);
}

.modal-body .scientific-name {
    font-style: italic;
    color: #888;
    margin-bottom: 20px;
}

.modal-body .description {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #555;
    margin-bottom: 25px;
}

.modal-facts {
    background: #f7f7f7;
    border-radius: 16px;
    padding: 25px;
}

.modal-facts h4 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--dark);
}

.modal-facts ul {
    list-style: none;
}

.modal-facts li {
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-facts li:last-child {
    border-bottom: none;
}

/* Responsive */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.2rem;
    }
    
    .subtitle {
        font-size: 1.1rem;
    }
    
    .animals-grid {
        grid-template-columns: 1fr;
    }
    
    .quiz-options {
        grid-template-columns: 1fr;
    }
    
    .filter-nav {
        padding: 20px 10px;
        gap: 10px;
    }
    
    .filter-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

/* Scroll Animation */
.animal-card {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.6s ease forwards;
}

.animal-card:nth-child(1) { animation-delay: 0.1s; }
.animal-card:nth-child(2) { animation-delay: 0.2s; }
.animal-card:nth-child(3) { animation-delay: 0.3s; }
.animal-card:nth-child(4) { animation-delay: 0.4s; }
.animal-card:nth-child(5) { animation-delay: 0.5s; }
.animal-card:nth-child(6) { animation-delay: 0.6s; }
.animal-card:nth-child(7) { animation-delay: 0.7s; }
.animal-card:nth-child(8) { animation-delay: 0.8s; }
.animal-card:nth-child(9) { animation-delay: 0.9s; }
.animal-card:nth-child(10) { animation-delay: 1.0s; }
.animal-card:nth-child(11) { animation-delay: 1.1s; }
.animal-card:nth-child(12) { animation-delay: 1.2s; }

/* Hide class for filtering */
.animal-card.hidden {
    display: none;
}
