/* Gallery Modal Styles */
.gallery-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: none;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.gallery-overlay.open {
    display: flex;
}

.gallery-modal {
    width: min(1400px, 94vw);
    max-height: 90vh;
    overflow: hidden;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    position: relative;
}

.gallery-header {
    padding: 40px 50px 30px;
    border-bottom: 1px solid #d1ccbd;
    position: relative;
}

.gallery-title {
    margin: 0 0 8px;
    font-size: 38px;
    line-height: 43px;
    font-weight: 650;
    color: #2e008b;
    position: relative;
    padding-top: 57px;
}

.gallery-title::before {
    position: absolute;
    content: '';
    width: 100%;
    max-width: 480px;
    height: 10px;
    background: linear-gradient(90deg, #fd683c 0%, #bc17a2 100%);
    top: 0;
    left: 0;
    z-index: 1;
}

.gallery-desc {
    margin: 0;
    color: #457ABE;
    font-size: 18px;
    line-height: 24px;
    font-weight: 360;
}

.gallery-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: #f7f8f9;
    border: 1px solid #d1ccbd;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 2;
}

.gallery-close:hover {
    background: #2e008b;
    border-color: #2e008b;
}

.gallery-close::before,
.gallery-close::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 2px;
    background: #2e008b;
    transition: background 0.2s ease;
}

.gallery-close:hover::before,
.gallery-close:hover::after {
    background: #fff;
}

.gallery-close::before {
    transform: rotate(45deg);
}

.gallery-close::after {
    transform: rotate(-45deg);
}

.gallery-body {
    padding: 30px 50px 40px;
    overflow: auto;
}

/* Filters */
.gallery-filters {
    margin-bottom: 35px;
}

.filter-group {
    margin-bottom: 20px;
}

.filter-group:last-child {
    margin-bottom: 0;
}

/* Desktop: Inline filters */
@media screen and (min-width: 1025px) {
    .gallery-filters {
        display: flex;
        gap: 25px;
        align-items: flex-start;
    }
    
    .filter-group {
        margin-bottom: 0;
        min-width: fit-content;
    }
    
    .filter-group:first-child {
        flex: 0 0 auto;
        min-width: 420px;
    }
    
    .filter-group:nth-child(2) {
        flex: 0 0 auto;
        min-width: 370px;
    }
    
    .filter-group:nth-child(3) {
        flex: 0 0 auto;
        min-width: 370px;
    }
    
    .filter-pills {
        flex-wrap: nowrap;
    }
}

.filter-label {
    display: block;
    font-size: 14px;
    font-weight: 650;
    color: #2e008b;
    margin-bottom: 8px;
    text-transform: uppercase;
    white-space: nowrap;
}

.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border: 2px solid #d1ccbd;
    border-radius: 25px;
    background: #fff;
    color: #2e008b;
    font-size: 15px;
    font-weight: 360;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    white-space: nowrap;
}

