/* =========================================================================
   Photo Gallery Page Styles - R. G. Shah Science College
   Colors: Primary #0F2A4C | Secondary #D6AD60 | Cream #F7F3EA | Text #344054 | Highlight #3987C9
   ========================================================================= */

.photo-gallery-main-wrap {
    background-color: var(--white, #FFFFFF);
    padding-top: 120px;
    padding-bottom: 120px;
}

/* =========================================================================
   Gallery Overview Filter Bar
   ========================================================================= */
.gallery-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 35px;
    padding-bottom: 20px;
    border-bottom: 1px solid #ECE7DB;
}

.gallery-filter-pills {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.gallery-filter-pill {
    display: inline-flex;
    align-items: center;
    padding: 7px 18px;
    border-radius: 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color, #0F2A4C);
    background-color: #F7F3EA;
    border: 1px solid #ECE7DB;
    text-decoration: none;
    transition: all 0.25s ease;
}

.gallery-filter-pill:hover {
    background-color: var(--primary-color, #0F2A4C);
    color: var(--white, #FFFFFF);
    border-color: var(--primary-color, #0F2A4C);
}

.gallery-filter-pill.active {
    background-color: var(--primary-color, #0F2A4C);
    color: var(--secondary-color, #D6AD60);
    border-color: var(--primary-color, #0F2A4C);
    box-shadow: 0 4px 12px rgba(15, 42, 76, 0.15);
}

.gallery-count-info {
    font-size: 14px;
    color: var(--body-text, #344054);
    font-weight: 500;
}

.gallery-count-info strong {
    color: var(--primary-color, #0F2A4C);
}

/* =========================================================================
   Gallery Cards (Listing Mode)
   ========================================================================= */
.gallery-card {
    background-color: var(--white, #FFFFFF);
    border: 1px solid #ECE7DB;
    border-radius: 16px 0;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(15, 42, 76, 0.05);
    transition: all 0.35s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.gallery-card:hover {
    border-color: var(--secondary-color, #D6AD60);
    transform: translateY(-4px);
    box-shadow: 0 14px 35px rgba(15, 42, 76, 0.1);
}

.gallery-card-thumb-wrap {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 10;
    background-color: #0F2A4C;
    display: block;
}

.gallery-card-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.45s ease;
}

.gallery-card:hover .gallery-card-thumb {
    transform: scale(1.06);
}

.gallery-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(15, 42, 76, 0.1) 0%, rgba(15, 42, 76, 0.55) 100%);
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

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

.gallery-card-count-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(15, 42, 76, 0.88);
    backdrop-filter: blur(4px);
    color: var(--secondary-color, #D6AD60);
    border: 1px solid rgba(214, 173, 96, 0.4);
    border-radius: 6px 0;
    padding: 4px 11px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.gallery-card-body {
    padding: 22px 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.gallery-card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color, #0F2A4C);
    margin: 0 0 10px 0;
    line-height: 1.35;
}

.gallery-card-title a {
    color: var(--primary-color, #0F2A4C);
    text-decoration: none;
    transition: color 0.25s ease;
}

.gallery-card-title a:hover,
.gallery-card-title a:focus {
    color: var(--accent-highlight, #3987C9);
}

.gallery-card-desc {
    font-size: 14px;
    line-height: 1.65;
    color: var(--body-text, #344054);
    margin-bottom: 18px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.gallery-card-footer {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid #F0ECE1;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gallery-card-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary-color, #0F2A4C);
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.25s ease;
}

.gallery-card-btn i {
    color: var(--secondary-color, #D6AD60);
    transition: transform 0.25s ease;
}

.gallery-card-btn:hover {
    color: var(--accent-highlight, #3987C9);
}

.gallery-card-btn:hover i {
    transform: translateX(4px);
    color: var(--accent-highlight, #3987C9);
}

/* =========================================================================
   Single Gallery Header Banner
   ========================================================================= */
.gallery-detail-header {
    background-color: #F7F3EA;
    border: 1px solid #ECE7DB;
    border-left: 4px solid var(--secondary-color, #D6AD60);
    border-radius: 16px 0;
    padding: 28px 32px;
    margin-bottom: 35px;
    box-shadow: 0 4px 18px rgba(15, 42, 76, 0.04);
}

.gallery-detail-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.gallery-detail-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background-color: var(--white, #FFFFFF);
    color: var(--primary-color, #0F2A4C);
    border: 1px solid #ECE7DB;
    border-radius: 8px 0;
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.25s ease;
}

.gallery-detail-back-btn:hover {
    background-color: var(--primary-color, #0F2A4C);
    color: var(--white, #FFFFFF);
    border-color: var(--primary-color, #0F2A4C);
}

.gallery-detail-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: var(--white, #FFFFFF);
    color: var(--primary-color, #0F2A4C);
    border: 1px solid rgba(15, 42, 76, 0.15);
    border-radius: 6px 0;
    padding: 4px 12px;
    font-size: 12.5px;
    font-weight: 700;
}

.gallery-detail-badge i {
    color: var(--secondary-color, #D6AD60);
}

.gallery-detail-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--primary-color, #0F2A4C);
    margin: 0 0 10px 0;
    line-height: 1.35;
}

.gallery-detail-desc {
    font-size: 15px;
    line-height: 1.75;
    color: var(--body-text, #344054);
    margin: 0;
}

/* =========================================================================
   Photo Items Grid
   ========================================================================= */
.photo-gallery-grid {
    margin-top: 10px;
}

.photo-item-card {
    background-color: #F7F3EA;
    border: 1px solid #ECE7DB;
    border-radius: 14px 0;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(15, 42, 76, 0.05);
    transition: all 0.35s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.photo-item-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(15, 42, 76, 0.1);
    border-color: rgba(214, 173, 96, 0.5);
}

.photo-item-link {
    display: block;
    position: relative;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background-color: #0F2A4C;
    cursor: pointer;
}

.photo-item-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.4s ease;
}

.photo-item-card:hover .photo-item-img {
    transform: scale(1.06);
}

.photo-item-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(15, 42, 76, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.photo-item-card:hover .photo-item-overlay {
    opacity: 1;
}

.photo-item-zoom-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background-color: var(--secondary-color, #D6AD60);
    color: var(--primary-color, #0F2A4C);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    pointer-events: none;
}

.photo-item-caption {
    padding: 10px 14px;
    background-color: var(--white, #FFFFFF);
    text-align: center;
    border-top: 1px solid #ECE7DB;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-item-caption-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--primary-color, #0F2A4C);
    margin: 0;
    line-height: 1.35;
}

/* =========================================================================
   Empty States
   ========================================================================= */
.gallery-empty-card {
    background-color: var(--white, #FFFFFF);
    border-radius: 16px 0;
    border: 1px solid #ECE7DB;
    padding: 50px 30px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(15, 42, 76, 0.05);
    max-width: 580px;
    margin: 30px auto;
}

.gallery-empty-icon {
    font-size: 48px;
    color: var(--secondary-color, #D6AD60);
    margin-bottom: 16px;
    display: inline-block;
}

.gallery-empty-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary-color, #0F2A4C);
    margin-bottom: 8px;
}

.gallery-empty-desc {
    font-size: 15px;
    color: var(--body-text, #344054);
    line-height: 1.65;
    margin-bottom: 22px;
}

/* =========================================================================
   Responsive Adjustments
   ========================================================================= */
@media (max-width: 991px) {
    .photo-gallery-main-wrap {
        padding-top: 40px;
        padding-bottom: 60px;
    }

    .gallery-detail-header {
        padding: 22px 24px;
    }

    .gallery-detail-title {
        font-size: 23px;
    }
}

@media (max-width: 767px) {
    .photo-gallery-main-wrap {
        padding-top: 30px;
        padding-bottom: 45px;
    }

    .gallery-filter-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .gallery-card-body {
        padding: 16px 18px;
    }

    .gallery-card-title {
        font-size: 16.5px;
    }

    .gallery-detail-header {
        padding: 18px 16px;
        border-radius: 12px 0;
    }

    .gallery-detail-title {
        font-size: 20px;
    }
}

/* =========================================================================
   Photo Gallery Lightbox / Magnific Popup Premium Theme Styling
   ========================================================================= */
.mfp-bg.custom-gallery-mfp {
    z-index: 99999 !important;
    background: #081526;
    opacity: 0.92;
}

.mfp-wrap.custom-gallery-mfp {
    z-index: 100000 !important;
}

.custom-gallery-mfp .mfp-container {
    padding: 0 16px;
}

.custom-gallery-mfp .mfp-content {
    z-index: 100001 !important;
    max-width: 90vw;
}

.custom-gallery-mfp img.mfp-img {
    max-height: calc(100vh - 120px) !important;
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
    border-radius: 8px 0;
    border: 1px solid rgba(214, 173, 96, 0.35);
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.7);
    padding: 35px 0 35px;
    margin: 0 auto;
}

.custom-gallery-mfp .mfp-figure:after {
    box-shadow: none;
    background: transparent;
}

/* Clearly visible close button with high contrast */
.custom-gallery-mfp .mfp-close {
    width: 44px;
    height: 44px;
    line-height: 42px;
    position: fixed;
    right: 20px;
    top: 20px;
    background-color: var(--secondary-color, #D6AD60);
    color: var(--primary-color, #0F2A4C);
    border-radius: 50%;
    font-size: 26px;
    font-weight: 700;
    opacity: 0.95;
    text-align: center;
    padding: 0;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    z-index: 100005 !important;
    border: 2px solid #FFFFFF;
}

.custom-gallery-mfp .mfp-close:hover,
.custom-gallery-mfp .mfp-close:focus {
    opacity: 1;
    transform: scale(1.1);
    background-color: #FFFFFF;
    color: var(--primary-color, #0F2A4C);
    outline: 2px solid var(--secondary-color, #D6AD60);
}

/* Gallery Navigation Arrows */
.custom-gallery-mfp .mfp-arrow {
    width: 50px;
    height: 60px;
    margin-top: -30px;
    opacity: 0.85;
    transition: all 0.25s ease;
    z-index: 100004 !important;
}

.custom-gallery-mfp .mfp-arrow:hover,
.custom-gallery-mfp .mfp-arrow:focus {
    opacity: 1;
    transform: scale(1.1);
}

.custom-gallery-mfp .mfp-arrow-left {
    left: 15px;
}

.custom-gallery-mfp .mfp-arrow-right {
    right: 15px;
}

.custom-gallery-mfp .mfp-arrow-left:after {
    border-right: 17px solid var(--secondary-color, #D6AD60);
}

.custom-gallery-mfp .mfp-arrow-left:before {
    border-right: 27px solid rgba(15, 42, 76, 0.8);
}

.custom-gallery-mfp .mfp-arrow-right:after {
    border-left: 17px solid var(--secondary-color, #D6AD60);
}

.custom-gallery-mfp .mfp-arrow-right:before {
    border-left: 27px solid rgba(15, 42, 76, 0.8);
}

/* Bottom Bar: Caption Title and Counter */
.custom-gallery-mfp .mfp-bottom-bar {
    margin-top: -28px;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    box-sizing: border-box;
    background: rgba(15, 42, 76, 0.85);
    border-radius: 0 0 6px 0;
    backdrop-filter: blur(4px);
}

.custom-gallery-mfp .mfp-title {
    font-size: 14.5px;
    font-weight: 600;
    color: #FFFFFF;
    line-height: 1.4;
    padding-right: 20px;
}

.custom-gallery-mfp .mfp-counter {
    position: static;
    color: var(--secondary-color, #D6AD60);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    margin-left: auto;
}

/* Smooth Fade Transitions */
.mfp-fade.mfp-bg {
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.mfp-fade.mfp-bg.mfp-ready {
    opacity: 0.92;
}

.mfp-fade.mfp-bg.mfp-removing {
    opacity: 0;
}

.mfp-fade.mfp-wrap .mfp-content {
    opacity: 0;
    transform: scale(0.96);
    transition: all 0.3s ease-out;
}

.mfp-fade.mfp-wrap.mfp-ready .mfp-content {
    opacity: 1;
    transform: scale(1);
}

.mfp-fade.mfp-wrap.mfp-removing .mfp-content {
    opacity: 0;
    transform: scale(0.96);
}

/* Missing/Invalid Image Graceful Error State */
.custom-gallery-mfp .mfp-custom-error {
    background-color: #FFFFFF;
    color: #D32F2F;
    padding: 24px 30px;
    border-radius: 12px 0;
    border: 1px solid #FFCDD2;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    font-size: 15px;
    font-weight: 600;
    text-align: center;
}

.custom-gallery-mfp .mfp-custom-error i {
    font-size: 24px;
    display: block;
    margin-bottom: 8px;
    color: #D32F2F;
}

/* Mobile Responsive Adjustments */
@media (max-width: 767px) {
    .custom-gallery-mfp .mfp-close {
        right: 12px;
        top: 12px;
        width: 38px;
        height: 38px;
        line-height: 36px;
        font-size: 20px;
    }

    .custom-gallery-mfp img.mfp-img {
        padding: 20px 0 20px;
        max-height: calc(100vh - 80px) !important;
    }

    .custom-gallery-mfp .mfp-arrow {
        width: 36px;
        height: 48px;
        margin-top: -24px;
    }

    .custom-gallery-mfp .mfp-arrow-left {
        left: 5px;
    }

    .custom-gallery-mfp .mfp-arrow-right {
        right: 5px;
    }

    .custom-gallery-mfp .mfp-bottom-bar {
        padding: 6px 10px;
    }

    .custom-gallery-mfp .mfp-title {
        font-size: 13px;
    }

    .custom-gallery-mfp .mfp-counter {
        font-size: 12px;
    }
}
