/* ========================================
   UNIVERSITY PHOTO COLLAGE SECTION
   ======================================== */

.university-collage-section {
    background: #D5A832;
    border-top-left-radius: 100px;
    border-top-right-radius: 100px;
    margin: 15px 0 0;
    padding: 20px;
}

.university-collage-container {
    background: transparent;
    border: 1px solid #FFFFFF;
    border-radius: 100px;
    padding: 60px 40px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

/* Main Title */
.university-collage-title {
    font-family: 'Marcellus', sans-serif;
    font-weight: 400;
    font-size: 28px;
    line-height: 100%;
    text-align: center;
    color: #FFFFFF;
    margin: 0;
    text-shadow: 1.4px 1.4px 0px #00000080;
}

/* Description Text */
.university-collage-description {
    font-family: 'Marcellus', sans-serif;
    font-weight: 400;
    font-size: 24px;
    line-height: 1;
    text-align: center;
    color: #FFFFFF;
    margin: 0;
    max-width: 800px;
    padding: 0 100px;
}

/* Dropdown Wrapper */
.university-dropdown-wrapper {
    width: 100%;
    max-width: 700px;
    position: relative;
}

/* Dropdown Styling */
.university-dropdown {
    width: 100%;
    padding: 15px 45px 15px 20px;
    background: #FFFFFF;
    border: none;
    border-radius: 24px;
    font-family: 'Marcellus', sans-serif;
    font-weight: 500;
    font-size: 24px;
    color: rgba(0, 0, 0, 1);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.university-dropdown:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    transform: translateY(-2px);
}

.university-dropdown:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5);
}

/* Custom Dropdown Arrow */
.university-dropdown-wrapper::after {
    content: '▼';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #2E398C;
    pointer-events: none;
    font-size: 14px;
}

/* ========================================
   MASONRY PHOTO COLLAGE GRID
   ======================================== */

.university-collage-grid {
    width: 100%;
    max-width: 920px;
    margin: 20px auto 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 180px;
    grid-auto-flow: dense; /* CRITICAL: Auto-fills empty spaces */
    gap: 6px; /* Reduced gap for tighter layout */
    padding: 0;
    background: transparent;
    border-radius: 24px;
    padding: 10px; /* Reduced padding */
    /* box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); */
    
    /* FIXED HEIGHT WITH SCROLL */
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
    
    /* Smooth scrolling */
    scroll-behavior: smooth;
    
    position: relative;
}

/* Custom Scrollbar Styling */
.university-collage-grid::-webkit-scrollbar {
    width: 8px;
}

.university-collage-grid::-webkit-scrollbar-track {
    background: rgba(213, 168, 50, 0.1);
    border-radius: 10px;
    margin: 10px 0;
}

.university-collage-grid::-webkit-scrollbar-thumb {
    background: #D5A832;
    border-radius: 10px;
}

.university-collage-grid::-webkit-scrollbar-thumb:hover {
    background: #C49A30;
}

/* Firefox Scrollbar */
.university-collage-grid {
    scrollbar-width: thin;
    scrollbar-color: #FFFFFF rgba(255, 255, 255, 0.3);
}

/* Photo Items */
.collage-photo {
    position: relative;
    overflow: hidden;
    border-radius: 8px; /* Reduced border radius for tighter look */
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    opacity: 0;
    animation: fadeInPhoto 0.5s ease forwards;
}

@keyframes fadeInPhoto {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.collage-photo:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.collage-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Masonry spans are assigned via inline styles in JS (university-collage.js)
   based on array index — not nth-child — so removing items never shifts spans. */
.collage-photo {
    grid-column: span 1;
    grid-row: span 1;
}

/* ========================================
   LIGHTBOX MODAL FOR PHOTO EXPANSION
   ======================================== */

.collage-lightbox {
    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;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: zoom-out;
}

.collage-lightbox.active {
    display: flex;
    opacity: 1;
}

.collage-lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.collage-lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    cursor: default;
}

