/* Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Ubuntu', sans-serif;
}

body {
    transition: background-color 0.3s, color 0.3s;
}

/* Grid Container */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 1.5rem;
    padding: 1.5rem;
}

@media (max-width: 640px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 1rem;
        padding: 1rem;
    }
}

/* Image Card */
.image-card {
    position: relative;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease-in-out;
    aspect-ratio: 4/3;
    cursor: pointer;
    border: 2px solid #e95f5c;
    background: rgba(255, 255, 255, 0.05);
}

.image-card:hover {
    transform: translateY(-4px);
    border-color: #d54542;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

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

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

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    touch-action: none;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
}

.modal-content-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

.modal-content {
    max-width: 95%;
    max-height: 90vh;
    object-fit: contain;
    transform: scale(0.95);
    transition: transform 0.3s ease;
    touch-action: none;
    transform-origin: center;
    cursor: grab;
}

.modal-content:active {
    cursor: grabbing;
}

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

/* Zoom container and controls */
.zoom-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

.zoom-controls {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    padding: 8px 16px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1001;
    backdrop-filter: blur(4px);
}

.zoom-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.zoom-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

#zoomLevel {
    color: white;
    font-size: 14px;
    min-width: 60px;
    text-align: center;
}

/* Mobile adjustments for zoom controls */
@media (max-width: 640px) {
    .zoom-controls {
        bottom: 10px;
        padding: 6px 12px;
    }

    .zoom-btn {
        font-size: 16px;
        width: 24px;
        height: 24px;
    }

    #zoomLevel {
        font-size: 12px;
        min-width: 50px;
    }
}

/* Close button */
.close {
    position: fixed;
    right: 1rem;
    top: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1001;
    backdrop-filter: blur(4px);
}

/* Theme toggle */
.theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    border: 2px solid rgba(233, 95, 92, 0.2);
    background-color: rgba(255, 255, 255, 0.1);
}

.theme-toggle:hover {
    border-color: rgba(233, 95, 92, 0.4);
    background-color: rgba(255, 255, 255, 0.2);
}

.theme-icon {
    font-size: 20px;
}

/* Dark mode theme toggle */
.dark .theme-toggle {
    background-color: rgba(0, 0, 0, 0.2);
}

.dark .theme-toggle:hover {
    background-color: rgba(0, 0, 0, 0.3);
}

/* Navigation buttons */
.nav-btn {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    border-radius: 50%;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.nav-btn:hover {
    background-color: rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-50%) scale(1.1);
}

.prev {
    left: 20px;
}

.next {
    right: 20px;
}

/* Mobile adjustments */
@media (max-width: 640px) {
    .nav-btn {
        width: 36px;
        height: 36px;
        font-size: 20px;
    }
    
    .prev {
        left: 10px;
    }
    
    .next {
        right: 10px;
    }
}

/* Dark mode adjustments */
.dark .nav-btn {
    background-color: rgba(0, 0, 0, 0.4);
}

.dark .nav-btn:hover {
    background-color: rgba(0, 0, 0, 0.6);
}

/* Dark mode */
.dark {
    background-color: #1a1a1a;
    color: #ffffff;
}

.dark .image-card {
    border-color: #e95f5c;
    background: rgba(255, 255, 255, 0.03);
}

.dark .image-card:hover {
    border-color: #d54542;
}

.light .theme-toggle {
    background-color: rgba(229, 229, 229, 0.8);
    color: #1a1a1a;
}

.light .image-card {
    border-color: #e95f5c;
    background: rgba(0, 0, 0, 0.02);
}

.light .image-card:hover {
    border-color: #d54542;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1.5rem;
    text-align: center;
}

.header-logo {
    height: 60px;
    width: auto;
    object-fit: contain;
    border-radius: 50%;
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 600;
    color: #e95f5c;
    margin: 0;
    padding: 0;
}

.page-header .subtitle {
    font-size: 1.2rem;
    color: #666;
    margin: 0.5rem 0 0 0;
    padding: 0;
}

@media (max-width: 640px) {
    .page-header {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .header-logo {
        height: 50px;
    }
    
    .page-header h1 {
        font-size: 2rem;
    }

    .page-header .subtitle {
        font-size: 1rem;
    }
}

/* Dark mode adjustments */
.dark .page-header {
    background: linear-gradient(to right, rgba(233, 95, 92, 0.05), rgba(233, 95, 92, 0.1), rgba(233, 95, 92, 0.05));
}

.dark .page-header .subtitle {
    color: #999;
}

/* Loading animation */
.loading {
    position: relative;
    background: linear-gradient(110deg, #ececec 8%, #f5f5f5 18%, #ececec 33%);
    background-size: 200% 100%;
    animation: shimmer 1.5s linear infinite;
}

.dark .loading {
    background: linear-gradient(110deg, #2a2a2a 8%, #333 18%, #2a2a2a 33%);
    background-size: 200% 100%;
}

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

.loading img {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-card:not(.loading) img {
    opacity: 1;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #e95f5c;
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 1000;
}

.back-to-top i {
    font-size: 18px;
    transition: transform 0.3s ease;
}

.back-to-top:hover i {
    transform: translateY(-2px);
}

.back-to-top:hover {
    background-color: #d54542;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.back-to-top.visible {
    display: flex;
}

/* Dark mode adjustments */
.dark .back-to-top {
    background-color: #d54542;
}

.dark .back-to-top:hover {
    background-color: #c13c39;
}

/* Back to Home Button */
.back-home {
    position: fixed;
    top: 20px;
    left: 20px;
    background-color: #e95f5c;
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 1000;
    text-decoration: none;
}

.back-home i {
    font-size: 18px;
    transition: transform 0.3s ease;
}

.back-home:hover {
    background-color: #d54542;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    color: white;
}

.back-home:hover i {
    transform: scale(1.1);
}

/* Dark mode adjustments */
.dark .back-home {
    background-color: #d54542;
}

.dark .back-home:hover {
    background-color: #c13c39;
}