/**
 * Gallery Styles
 * 
 * Styles for VeloSano Photo Gallery functionality
 */

/* ==========================================================================
   Gallery Category Archive Styles
   ========================================================================== */

.gallery-category-container {
    padding: 2rem 0;
}

/* Category Header */
.gallery-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem 0;
}

.gallery-category-header .page-title {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary);
    margin: 0;
    text-align: left;
}

.gallery-category-header .category-description {
    display: none;
}

/* Filter Section */
.gallery-filters {
    margin-bottom: 2rem;
    padding: 1rem 0;
    background: transparent;
    border-radius: 0;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    justify-content: flex-end;
}

/* Search Container */
.search-container {
    position: relative;
    width: 300px;
    max-width: 100%;
}

.search-container input {
    width: 100%;
    padding: 0.75rem 4rem 0.75rem 3.5rem;
    border: 4px solid var(--tertiary);
    border-radius: 30px;
    font-size: 1rem;
    transition: all 0.3s ease;
    text-align: center;
}

.search-container input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.search-button {
    position: absolute;
    right: 0px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    height: 100%;
    cursor: pointer;
    transition: background-color 0.3s ease;
    aspect-ratio: 1/1;
}

.search-button:hover {
    background: var(--secondary);
}

.search-loading {
    position: absolute;
    right: 3.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
}

/* Search Info Button */
.search-info-btn {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    color: #666;
    border: none;
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    cursor: pointer;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-info-btn:hover {
    color: #333;
}

/* Search Info Button Tooltip */
.search-info-btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: normal;
    white-space: normal;
    width: 280px;
    text-align: center;
    z-index: 9999;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.search-info-btn[title]:hover::before {
    content: '';
    position: absolute;
    bottom: -52px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #333;
    z-index: 10000;
}

/* Filter Dropdowns */
.filter-container {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 150px;
}

.filter-container label {
    display: none;
}

.filter-select {
    text-decoration: none;
    background: transparent;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 300px;
    padding: 10px 40px 10px 20px;
    border-radius: 30px;
    font-weight: 600;
    text-align: center;
    transition: all .3s ease-in-out;
    text-transform: uppercase;
    font-size: 16px;
    border: 3px solid var(--tertiary);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}

.filter-select:hover {
    background: var(--primary);
    color: white;
}

/* Custom dropdown arrow */
.filter-container::after {
    content: '';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 10px solid var(--tertiary);
    pointer-events: none;
    transition: all .3s ease-in-out;
}

.filter-container:hover::after {
    border-top-color: white;
}

.filter-select:focus+.filter-container::after,
.filter-container:has(.filter-select:focus)::after {
    border-top-color: white;
    transform: translateY(-50%) rotate(180deg);
}

/* Clear Filters Button */
.clear-filters-btn {
    padding: 0.75rem 1.5rem;
    background: var(--secondary);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.clear-filters-btn:hover {
    background: var(--primary);
}

/* Results Info */
.results-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2rem 0 1rem 0;
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

#results-count {
    font-weight: 600;
    color: #333;
    font-size: 1.1rem;
}

#filter-status {
    color: #666;
    font-size: 0.9rem;
    font-style: italic;
}

