/* ============================================
   GALLERY STYLES
   ============================================ */

:root {
    --gallery-spacing: 2rem;
    --photo-gap: 1rem;
    --collection-margin: 3rem;
}

/* Gallery Wrapper */
.gallery-wrapper {
    padding: 2rem 0;
}

/* Loading Spinner */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    gap: 1rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(25, 118, 210, 0.1);
    border-top-color: #1976D2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #9E9E9E;
    border: solid 3px #9E9E9E;
    border-radius: 16px;
    display: none; /* Extracted from inline style */
}

.empty-state svg {
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.empty-state h3 {
    color: #666;
    margin-bottom: 0.5rem;
}

.empty-state p {
    text-align: center;
}

.cta-buttons-container { /* New class for the div */
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Collection Container */
.gallery-collection {
    margin-bottom: var(--collection-margin);
    padding: 2rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease;
}

.gallery-collection:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* Collection Header */
.collection-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e8f0fe;
}

.collection-title {
    margin-top: 0;
    font-size: 1.8rem;
    color: #212121;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.collection-date {
    display: inline-block;
    font-size: 0.9rem;
    color: #696969;
    margin-bottom: 0.8rem;
    padding: 0.3rem 0.8rem;
    background: #f5f5f5;
    border-radius: 10px;
}

.collection-description {
    font-size: 1.1rem;
    color: #666;
    line-height: 1.6;
    margin: 0;
}


/* Photo Grid - Facebook-style Layout */
.photo-grid {
    display: grid;
    gap: 4px;
    margin-top: 1.5rem;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 200px;
    border-radius: 8px;
    overflow: hidden;
}

/* Dynamic grid layouts based on photo count */
.photo-grid[data-photo-count="1"] {
    grid-template-columns: 1fr;
    grid-auto-rows: 450px;
}

.photo-grid[data-photo-count="2"] {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 350px;
}

.photo-grid[data-photo-count="3"] .photo-item:first-child {
    grid-column: span 2;
    grid-row: span 2;
}

.photo-grid[data-photo-count="4"] .photo-item:first-child,
.photo-grid[data-photo-count="5"] .photo-item:first-child,
.photo-grid[data-photo-count="6"] .photo-item:first-child,
.photo-grid[data-photo-count="7"] .photo-item:first-child,
.photo-grid[data-photo-count="8"] .photo-item:first-child {
    grid-column: span 2;
    grid-row: span 2;
}

/* Photo Item */
.photo-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    background: #e0e0e0;
    transition: all 0.2s ease;
}

.photo-item:hover {
    opacity: 0.92;
}

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

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

/* See All Overlay (shown on last visible photo when there are more) */
.photo-item.see-all-overlay {
    position: relative;
}

.photo-item.see-all-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 1;
    transition: background 0.3s ease;
}

.photo-item.see-all-overlay:hover::before {
    background: rgba(0, 0, 0, 0.75);
}

.photo-item.see-all-overlay::after {
    content: '+' attr(data-remaining);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 3rem;
    font-weight: 700;
    z-index: 2;
    text-shadow: 0 2px 15px rgba(0, 0, 0, 0.8);
    letter-spacing: 2px;
}

/* Hidden photos */
.photo-item.hidden {
    display: none;
}

/* Photo Overlay for captions */
.photo-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.3) 60%, transparent 100%);
    padding: 0.8rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

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

.photo-caption {
    color: white;
    font-size: 0.85rem;
    margin: 0;
    font-weight: 500;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}


/* Responsive Design */
@media (min-width: 1200px) {
    .photo-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 1199px) and (min-width: 768px) {
    .photo-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-auto-rows: 220px;
    }
    
    .photo-grid[data-photo-count="1"] {
        grid-auto-rows: 400px;
    }
    
    .photo-grid[data-photo-count="2"] {
        grid-auto-rows: 300px;
    }
}

@media (max-width: 767px) {
    .photo-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 180px;
        gap: 3px;
    }
    
    .photo-grid[data-photo-count="1"] {
        grid-template-columns: 1fr;
        grid-auto-rows: 300px;
    }
    
    .photo-grid[data-photo-count="2"] {
        grid-auto-rows: 200px;
    }
    
    .gallery-collection {
        padding: 1rem;
        margin-bottom: 2rem;
    }
    
    .collection-title {
        font-size: 1.5rem;
    }
    
    .collection-description {
        font-size: 0.95rem;
    }
    
    .photo-item.see-all-overlay::after {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .photo-grid {
        grid-auto-rows: 150px;
    }
    
    .photo-grid[data-photo-count="1"] {
        grid-auto-rows: 250px;
    }
    
    .photo-item.see-all-overlay::after {
        font-size: 1.8rem;
    }
}


/* ============================================
   PHOTO MODAL/LIGHTBOX STYLES
   ============================================ */

.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Modal Content */
.modal-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Modal Image Container */
.modal-image-container {
    position: relative;
    max-width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#modal-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* Modal Caption */
.modal-caption {
    margin-top: 1rem;
    color: rgb(0, 0, 0);
    font-size: 1rem;
    text-align: center;
    padding: 0.5rem 1rem;
    background: rgba(3, 3, 3, 0.1);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

/* Modal Counter */
.modal-counter {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

/* Close Button */
.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 3rem;
    color: white;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    line-height: 1;
    padding: 0;
    z-index: 10001;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* Navigation Buttons */
.modal-prev,
.modal-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10001;
}

.modal-prev {
    left: 20px;
}

.modal-next {
    right: 20px;
}

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

.modal-prev:active,
.modal-next:active {
    transform: translateY(-50%) scale(0.95);
}

.modal-prev svg,
.modal-next svg {
    width: 30px;
    height: 30px;
    display: block;
    flex-shrink: 0;
}

/* Disabled State */
.modal-prev:disabled,
.modal-next:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.modal-prev:disabled:hover,
.modal-next:disabled:hover {
    background: rgba(0, 0, 0, 0.5);
    transform: translateY(-50%);
}

/* Responsive Design */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
    }
    
    .modal-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 2rem;
    }
    
    .modal-prev,
    .modal-next {
        width: 45px;
        height: 45px;
        padding: 0;
    }
    
    .modal-prev {
        left: 10px;
    }
    
    .modal-next {
        right: 10px;
    }
    
    .modal-counter {
        top: 10px;
        font-size: 0.9rem;
        padding: 0.4rem 0.8rem;
    }
    
    #modal-image {
        max-height: 70vh;
    }
}

/* Keyboard Navigation Hint */
.modal-content::after {
    content: 'Use ← → keys to navigate';
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    color: rgb(71, 71, 71);
    font-size: 0.85rem;
    animation: fadeInOut 3s ease infinite;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

@media (max-width: 768px) {
    .modal-content::after {
        display: none;
    }
}