/* Gallery-specific styles */
.gallery-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem 2rem;
}

/* Breadcrumb Navigation */
.breadcrumb {
    padding: 1rem 2rem;
    background-color: rgba(26, 26, 26, 0.5);
    border-bottom: 1px solid rgba(255, 136, 0, 0.2);
}

.breadcrumb-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.breadcrumb-item {
    font-size: 0.9rem;
}

.breadcrumb-item a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumb-item a:hover {
    color: var(--primary-color);
}

.breadcrumb-item.active {
    color: var(--primary-color);
    font-weight: 600;
}

.breadcrumb-separator {
    color: #666;
    user-select: none;
}

/* Category filter buttons styling */
.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.category-btn {
    padding: 0.5rem 1rem;
    background-color: var(--secondary-color);
    color: var(--text-color);
    border: 1px solid rgba(255, 136, 0, 0.3);
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.category-btn:hover {
    background-color: rgba(255, 136, 0, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.category-btn.active {
    background-color: var(--primary-color);
    color: #000;
    border-color: var(--primary-color);
    box-shadow: 0 3px 6px rgba(255, 136, 0, 0.4);
}

.category-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.gallery-header {
    margin: 3rem 2rem 2rem;
    text-align: center;
    border-bottom: none;
    padding-bottom: 1rem;
}

.gallery-title {
    color: var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.back-link {
    color: var(--text-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.back-link:hover {
    color: var(--primary-color);
    transform: translateX(-5px);
}

.gallery-section {
    margin: 0 2rem 3rem;
}

.section-title {
    color: var(--primary-color);
    margin-bottom: 1rem;
    border-left: 3px solid var(--primary-color);
    padding-left: 0.5rem;
}

.image-grid {
    /* Masonry layout using column-count */
    column-count: 4;
    column-gap: 1.5rem;
}

.image-card {
    background: var(--secondary-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
    display: inline-block;
    width: 100%;
    margin-bottom: 1.5rem;
    break-inside: avoid;
    opacity: 0;
    animation: fadeInUp 0.6s ease-out forwards;
    border: 1px solid transparent;
}

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

.image-card:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.7);
    border: 1px solid var(--primary-color);
    position: relative;
    z-index: 1;
}

.card-image-container {
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #121212;
    padding: 1rem;
    position: relative;
}

.card-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: pointer;
    transition: transform 0.4s ease;
}

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

/* Share button styles */
.share-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: 1px solid rgba(255, 136, 0, 0.5);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10;
}

.card-image-container:hover .share-btn {
    opacity: 1;
}

.share-btn:hover {
    background-color: var(--primary-color);
    color: #000;
    transform: scale(1.1);
}

/* Video specific styling */
.card-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-image-container::after {
    content: '🔍';
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.6);
    color: #fff;
    border-radius: 4px;
    padding: 4px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.card-image-container:hover::after {
    opacity: 1;
}

.image-info {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.image-name {
    font-size: 0.9rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-path {
    font-size: 0.75rem;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-size {
    font-size: 0.7rem;
    color: var(--primary-color);
    margin-top: 0.5rem;
}

.checkerboard-bg {
    background-image: linear-gradient(45deg, #1a1a1a 25%, transparent 25%),
                      linear-gradient(-45deg, #1a1a1a 25%, transparent 25%),
                      linear-gradient(45deg, transparent 75%, #1a1a1a 75%),
                      linear-gradient(-45deg, transparent 75%, #1a1a1a 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

/* Download button styling */
.download-btn {
    display: block;
    width: 100%;
    padding: 0.5rem;
    background-color: var(--primary-color);
    color: #000;
    text-align: center;
    font-weight: bold;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 0.75rem;
    transition: all 0.3s ease;
}

.download-btn:hover {
    background-color: #FF9900;
    transform: scale(1.02);
}

.download-btn:active {
    transform: scale(0.98);
}

/* Loading indicator styling */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    color: var(--primary-color);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 136, 0, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
    margin-right: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Skeleton loader for images */
.image-card.loading .card-image-container {
    position: relative;
    overflow: hidden;
}

.image-card.loading .card-image-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        rgba(255, 136, 0, 0.05) 0%,
        rgba(255, 136, 0, 0.15) 50%,
        rgba(255, 136, 0, 0.05) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    z-index: 1;
}

.image-card.loading .card-image {
    opacity: 0;
}

.image-card.loaded .card-image {
    opacity: 1;
    transition: opacity 0.3s ease-in;
}

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

.no-images {
    text-align: center;
    padding: 2rem;
    color: var(--text-color);
    background: var(--secondary-color);
    border-radius: 8px;
    margin: 2rem 0;
}

/* Override default body styles for gallery page */
html.gallery-page, body.gallery-page {
    overflow: auto;
    overflow-x: hidden;
    height: auto;
    min-height: 100vh;
}

body.gallery-page .page-container {
    padding: 0;
}

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

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

.modal-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.modal-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: calc(90vh - 60px);
    overflow: hidden;
}

.enlarged-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.8);
    background-color: rgba(26, 26, 26, 0.3);
    transition: transform 0.3s ease;
    cursor: grab;
}

/* Video in modal shouldn't have grab cursor */
#enlarged-video {
    cursor: default;
}

.close-modal {
    position: absolute;
    top: -40px;
    right: 0;
    color: #fff;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1010;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close-modal:hover {
    color: var(--primary-color);
    transform: scale(1.1);
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 15px 0;
    color: #fff;
}

.nav-btn {
    background-color: rgba(255, 136, 0, 0.8);
    color: #000;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.nav-btn:hover {
    background-color: var(--primary-color);
    transform: scale(1.1);
}

.nav-btn:active {
    transform: scale(0.95);
}

.image-counter {
    color: #ccc;
    font-size: 14px;
    font-weight: 600;
}

body.modal-open {
    overflow: hidden;
}

.modal-download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: #000;
    font-weight: bold;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    width: max-content;
}

.modal-download-btn:hover {
    background-color: #FF9900;
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.modal-download-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.download-icon {
    width: 18px;
    height: 18px;
}

/* Smartphone optimizations */
@media (max-width: 768px) {
    .gallery-container {
        padding: 0.75rem 1.5rem 1.5rem;
    }
    
    .gallery-header {
        margin: 2rem 1.5rem 1.5rem;
    }
    
    .category-filters {
        gap: 0.5rem;
        margin-bottom: 1.25rem;
    }
    
    .category-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .gallery-title {
        font-size: 2rem;
    }
    
    .image-grid {
        column-count: 2;
        column-gap: 1rem;
    }
    
    .card-image-container {
        height: 140px;
    }
    
    .download-btn {
        padding: 0.7rem;
        min-height: 44px; /* Minimum recommended tap target size */
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .gallery-section {
        margin: 0 1.5rem 2.5rem;
    }
    
    .modal-content {
        width: 95%;
    }
    
    .modal-image-container {
        height: calc(90vh - 80px);
    }
    
    .close-modal {
        top: -35px;
        right: 5px;
    }
    
    .nav-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .modal-download-btn {
        padding: 12px 24px;
        margin-top: 20px;
        width: 100%;
        max-width: 250px;
    }
}

@media (max-width: 576px) {
    .gallery-container {
        padding: 0.5rem 1rem 1rem;
    }
    
    .gallery-title {
        font-size: 1.8rem;
    }
    
    .back-link {
        font-size: 0.9rem;
    }
    
    .image-grid {
        column-count: 2;
        column-gap: 0.75rem;
    }
    
    .card-image-container {
        height: 130px;
        padding: 0.75rem;
    }
    
    .image-info {
        padding: 0.75rem;
    }
    
    .gallery-header {
        margin: 1.5rem 1rem 1.25rem;
    }
    
    .gallery-section {
        margin: 0 1rem 2rem;
    }
    
    .modal-image-container {
        height: calc(80vh - 80px);
    }
    
    .close-modal {
        top: -30px;
        right: 0;
    }
    
    .modal-download-btn {
        padding: 10px 20px;
    }
}

/* Very small screens (iPhone SE, etc.) */
@media (max-width: 360px) {
    .gallery-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .image-grid {
        column-count: 1;
    }
    
    .card-image-container {
        height: 110px;
    }
}