/* Close Button */
.collage-lightbox-close {
    position: absolute;
    top: -50px;
    right: 0;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #2E398C;
    transition: all 0.3s ease;
    z-index: 10000;
}

.collage-lightbox-close:hover {
    background: #FFFFFF;
    transform: rotate(90deg) scale(1.1);
}

.collage-lightbox-close::before {
    content: '×';
    font-weight: 300;
    line-height: 1;
}

/* Navigation Arrows (Optional) */
.collage-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

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

.collage-lightbox-prev {
    left: 20px;
}

.collage-lightbox-next {
    right: 20px;
}

/* Mobile Lightbox Adjustments */
@media (max-width: 768px) {
    .collage-lightbox-close {
        /* top: -17%; */
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
    
    .collage-lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .collage-lightbox-prev {
        left: 10px;
    }
    
    .collage-lightbox-next {
        right: 10px;
    }
    
    .collage-lightbox-content {
        max-width: 95%;
        max-height: 85%;
    }
}

/* Loading State */
.collage-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    color: #D5A832;
}

.collage-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(213, 168, 50, 0.2);
    border-top-color: #D5A832;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.collage-loading p {
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    font-weight: 500;
    margin: 0;
}

/* Hide loading when photos loaded */
.university-collage-grid.loaded .collage-loading {
    display: none;
}

/* Empty State */
.collage-empty {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #D5A832;
}

.collage-empty p {
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    margin: 0;
}

/* ========================================
   RESPONSIVE STYLES
   ======================================== */

/* Tablet - 768px */
@media (max-width: 768px) {
    .university-collage-section {
        margin: 20px 0 0;
        border-radius: 60px;
        padding: 15px;
    }
    
    .university-collage-container {
        border-radius: 50px;
        padding: 40px 20px;
        gap: 25px;
    }
    
    .university-collage-title {
        font-size: 24px;
        text-align: center;
    }
    
    .university-collage-description {
        text-align: center;
        font-size: 16px;
        padding: 0 10px 0 0;
        line-height: 24px;
    }
    
    .university-dropdown {
        font-size: 16px;
        padding: 12px 40px 12px 15px;
        border-radius: 24px;
    }
    
    .university-dropdown-wrapper::after {
        right: 15px;
        font-size: 12px;
    }
    
    /* 3 columns on tablet */
    .university-collage-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-auto-rows: 150px;
        grid-auto-flow: dense; /* Fill gaps */
        gap: 5px;
        padding: 8px;
        max-height: 500px; /* Fixed height for tablet */
    }
    
    /* Spans handled by JS inline styles */
}

/* Mobile - 400px */
@media (max-width: 400px) {
    .university-collage-container {
        padding: 30px 15px;
        gap: 20px;
    }
    
    .university-collage-title {
        font-size: 24px;
    }
    
    .university-collage-description {
        font-size: 16px;
    }
    
    .university-dropdown {
        font-size: 13px;
        padding: 10px 35px 10px 12px;
    }
    
    /* 2 columns on mobile */
    .university-collage-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 130px;
        grid-auto-flow: dense; /* Fill gaps */
        gap: 4px;
        padding: 6px;
        max-height: 450px; /* Fixed height for mobile */
    }
    
    /* Spans handled by JS inline styles */
}

/* Mobile - 360px */
@media (max-width: 360px) {
    .university-collage-title {
        font-size: 18px;
    }
    
    .university-collage-description {
        font-size: 16px;
    }
    
    .university-dropdown {
        font-size: 12px;
    }
    
    .university-collage-grid {
        grid-auto-rows: 120px;
        gap: 3px;
        max-height: 400px; /* Fixed height for small mobile */
    }
}

/* Transition Effects */
.university-collage-grid.transitioning {
    opacity: 0.3;
    pointer-events: none;
}

.university-collage-grid.loaded {
    opacity: 1;
    transition: opacity 0.4s ease;
}