﻿/* --- RESET & VARIABLES --- */
:root {
    --primary-green: #2e7d32;
    --light-green: #4ade80;
    --dark-bg: #1a1a2e;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --museum-gold: #d4af37;
    --museum-bronze: #cd7f32;
    --text-primary: #333;
    --text-secondary: #666;
    --bg-primary: #f0fdf4;
    --bg-secondary: #ffffff;
    --card-bg: #ffffff;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --transition-speed: 0.3s;
}

[data-theme="dark"] {
    --primary-green: #4ade80;
    --light-green: #86efac;
    --dark-bg: #0f172a;
    --glass-bg: rgba(0, 0, 0, 0.3);
    --glass-border: rgba(255, 255, 255, 0.1);
    --museum-gold: #fbbf24;
    --museum-bronze: #d97706;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --card-bg: #1e293b;
    --shadow-color: rgba(0, 0, 0, 0.3);
}

* {
    box-sizing: border-box;
    transition: background-color var(--transition-speed) ease,
                color var(--transition-speed) ease,
                border-color var(--transition-speed) ease;
}

body {
    
    margin: 0;
    padding: 0;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- THEME TOGGLE --- */
.theme-toggle {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1001;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.theme-toggle:hover {
    transform: translateY(-50%) rotate(15deg) scale(1.1);
    background: var(--primary-green);
}

.theme-toggle i {
    font-size: 1.3rem;
    color: var(--text-primary);
    transition: transform 0.5s ease;
}

.theme-toggle:hover i {
    transform: rotate(360deg);
}

/* --- GLASS NAVIGATION --- */
.glass-nav {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(76, 121, 73, 0.7);
    backdrop-filter: blur(12px);
    z-index: 1000;
    border-bottom: 1px solid var(--glass-border);
    box-sizing: border-box;
    height: 70px;
}

[data-theme="dark"] .glass-nav {
    background: rgba(30, 41, 59, 0.8);
}

.glass-nav .logo {
    position: absolute;
    left: 5%;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    font-weight: 800;
    color: #aaddae;
    transition: all 0.3s ease;
    margin: 0;
}

[data-theme="dark"] .logo {
    color: #86efac;
}

.logo .highlight {
    color: var(--light-green);
    text-shadow: 0 0 10px rgba(74, 222, 128, 0.3);
}

.nav-btn {
    position: absolute;
    right: 80px;
    top: 50%;
    transform: translateY(-50%);
    text-decoration: none;
    color: #f9fffa;
    font-weight: 600;
    padding: 0.7rem 1.5rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 30px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin: 0;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.nav-btn i {
    transition: transform 0.3s ease;
}

.nav-btn:hover i {
    transform: translateX(-3px);
}

/* --- ANIMATED BACKGROUND --- */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background: linear-gradient(to bottom right, var(--bg-primary), var(--bg-secondary));
}

.background-animation span {
    position: absolute;
    display: block;
    width: 20px;
    height: 20px;
    background: rgba(74, 222, 128, 0.15);
    border-radius: 50%;
    bottom: -150px;
    animation: animateParticles 5s linear infinite;
    opacity: 0.5;
}

[data-theme="dark"] .background-animation span {
    background: rgba(74, 222, 128, 0.08);
}

.background-animation span:nth-child(1) {
    left: 25%;
    width: 80px;
    height: 80px;
    animation-delay: 0s;
}

.background-animation span:nth-child(2) {
    left: 10%;
    width: 20px;
    height: 20px;
    animation-delay: 2s;
    animation-duration: 12s;
}

.background-animation span:nth-child(3) {
    left: 70%;
    width: 20px;
    height: 20px;
    animation-delay: 4s;
}

.background-animation span:nth-child(4) {
    left: 40%;
    width: 60px;
    height: 60px;
    animation-delay: 0s;
    animation-duration: 8s;
}

.background-animation span:nth-child(5) {
    left: 65%;
    width: 20px;
    height: 20px;
    animation-delay: 0s;
}

.background-animation span:nth-child(6) {
    left: 75%;
    width: 110px;
    height: 110px;
    animation-delay: 3s;
}

.background-animation span:nth-child(7) {
    left: 90%;
    width: 40px;
    height: 40px;
    animation-delay: 7s;
    animation-duration: 2s;
}

.background-animation span:nth-child(8) {
    left: 15%;
    width: 30px;
    height: 30px;
    animation-delay: 1s;
    animation-duration: 4s;
}

.background-animation span:nth-child(9) {
    left: 55%;
    width: 70px;
    height: 70px;
    animation-delay: 5s;
    animation-duration: 20s;
}

.background-animation span:nth-child(10) {
    left: 85%;
    width: 25px;
    height: 25px;
    animation-delay: 3s;
    animation-duration: 6s;
}

@keyframes animateParticles {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 0.3;
    }
    100% {
        transform: translateY(-100vh) rotate(720deg);
        opacity: 0;
    }
}

/* --- HERO SECTION --- */
.hero-section {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: url('https://images.unsplash.com/photo-1568864453925-206c927dab0a?q=80&w=1170&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D') center/cover fixed;
    position: relative;
    color: white;
}

[data-theme="dark"] .hero-section {
    background: url('https://images.unsplash.com/photo-1518837695005-2083093ee35b?q=80&w=1170&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D') center/cover fixed;
}

.hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .hero-section::before {
    background: rgba(15, 23, 42, 0.7);
}

.hero-content {
    position: relative;
    z-index: 2;
    padding: 3rem;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: heroFloat 6s ease-in-out infinite;
}

[data-theme="dark"] .hero-content {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.hero-content h1 {
    font-size: 3.5rem;
    margin-bottom: 10px;
    text-shadow: 0px 0px 18px rgba(255, 255, 255, 0.5);
    background: linear-gradient(45deg, #fff, var(--museum-gold), #fff);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 3s ease-in-out infinite;
}

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

.hero-content p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 2rem;
    max-width: 600px;
    line-height: 1.6;
}

.scroll-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    margin-top: 2rem;
    opacity: 0.8;
}

.bounce {
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* --- GALLERY --- */
.museum-container {
    max-width: 1400px;
    margin: -50px auto 0;
    padding: 2rem;
    position: relative;
    z-index: 5;
}

.controls-wrapper {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    border-radius: 50px;
    box-shadow: 0 15px 35px var(--shadow-color);
    display: inline-block;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 3rem;
    width: fit-content;
    border: 1px solid var(--glass-border);
    animation: controlsFloat 4s ease-in-out infinite;
}

@keyframes controlsFloat {
    0%, 100% { transform: translateX(-50%) translateY(0px); }
    50% { transform: translateX(-50%) translateY(-5px); }
}

.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.filter-btn {
    border: 2px solid transparent;
    background: transparent;
    padding: 12px 28px;
    border-radius: 25px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.filter-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(46, 125, 50, 0.1), transparent);
    transition: left 0.5s;
}

.filter-btn:hover::before {
    left: 100%;
}

.filter-btn:hover {
    background: rgba(46, 125, 50, 0.1);
    color: var(--primary-green);
    transform: translateY(-2px);
    border-color: var(--primary-green);
}

.filter-btn.active {
    background: linear-gradient(135deg, var(--primary-green), var(--light-green));
    color: white;
    box-shadow: 0 8px 20px rgba(46, 125, 50, 0.4);
    transform: translateY(-3px);
    border-color: var(--primary-green);
}

/* --- GRID & CARDS --- */
.museum-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2.5rem;
}