.filter-pill:hover {
    border-color: #bc17a2;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.filter-pill.active {
    background: linear-gradient(90deg, #bc17a2 0%, #fd683c 100%);
    border-color: #bc17a2;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(188, 23, 162, 0.3);
}

/* Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

@media (min-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.gallery-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #d1ccbd;
    background: #f7f8f9;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    animation: cardFadeIn 0.25s ease-out backwards;
}

.gallery-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

.gallery-card.hidden {
    display: none;
}

/* Staggered animation for cards */
.gallery-card:nth-child(1) { animation-delay: 0s; }
.gallery-card:nth-child(2) { animation-delay: 0.02s; }
.gallery-card:nth-child(3) { animation-delay: 0.04s; }
.gallery-card:nth-child(4) { animation-delay: 0.06s; }
.gallery-card:nth-child(5) { animation-delay: 0.08s; }
.gallery-card:nth-child(6) { animation-delay: 0.1s; }
.gallery-card:nth-child(7) { animation-delay: 0.12s; }
.gallery-card:nth-child(8) { animation-delay: 0.14s; }
.gallery-card:nth-child(9) { animation-delay: 0.16s; }
.gallery-card:nth-child(10) { animation-delay: 0.18s; }
.gallery-card:nth-child(11) { animation-delay: 0.2s; }
.gallery-card:nth-child(12) { animation-delay: 0.22s; }

@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.gallery-thumb {
    width: 100%;
    height: 200px;
    object-fit: contain;
    display: block;
    background: #fff;
    padding: 15px;
}

.gallery-caption {
    padding: 12px 15px;
    font-size: 13px;
    color: #2e008b;
    background: #f7f8f9;
    border-top: 1px solid #d1ccbd;
    word-break: break-all;
    line-height: 1.4;
}

/* Download icon on card */
.download-icon {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #d1ccbd;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 20px 20px;
    opacity: 0;
    transition: opacity 0.2s ease;
    cursor: pointer;
    z-index: 10;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%232e008b"><path d="M12 3a1 1 0 0 1 1 1v9.586l3.293-3.293a1 1 0 1 1 1.414 1.414l-5 5a1 1 0 0 1-1.414 0l-5-5A1 1 0 0 1 7.707 10.293L11 13.586V4a1 1 0 0 1 1-1Z"/><path d="M5 20a1 1 0 0 1 1-1h12a1 1 0 1 1 0 2H6a1 1 0 0 1-1-1Z"/></svg>');
}

.gallery-card:hover .download-icon {
    opacity: 1;
}

.download-icon:hover {
    background-color: #f7f8f9;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

/* Footer / actions */
.gallery-actions {
    padding: 25px 50px;
    border-top: 1px solid #d1ccbd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f7f8f9;
}

.gallery-count {
    font-size: 16px;
    color: #457ABE;
    font-weight: 360;
}

.gallery-download-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
}

.gallery-file-size {
    font-size: 14px;
    color: #457ABE;
    font-weight: 360;
    white-space: nowrap;
}

.gallery-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 15px 35px;
    border-radius: 12px;
    border: none;
    background: #2e008b;
    color: #fff;
    text-decoration: none;
    font-weight: 650;
    font-size: 18px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 8px 26px rgba(46, 0, 139, 0.3);
}

.gallery-download-btn:hover {
    background: #457ABE;
    box-shadow: 0 12px 32px rgba(46, 0, 139, 0.4);
    transform: translateY(-2px);
}

.gallery-download-btn svg {
    width: 20px;
    height: 20px;
}

/* No results message */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #457ABE;
    font-size: 18px;
    display: none;
}

.no-results.show {
    display: block;
}

/* Scroll lock */
body.gallery-lock {
    overflow: hidden;
}

/* Responsive */
@media screen and (max-width: 1024px) {
    .gallery-header {
        padding: 30px 25px 20px;
    }
    
    .gallery-title {
        font-size: 32px;
        line-height: 38px;
        padding-top: 47px;
    }
    
    .gallery-title::before {
        height: 8px;
        max-width: 70%;
    }
    
    .gallery-body {
        padding: 25px 25px 30px;
    }
    
    .gallery-actions {
        padding: 20px 25px;
        flex-direction: column;
        gap: 15px;
    }
    
    .gallery-count {
        order: 2;
    }
    
    .gallery-download-wrapper {
        order: 1;
        flex-direction: column;
        gap: 8px;
    }
    
    .gallery-download-btn {
        width: 100%;
        justify-content: center;
    }
}

@media screen and (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .gallery-thumb {
        height: 150px;
    }
    
    .filter-pills {
        gap: 8px;
    }
    
    .filter-pill {
        padding: 8px 16px;
        font-size: 14px;
    }
}

@media screen and (max-width: 480px) {
    .gallery-modal {
        width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .gallery-title {
        font-size: 28px;
        line-height: 34px;
    }
    
    .gallery-grid {
        grid-template-columns: 1fr;
    }
}