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

body {
    font-family: 'Arial', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    padding: 2rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 1rem;
}

#metadata-info {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 0.5rem;
}

.region-navigation {
    background: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
    margin-bottom: 2rem;
}

.nav-button {
    display: inline-block;
    margin: 0.25rem;
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 25px;
    color: #495057;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.nav-button:hover,
.nav-button.active {
    background: #007bff;
    border-color: #007bff;
    color: white;
    transform: translateY(-2px);
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

#loading {
    text-align: center;
    font-size: 1.2rem;
    color: #666;
    margin: 2rem 0;
}

#gallery-stats {
    background: white;
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
    color: #666;
}

.region-section {
    margin-bottom: 3rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    overflow: hidden;
}

.region-header {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.region-title {
    font-size: 1.5rem;
    font-weight: bold;
}

.region-count {
    font-size: 0.9rem;
    opacity: 0.9;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 2rem;
}

.image-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: white;
    cursor: pointer;
}

.image-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.2);
}

.thumbnail-container {
    position: relative;
    overflow: hidden;
}

.image-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

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

.thumbnail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 123, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-item:hover .thumbnail-overlay {
    opacity: 1;
}

.zoom-icon {
    color: white;
    font-size: 2rem;
    font-weight: bold;
}

.image-info {
    padding: 1rem;
}

.image-filename {
    font-weight: bold;
    color: #333;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.image-product {
    color: #007bff;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.image-region {
    color: #6c757d;
    font-size: 0.85rem;
    font-style: italic;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 95vw;
    margin: 0 auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.modal-close {
    color: white;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: #ff6b6b;
}

.modal-navigation {
    display: flex;
    gap: 1rem;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.modal-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 1rem;
}

#modal-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.modal-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1.2rem;
    background: rgba(0, 0, 0, 0.7);
    padding: 1rem 2rem;
    border-radius: 10px;
    display: none;
}

.modal-info {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1.5rem 2rem;
    color: #333;
}

.modal-info h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: #007bff;
}

.modal-info p {
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.modal-actions {
    margin-top: 1rem;
    display: flex;
    gap: 1rem;
}

.action-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

.action-btn:hover {
    background: #0056b3;
}

.error-message {
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e);
    color: white;
    padding: 1.5rem;
    border-radius: 10px;
    margin: 2rem 0;
    text-align: center;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.no-images {
    text-align: center;
    color: #6c757d;
    font-size: 1.1rem;
    margin: 3rem 0;
    padding: 2rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Hidden class for filtering */
.hidden {
    display: none !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
        padding: 1rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .region-header {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .nav-button {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .region-navigation {
        padding: 0.5rem;
    }

    .modal-header {
        padding: 0.5rem 1rem;
    }

    .modal-info {
        padding: 1rem;
    }

    .modal-actions {
        flex-direction: column;
    }

    .nav-btn {
        padding: 0.4rem 0.8rem;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .image-grid {
        grid-template-columns: 1fr;
    }
    
    main {
        padding: 0 0.5rem;
    }

    .modal-content {
        max-width: 100vw;
    }
}