.animal-card {
    background: var(--card-bg);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 20px var(--shadow-color);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid var(--glass-border);
    position: relative;
    cursor: pointer;
}

.animal-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.6s;
    z-index: 1;
}

[data-theme="dark"] .animal-card::before {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

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

.animal-card:hover {
    transform: translateY(-20px) scale(1.03) rotateY(5deg);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    z-index: 10;
    border-color: var(--primary-green);
}

.card-image-wrapper {
    position: relative;
    height: 240px;
    overflow: hidden;
}

.animal-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s ease;
}

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

/* Status Badges */
.status-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 8px 15px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    animation: badgePulse 2s ease-in-out infinite;
    z-index: 2;
}

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

.status-EXT {
    background: linear-gradient(135deg, #d32f2f, #f44336);
}

.status-END {
    background: linear-gradient(135deg, #f57c00, #ff9800);
}

.status-REC {
    background: linear-gradient(135deg, #388e3c, #4caf50);
}

.animal-content {
    padding: 1.5rem;
    position: relative;
    z-index: 2;
}

.animal-name {
    margin: 0;
    font-size: 1.4rem;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.animal-card:hover .animal-name {
    color: var(--primary-green);
}

.scientific-name {
    font-style: italic;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    transition: color 0.3s ease;
}

.animal-card:hover .scientific-name {
    color: var(--museum-bronze);
}

.animal-description {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* --- FOOTER --- */
footer {
    text-align: center;
    padding: 3rem;
    margin-top: 4rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
}

/* Loading Animation */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.museum-loader {
    text-align: center;
}

.loader-icon {
    font-size: 4rem;
    animation: pulse 2s ease-in-out infinite;
    margin-bottom: 1rem;
}

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

.loader-text {
    font-size: 1.2rem;
    color: var(--primary-green);
    font-weight: 600;
}

/* Animal Modal */
.animal-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
    padding: 1rem;
}

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

.modal-content {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 0;
    max-width: 700px;
    width: 100%;
    max-height: 85vh;
    position: relative;
    animation: slideIn 0.3s ease;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
}

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

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-secondary);
    z-index: 10001;
    background: var(--card-bg);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px var(--shadow-color);
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: var(--primary-green);
    color: white;
    transform: rotate(90deg);
}

.animal-header {
    display: flex;
    gap: 1.5rem;
    padding: 2rem;
    background: linear-gradient(135deg, var(--glass-bg), rgba(74, 222, 128, 0.1));
    border-bottom: 1px solid var(--glass-border);
}

.animal-header img {
    width: 200px;
    height: 150px;
    object-fit: cover;
    border-radius: 15px;
    flex-shrink: 0;
    border: 2px solid var(--glass-border);
}

.animal-title {
    flex: 1;
}

.animal-title h2 {
    color: var(--primary-green);
    margin-bottom: 0.5rem;
    font-size: 1.8rem;
}

.scientific {
    font-style: italic;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.animal-details {
    padding: 2rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.detail-item {
    background: var(--glass-bg);
    padding: 1rem;
    border-radius: 10px;
    border-left: 4px solid var(--primary-green);
}

.detail-item strong {
    color: var(--primary-green);
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.description {
    background: rgba(74, 222, 128, 0.1);
    padding: 1.5rem;
    border-radius: 10px;
    line-height: 1.6;
    font-style: italic;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary-green);
}

/* Category Indicators */
.category-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
}

.category-EXT { background: #f44336; }
.category-END { background: #ff9800; }
.category-REC { background: #4caf50; }

/* Stats Counter */
.stats-counter {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    padding: 1rem 1.5rem;
    border-radius: 15px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 25px var(--shadow-color);
    z-index: 100;
    animation: slideUp 0.5s ease;
}

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

.stats-counter span {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.stats-counter .count {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-green);
    margin-top: 0.3rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Hover Effects Enhancement */
.animal-card:hover .card-image-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.2), transparent);
    z-index: 1;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-green);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--light-green);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .hero-content {
        padding: 2rem;
        margin: 0 1rem;
    }
    
    .hero-content h1 {
        font-size: 2.2rem;
    }
    
    .hero-content p {
        font-size: 1rem;
    }

    .glass-nav {
        padding: 0.8rem 1rem;
        height: 60px;
    }
    
    .glass-nav .logo {
        left: 1rem;
        font-size: 1.1rem;
        max-width: 150px;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
    
    .theme-toggle {
        right: 10px;
        width: 40px;
        height: 40px;
    }
    
    .theme-toggle i {
        font-size: 1.1rem;
    }
    
    .nav-btn {
        right: 55px;
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    .museum-container {
        padding: 1rem;
        margin-top: -30px;
    }

    .filters {
        gap: 8px;
    }
    
    .filter-btn {
        padding: 10px 20px;
        font-size: 0.85rem;
    }
    
    .museum-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .modal-content {
        padding: 0;
        margin: 0.5rem;
    }
    
    .animal-header {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem;
    }
    
    .animal-header img {
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
        height: 200px;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .animal-details {
        padding: 1.5rem;
    }
    
    .stats-counter {
        left: 50%;
        transform: translateX(-50%);
        bottom: 1rem;
        width: 90%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .glass-nav {
        height: 55px;
    }
    
    .glass-nav .logo {
        font-size: 1rem;
        max-width: 100px;
    }
    
    .nav-btn span {
        display: none;
    }
    
    .nav-btn {
        right: 45px;
        width: 40px;
        padding: 0.5rem;
        justify-content: center;
    }
    
    .nav-btn i {
        margin: 0;
    }
    
    .theme-toggle {
        right: 5px;
        width: 35px;
        height: 35px;
    }
    
    .theme-toggle i {
        font-size: 1rem;
    }
    
    .hero-content h1 {
        font-size: 1.8rem;
    }
    
    .hero-content p {
        font-size: 0.9rem;
    }
    
    .filter-btn {
        padding: 8px 16px;
        font-size: 0.8rem;
    }
    
    .controls-wrapper {
        padding: 1rem;
        border-radius: 30px;
    }
}

/* Print Styles */
@media print {
    .theme-toggle,
    .glass-nav,
    .stats-counter,
    .filter-btn,
    .close-btn {
        display: none !important;
    }
    
    .animal-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}