/* Professional Gallery Styles */
.gallery-area {
    padding: 80px 0;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    position: relative;
}

.gallery-area::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="%23000" opacity="0.02"/><circle cx="75" cy="75" r="1" fill="%23000" opacity="0.02"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
}

.section-title {
    margin-bottom: 60px;
}

.section-main-title h2 {
    font-size: 3.5rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 20px;
    letter-spacing: -0.02em;
}

.section-main-title p {
    font-size: 1.25rem;
    color: #64748b;
    margin-bottom: 30px;
    font-weight: 400;
}

.title-underline {
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    margin: 0 auto;
    border-radius: 2px;
}

/* Filter Tabs */
.gallery-filter-tabs {
    margin-bottom: 50px;
    text-align: center;
}

.filter-tabs {
    display: inline-flex;
    background: white;
    border-radius: 50px;
    padding: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    list-style: none;
    margin: 0;
    gap: 5px;
}

.filter-tabs li {
    padding: 12px 24px;
    cursor: pointer;
    border-radius: 40px;
    font-weight: 500;
    color: #64748b;
    transition: all 0.3s ease;
    position: relative;
}

.filter-tabs li:hover,
.filter-tabs li.active {
    color: white;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}

/* Gallery Grid */
.gallery-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
}

.gallery-item {
    flex: 0 0 calc(33.333% - 20px);
    margin-bottom: 30px;
}

@media (max-width: 992px) {
    .gallery-item {
        flex: 0 0 calc(50% - 15px);
    }
}

@media (max-width: 768px) {
    .gallery-item {
        flex: 0 0 100%;
    }
}

/* Gallery Card */
.gallery-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    cursor: pointer;
}

.gallery-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.gallery-image-container {
    position: relative;
    overflow: hidden;
    height: 280px;
}

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

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

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(59, 130, 246, 0.9),
        rgba(139, 92, 246, 0.9)
    );
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.gallery-overlay-content {
    text-align: center;
    color: white;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.gallery-card:hover .gallery-overlay-content {
    transform: translateY(0);
}

.image-count {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}

.view-gallery-btn {
    background: white;
    color: #3b82f6;
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.view-gallery-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 255, 255, 0.3);
}

/* Gallery Content */
.gallery-content {
    padding: 25px;
}

.gallery-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 13px;
    color: #64748b;
}

.gallery-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.gallery-title h4 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 10px;
    line-height: 1.3;
}

.gallery-description {
    color: #64748b;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.gallery-actions {
    display: flex;
    gap: 12px;
}

.btn-primary {
    flex: 1;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: #f1f5f9;
    color: #64748b;
    border: none;
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-secondary:hover {
    background: #e2e8f0;
    color: #3b82f6;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #64748b;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #1a202c;
}

/* Gallery Modal */
.gallery-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    backdrop-filter: blur(10px);
}

.gallery-modal.active {
    display: flex;
    flex-direction: column;
    animation: modalFadeIn 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: rgba(0, 0, 0, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    height: 80px;
    flex-shrink: 0;
}

.modal-title h3 {
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.modal-title span {
    color: #94a3b8;
    font-size: 14px;
}

.modal-controls {
    display: flex;
    gap: 10px;
}

.control-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.close-btn:hover {
    background: rgba(239, 68, 68, 0.8);
}

.modal-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 20px;
    height: calc(
        100vh - 200px
    ); /* Fixed height: viewport minus header and footer */
    overflow: hidden;
}

.main-image-container {
    width: 100%;
    height: 100%; /* Take full height of modal body */
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

#mainImage {
    max-width: 100%;
    max-height: 100%; /* Constrain to container height */
    width: auto;
    height: auto;
    object-fit: contain; /* Maintain aspect ratio */
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease;
}

/* Alternative: If you want a truly fixed height for all images */
.main-image-container.fixed-height #mainImage {
    height: 70vh; /* Fixed height: 70% of viewport height */
    width: auto;
    max-width: 90vw; /* Don't exceed 90% of viewport width */
    object-fit: contain;
}

.image-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    backdrop-filter: blur(10px);
    z-index: 10;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.prev-btn {
    left: 30px;
}

.next-btn {
    right: 30px;
}

.modal-footer {
    padding: 20px 30px;
    background: rgba(0, 0, 0, 0.8);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    height: 120px; /* Fixed footer height */
    flex-shrink: 0;
}

.thumbnail-strip {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 10px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
    height: 80px; /* Fixed thumbnail strip height */
}

.thumbnail-strip::-webkit-scrollbar {
    height: 6px;
}

.thumbnail-strip::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.thumbnail-strip::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.thumbnail-item {
    flex-shrink: 0;
    width: 80px;
    height: 60px; /* Fixed thumbnail height */
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

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

.thumbnail-item.active {
    border-color: #3b82f6;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Cover for thumbnails to maintain consistent size */
}

/* Animation Classes */
.fadeInUp {
    animation: fadeInUp 0.6s ease forwards;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .section-main-title h2 {
        font-size: 2.5rem;
    }

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

    .filter-tabs li {
        padding: 10px 16px;
        font-size: 14px;
    }

    .modal-header {
        padding: 15px 20px;
        height: 70px;
    }

    .modal-body {
        padding: 10px;
        height: calc(100vh - 170px); /* Adjusted for mobile */
    }

    .nav-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .prev-btn {
        left: 15px;
    }

    .next-btn {
        right: 15px;
    }

    .modal-footer {
        height: 100px;
    }

    .thumbnail-strip {
        height: 60px;
    }

    .thumbnail-item {
        width: 60px;
        height: 45px;
    }

    /* Mobile: Use fixed height for better consistency */
    #mainImage {
        height: 60vh !important;
        width: auto;
        max-width: 95vw;
    }
}

/* Optional: Force fixed height mode */
.gallery-modal.fixed-height .main-image-container {
    height: 70vh;
}

.gallery-modal.fixed-height #mainImage {
    height: 100%;
    width: auto;
    max-width: 90vw;
    object-fit: contain;
}
