/* Gallery Section */
.gallery {
    background-color: var(--light);
    padding: 100px 0;
}

/* Gallery Grid Styles */
.gallery-grid-container {
    position: relative;
    padding: 20px 0;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin: 0 auto;
    max-width: 1200px;
}

.gallery-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.gallery-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.12);
}

.gallery-image {
    position: relative;
    overflow: hidden;
    height: 140px; /* Even smaller image height for compact layout */
    flex-shrink: 0;
}

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

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

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(15, 117, 188, 0.9), rgba(38, 170, 225, 0.8));
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 15px;
    text-align: center;
}

.gallery-card:hover .gallery-overlay {
    opacity: 1;
}

.gallery-content h3 {
    color: white;
    font-size: 1.3rem;
    margin-bottom: 8px;
    font-weight: 600;
}

.gallery-content p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.gallery-date {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    border-radius: 12px;
    display: inline-block;
}

.gallery-icon {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.gallery-info {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.gallery-category {
    display: inline-block;
    background: var(--light);
    color: var(--primary);
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 12px;
    align-self: flex-start;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.gallery-info h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: var(--dark);
    font-weight: 600;
}

.gallery-description {
    color: var(--text-light);
    line-height: 1.5;
    font-size: 0.9rem;
    text-align: justify;
}

/* Pagination Styles */
.gallery-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 40px;
    gap: 10px;
}

.pagination-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--secondary);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(15, 117, 188, 0.3);
}

.pagination-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.page-numbers {
    display: flex;
    gap: 8px;
    margin: 0 15px;
}

.page-number {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: white;
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.page-number:hover {
    border-color: var(--primary);
    transform: scale(1.1);
}

.page-number.active {
    background: var(--gradient);
    color: white;
    border-color: var(--primary);
}

.page-info {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-left: 15px;
    font-weight: 500;
}

/* Gallery Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
}

.gallery-modal-content {
    max-width: 90vw;
    max-height: 90vh;
    background: white;
    border-radius: 15px;
    overflow: hidden;
    position: relative;
    margin: 20px;
    display: flex;
    flex-direction: column;
}

.modal-header {
    background: var(--primary);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-gallery-modal {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.close-gallery-modal:hover {
    background: rgba(255, 255, 255, 0.2);
}

.gallery-navigation {
    display: flex;
    align-items: center;
    gap: 20px;
}

.gallery-nav-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.gallery-nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

#galleryCounter {
    font-weight: 600;
    font-size: 1.1rem;
}

.modal-body {
    display: flex;
    flex-direction: column;
    max-height: calc(90vh - 80px);
}

.gallery-modal-image {
    flex: 1;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-height: 400px;
}

.gallery-modal-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.gallery-modal-info {
    padding: 25px;
    background: white;
    border-top: 1px solid #eee;
}

.gallery-modal-info h4 {
    font-size: 1.6rem;
    color: var(--dark);
    margin-bottom: 15px;
    font-weight: 600;
}

.gallery-modal-info p {
    color: var(--text-light);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 15px;
    text-align: justify;
}

.gallery-modal-info .gallery-date {
    background: var(--primary);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    display: inline-block;
    font-weight: 500;
    width: fit-content;
}

/* Responsive Design */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .gallery-image {
        height: 160px;
    }
    
    .gallery-pagination {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .page-numbers {
        margin: 0 10px;
    }
    
    .page-number {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
    
    .modal-body {
        flex-direction: column;
    }
    
    .gallery-modal-image {
        min-height: 300px;
    }
    
    .modal-header {
        padding: 15px 20px;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .gallery-modal-info {
        padding: 20px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .gallery-image {
        height: 200px;
    }
}

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