/* Dark mode variables */
:root {
    --bg-primary: #f9fafb;
    --bg-secondary: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --card-bg: #ffffff;
    --nav-bg: #111827;
    --gradient-from: #ffffff;
    --gradient-to: #f9fafb;
}

[data-theme="dark"] {
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --border-color: #374151;
    --card-bg: #1f2937;
    --nav-bg: #111827;
    --gradient-from: #111827;
    --gradient-to: #1f2937;
}

/* Dark mode toggle button */
.theme-toggle {
    width: 50px;
    height: 26px;
    background: var(--border-color);
    border-radius: 50px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    outline: none;
}

[data-theme="dark"] .theme-toggle {
    background: #3b82f6;
}

.theme-toggle::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: white;
    top: 2px;
    left: 2px;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .theme-toggle::before {
    transform: translateX(24px);
}

.theme-toggle-icon {
    position: absolute;
    font-size: 12px;
    top: 50%;
    transform: translateY(-50%);
    transition: all 0.3s ease;
}

.sun-icon {
    left: 6px;
    color: #fbbf24;
    opacity: 1;
}

.moon-icon {
    right: 6px;
    color: #60a5fa;
    opacity: 0;
}

[data-theme="dark"] .sun-icon {
    opacity: 0;
}

[data-theme="dark"] .moon-icon {
    opacity: 1;
}

/* Theme-aware styles */
.card-bg {
    background-color: var(--card-bg);
    transition: background-color 0.3s ease;
}

.text-theme-primary {
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.text-theme-secondary {
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.border-theme {
    border-color: var(--border-color);
    transition: border-color 0.3s ease;
}

.bg-theme-primary {
    background-color: var(--bg-primary);
    transition: background-color 0.3s ease;
}

.bg-theme-secondary {
    background-color: var(--bg-secondary);
    transition: background-color 0.3s ease;
}

/* Form elements dark mode support */
[data-theme="dark"] select option {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Smooth transitions for all theme changes */
*, *::before, *::after {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Custom animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Gallery specific animations */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-fadeInUp {
    animation: fadeInUp 0.8s ease-out forwards;
}

.animate-slideInLeft {
    animation: slideInLeft 0.8s ease-out forwards;
}

.animate-scaleIn {
    animation: scaleIn 0.6s ease-out forwards;
}

.animation-delay-200 {
    animation-delay: 0.2s;
}

.animation-delay-400 {
    animation-delay: 0.4s;
}

.animation-delay-600 {
    animation-delay: 0.6s;
}

.animation-delay-800 {
    animation-delay: 0.8s;
}

.animation-delay-1000 {
    animation-delay: 1s;
}

/* Glass effect */
.glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Gradient text */
.gradient-text {
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.gallery-item.featured {
    grid-column: span 2;
}

/* Gallery Items */
.gallery-item {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.gallery-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.gallery-item img {
    transition: transform 0.5s ease, filter 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
    filter: brightness(0.8);
}

/* Filter Buttons */
.filter-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.filter-btn::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 ease;
}

.filter-btn:hover::before {
    left: 100%;
}

.filter-btn.active {
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(30, 64, 175, 0.4);
}

.filter-btn:not(.active):hover {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Modal */
.gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.gallery-modal.active {
    opacity: 1;
    visibility: visible;
}

.gallery-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.gallery-modal.active .gallery-modal-content {
    transform: scale(1);
}

.gallery-modal img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 12px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

/* Loading states */
.loading {
    position: relative;
    opacity: 0.7;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #1e40af;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #1e40af;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3b82f6;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .gallery-item.featured {
        grid-column: span 1;
    }

    .filter-btn {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }

    .gallery-modal-content {
        max-width: 95vw;
        max-height: 80vh;
    }
}

@media (max-width: 1024px) {
    .gallery-item.featured {
        grid-column: span 1;
    }
}

/* Loader animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Hover effects for stats cards */
.stat-card {
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Badge animations */
.badge {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Image loading effect */
.gallery-item img {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.gallery-item img.loaded {
    opacity: 1;
}

/* Lightbox navigation */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lightbox-nav:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-nav.prev {
    left: 20px;
}

.lightbox-nav.next {
    right: 20px;
}