/* Images Grid */
.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.image-item {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.image-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.image-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.image-link:hover {
    text-decoration: none;
    color: inherit;
}

.image-container {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    height: 200px;
    width: 100%;
}

.image-container img {
    width: 100%;
    height: 100%;
    display: block;
    transition: transform 0.3s ease;
    object-fit: cover;
}

.image-item:hover .image-container img {
    transform: scale(1.05);
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: flex-end;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-item:hover .image-overlay {
    opacity: 1;
}

.image-overlay .bib-numbers {
    background: rgba(0, 124, 186, 0.9);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.image-overlay .bib-numbers i {
    margin-right: 0.5rem;
}

.image-info {
    padding: 1rem;
    background: white;
}

.gallery-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.event-date {
    color: #666;
    font-size: 0.8rem;
}

/* Loading States */
.loading-state {
    text-align: center;
    padding: 4rem 2rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 2rem 0;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.loading-content i {
    color: var(--primary);
}

.loading-content p {
    color: #666;
    font-size: 1.1rem;
    margin: 0;
}

/* No Results */
.no-images {
    text-align: center;
    padding: 4rem 2rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 2rem 0;
    border: 2px dashed #ddd;
}

.no-images-content i {
    font-size: 4rem;
    color: #ccc;
    margin-bottom: 1rem;
}

.no-images-content h3 {
    color: #666;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.no-images-content p {
    color: #999;
    font-size: 1rem;
    max-width: 400px;
    margin: 0 auto;
}

/* Load More */
.load-more-container {
    text-align: center;
    margin: 3rem 0;
}

.load-more-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.load-more-btn:hover {
    background: var(--secondary);
}

.load-more-info {
    text-align: center;
    margin-top: 1rem;
    color: #666;
    font-size: 0.9rem;
}

/* ==========================================================================
   Gallery Archive Styles (Main Archive Page)
   ========================================================================== */

.gallery-archive-container {
    padding: 2rem 0;
}

.gallery-archive-header {
    text-align: center;
    margin-bottom: 3rem;
}

.gallery-archive-header .page-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #333;
}

.gallery-archive-header .page-description {
    font-size: 1.1rem;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
}

/* Category Sections */
.gallery-categories {
    margin-bottom: 3rem;
}

.category-section {
    margin-bottom: 4rem;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--primary);
}

.category-title {
    font-size: 2rem;
    color: #333;
    margin: 0;
}

.view-all-btn {
    background: var(--primary);
    color: white;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.view-all-btn:hover {
    background: var(--secondary);
    text-decoration: none;
    color: white;
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Gallery Cards */
.gallery-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.gallery-card-image {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
}

.gallery-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-card:hover .gallery-card-image img {
    transform: scale(1.05);
}

.placeholder-image {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: #f8f9fa;
    color: #6c757d;
}

.placeholder-image i {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.image-count {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
}

.gallery-card-content {
    padding: 1.5rem;
}

.gallery-title {
    margin: 0 0 1rem 0;
    font-size: 1.25rem;
}

.gallery-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.gallery-title a:hover {
    color: var(--primary);
}

.gallery-date,
.gallery-location {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: #666;
    font-size: 0.9rem;
}

.gallery-date i,
.gallery-location i {
    color: var(--primary);
    width: 1rem;
}

.category-tag {
    display: inline-block;
    background: #e9ecef;
    color: #495057;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    margin-right: 0.5rem;
    margin-bottom: 0.25rem;
}

.gallery-excerpt {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 1rem 0;
}

.gallery-card-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.view-gallery-btn {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 0.5rem 1rem;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.view-gallery-btn:hover {
    background: var(--secondary);
    text-decoration: none;
    color: white;
}

/* ==========================================================================
   Single Gallery Styles
   ========================================================================== */

.single-gallery-container {
    padding: 2rem 0;
}

.gallery-header {
    margin-bottom: 3rem;
}

.gallery-breadcrumbs {
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.gallery-breadcrumbs a {
    color: var(--primary);
    text-decoration: none;
}

.gallery-breadcrumbs a:hover {
    text-decoration: underline;
}

.gallery-breadcrumbs .separator {
    margin: 0 0.5rem;
    color: #666;
}

.gallery-breadcrumbs .current {
    color: #666;
}

.gallery-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 4px;
}

.gallery-meta>div {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #666;
}

.gallery-meta i {
    color: var(--primary);
    width: 1rem;
}

.gallery-categories .category-link {
    color: var(--primary);
    text-decoration: none;
    margin-right: 1rem;
}

.gallery-categories .category-link:hover {
    text-decoration: underline;
}

.gallery-description {
    margin-top: 2rem;
    padding: 1.5rem;
    background: white;
    border-left: 4px solid var(--primary);
    border-radius: 4px;
}

/* Gallery Controls */
.gallery-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 4px;
}

.view-controls {
    display: flex;
    gap: 0.5rem;
}

.view-btn {
    background: #e9ecef;
    color: #495057;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.view-btn.active,
.view-btn:hover {
    background: var(--primary);
    color: white;
}

.view-btn i {
    margin-right: 0.5rem;
}

.gallery-search {
    position: relative;
    flex: 1;
    min-width: 250px;
    max-width: 400px;
}

.gallery-search input {
    width: 100%;
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.gallery-search button {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
}

.sort-controls select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Gallery Images */
.gallery-images {
    margin-bottom: 3rem;
}

.gallery-images.view-grid {
    display: grid;
    gap: 1rem;
}

.gallery-images.columns-3 {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.gallery-images.columns-4 {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.gallery-images.columns-5 {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.gallery-images.columns-6 {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.gallery-images.view-masonry {
    column-count: 4;
    column-gap: 1rem;
}

.gallery-image-item {
    position: relative;
    background: white;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    break-inside: avoid;
    margin-bottom: 1rem;
}

.gallery-image-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Aspect Ratio Classes */
.gallery-images.aspect-16-9 .image-container {
    aspect-ratio: 16/9;
}

.gallery-images.aspect-16-9 .image-container img {
    height: 100%;
    object-fit: cover;
}

.gallery-images.aspect-1-1 .image-container {
    aspect-ratio: 1/1;
}

.gallery-images.aspect-1-1 .image-container img {
    height: 100%;
    object-fit: cover;
}

.image-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.action-btn {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border: none;
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.action-btn:hover {
    background: white;
    color: #333;
    text-decoration: none;
}

.bib-numbers {
    background: rgba(0, 124, 186, 0.9);
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    align-self: flex-start;
    transition: opacity 0.3s ease;
}

.bib-numbers i {
    margin-right: 0.25rem;
}

/* Hide bib numbers on image hover */
.image-container:hover .bib-numbers,
.gallery-image-item:hover .bib-numbers {
    opacity: 0;
}

.ai-tags {
    background: rgba(76, 175, 80, 0.9);
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    align-self: flex-start;
    margin-top: 0.5rem;
}

.ai-tags i {
    margin-right: 0.25rem;
}


.image-caption {
    padding: 0.75rem;
    background: #f8f9fa;
    font-size: 0.9rem;
    color: #666;
    border-top: 1px solid #eee;
}

/* Gallery Navigation */
.gallery-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid #eee;
}

.nav-previous,
.nav-next {
    flex: 1;
    max-width: 45%;
}

.nav-next {
    text-align: right;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    transition: background-color 0.3s ease;
}

.nav-link:hover {
    background: #e9ecef;
    text-decoration: none;
    color: #333;
}

.nav-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-label {
    font-size: 0.8rem;
    color: #666;
    text-transform: uppercase;
    font-weight: 600;
}

.nav-title {
    font-weight: 600;
    color: #333;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .gallery-category-header {
        flex-direction: column;
        text-align: center;
        padding: 1rem 0;
    }

    .gallery-category-header .page-title {
        font-size: 2.5rem;
        margin-bottom: 1rem;
    }

    .gallery-filters {
        padding: 1rem;
    }

    .filter-row {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        justify-content: center;
    }

    .search-container {
        min-width: auto;
        max-width: none;
        order: -1;
        width: 100%;
    }

    .filter-container {
        min-width: auto;
    }

    .filter-select {
        min-width: auto;
        width: 100%;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .gallery-controls {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .view-controls {
        justify-content: center;
    }

    .gallery-search {
        min-width: auto;
        max-width: none;
    }

    .gallery-images.view-masonry {
        column-count: 2;
    }

    .gallery-images.columns-3,
    .gallery-images.columns-4,
    .gallery-images.columns-5,
    .gallery-images.columns-6 {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .gallery-meta {
        flex-direction: column;
        gap: 1rem;
    }

    .gallery-navigation {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-previous,
    .nav-next {
        max-width: none;
        text-align: left;
    }

    .action-btn {
        width: 2rem;
        height: 2rem;
    }
}

@media (max-width: 480px) {
    .gallery-images.view-masonry {
        column-count: 1;
    }

    .gallery-images.columns-3,
    .gallery-images.columns-4,
    .gallery-images.columns-5,
    .gallery-images.columns-6 {
        grid-template-columns: 1fr;
    }

    .image-overlay {
        opacity: 1;
        background: rgba(0, 0, 0, 0.5);
    }
}

/* ==========================================================================
   Lightbox Download Button Styles
   ========================================================================== */

.mfp-download-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background-color 0.3s ease;
    margin-left: 1rem;
}

.mfp-download-btn:hover {
    background: var(--secondary);
}

.mfp-download-btn i {
    margin-right: 0.5rem;
}

.mfp-bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.8);
}

.mfp-title {
    flex: 1;
    color: white;
    font-size: 1rem;
}

.mfp-counter {
    color: white;
    margin-right: 1rem;
    font-size: 0.9rem;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {

    .gallery-filters,
    .gallery-controls,
    .load-more-container,
    .gallery-navigation {
        display: none;
    }

    .gallery-card,
    .gallery-image-item {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .image-overlay {
        display: none;
    }
}