/* ==========================================
   GALLERY STYLES - Modern Ocean Theme
   ========================================== */

.memories-section {
    min-height: 100vh;
    background: var(--light-color);
    position: relative;
}

.memories-section .container-fluid {
    max-width: 1400px;
    margin: 0 auto;
}

.memories-header {
    padding: 3rem 0 2rem;
    animation: fadeInDown 0.8s ease;
}

.memories-header h4 {
    color: var(--text-light);
    font-weight: 400;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.memories-header h1 {
    color: var(--dark-color);
    font-weight: 800;
}

.memories-header h1 i {
    background: var(--gradient-ocean);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: float 3s ease-in-out infinite;
}

.memories-header .lead {
    color: var(--text-light);
    animation: fadeInUp 0.8s ease 0.2s both;
}

/* ==========================================
   GALLERY GRID SYSTEM - Instagram Style
   ========================================== */

#galleryGrid {
    margin-bottom: 3rem;
    --bs-gutter-x: 0.25rem;
    --bs-gutter-y: 0.25rem;
}

.gallery-item {
    background: white;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
    border: none;
    animation: scaleIn 0.6s ease backwards;
}

.gallery-item:nth-child(1) { animation-delay: 0.1s; }
.gallery-item:nth-child(2) { animation-delay: 0.2s; }
.gallery-item:nth-child(3) { animation-delay: 0.3s; }
.gallery-item:nth-child(4) { animation-delay: 0.4s; }
.gallery-item:nth-child(5) { animation-delay: 0.5s; }
.gallery-item:nth-child(6) { animation-delay: 0.6s; }

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10;
}

/* ==========================================
   MEDIA CONTAINER - High Quality Display
   ========================================== */

.gallery-media {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    cursor: pointer;
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
}

.gallery-media img,
.gallery-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Original colors preserved - no manipulation */
    image-rendering: auto;
    image-rendering: high-quality;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
    will-change: transform;
    transition: var(--transition);
}

.gallery-media:hover img,
.gallery-media:hover video {
    transform: scale(1.08);
}

/* REMOVED: Blue overlay that changed colors */
/* Original overlay code removed to preserve photo colors */

/* Video Play Button Overlay */
.gallery-media .play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--gradient-ocean);
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: var(--transition);
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.4);
    border: 3px solid rgba(255, 255, 255, 0.9);
}

.gallery-media:hover .play-overlay {
    transform: translate(-50%, -50%) scale(1.15);
    box-shadow: 0 12px 35px rgba(14, 165, 233, 0.6);
}

.play-overlay i {
    color: white;
    font-size: 28px;
    margin-left: 4px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* ==========================================
   CAPTION AREA - Descriptions
   ========================================== */

.gallery-caption {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: linear-gradient(to bottom, white 0%, #fafafa 100%);
}

.gallery-caption p {
    margin: 0;
    color: var(--text-color);
    font-size: 1.05rem;
    line-height: 1.7;
    word-wrap: break-word;
    font-weight: 500;
}

.gallery-caption .caption-date {
    font-size: 0.875rem;
    color: var(--primary-color);
    margin-top: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.gallery-caption .caption-date i {
    color: var(--primary-color);
}

/* ==========================================
   LIGHTBOX MODAL - Full Screen View
   ========================================== */

#lightboxModal .modal-content {
    background: rgba(15, 23, 42, 0.98) !important;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(14, 165, 233, 0.2);
}

#lightboxModal .modal-body {
    padding: 2rem;
}

#lightboxModal .btn-close {
    background: rgba(0, 0, 0, 0.9);
    opacity: 1;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    transition: var(--transition);
    border: 3px solid white;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7);
    position: relative;
    z-index: 1100;
}

#lightboxModal .btn-close::before,
#lightboxModal .btn-close::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 3px;
    background: white;
    border-radius: 2px;
}

#lightboxModal .btn-close::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

#lightboxModal .btn-close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

#lightboxModal .btn-close:hover {
    transform: scale(1.2) rotate(90deg);
    background: rgba(220, 38, 38, 0.95);
    border-color: white;
    box-shadow: 0 8px 24px rgba(220, 38, 38, 0.8);
}

#lightboxModal .btn-close:focus {
    box-shadow: 0 0 0 0.35rem rgba(255, 255, 255, 0.6);
}

#lightboxContent img {
    max-width: 100%;
    max-height: 85vh;
    height: auto;
    width: auto;
    border-radius: var(--border-radius);
    /* Original quality - zero color/contrast manipulation */
    image-rendering: auto;
    image-rendering: high-quality;
    object-fit: contain;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: scaleIn 0.4s ease;
}

#lightboxContent video {
    max-width: 100%;
    max-height: 85vh;
    height: auto;
    width: auto;
    border-radius: var(--border-radius);
    object-fit: contain;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: scaleIn 0.4s ease;
}

.lightbox-caption {
    color: white;
    text-align: center;
    margin-top: 2rem;
    font-size: 1.2rem;
    animation: fadeInUp 0.6s ease 0.2s both;
}

.lightbox-caption small {
    color: var(--primary-light);
    font-weight: 600;
}

/* ==========================================
   EMPTY STATE
   ========================================== */

#emptyState {
    margin-top: 3rem;
    animation: fadeIn 0.8s ease;
}

#emptyState .alert {
    padding: 2.5rem;
    border-radius: var(--border-radius-lg);
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.1) 0%, rgba(6, 182, 212, 0.1) 100%);
    border: 2px solid rgba(14, 165, 233, 0.2);
    box-shadow: var(--shadow-md);
}

#emptyState .alert i {
    color: var(--primary-color);
    font-size: 1.5rem;
}

#emptyState code {
    background: rgba(14, 165, 233, 0.1);
    padding: 0.35rem 0.65rem;
    border-radius: var(--border-radius-sm);
    color: var(--primary-dark);
    font-weight: 600;
    border: 1px solid rgba(14, 165, 233, 0.2);
}

/* ==========================================
   RESPONSIVE DESIGN - Instagram Style 3x3 Grid
   ========================================== */

/* Desktop: 3 columns with minimal gap */
@media (min-width: 769px) {
    .gallery-caption {
        padding: 1rem;
    }
    
    .gallery-caption p {
        font-size: 0.9rem;
    }
}

/* Tablet & Mobile: 3 columns with minimal gap */
@media (max-width: 768px) {
    .memories-header h4 {
        font-size: 0.9rem;
        margin-bottom: 0.3rem;
    }
    
    .memories-header h1 {
        font-size: 1.75rem;
    }
    
    .memories-header {
        padding: 2rem 0 1.5rem;
    }
    
    .gallery-item {
        border-radius: 3px;
    }
    
    .gallery-caption {
        padding: 0.5rem;
    }
    
    .gallery-caption p {
        font-size: 0.75rem;
        line-height: 1.4;
    }
    
    .gallery-caption .caption-date {
        font-size: 0.7rem;
        margin-top: 0.35rem;
    }
    
    .gallery-media .play-overlay {
        width: 45px;
        height: 45px;
    }
    
    .play-overlay i {
        font-size: 18px;
    }
    
    #lightboxModal .modal-body {
        padding: 1rem;
    }
    
    /* Kapatma butonu mobilde daha büyük */
    #lightboxModal .btn-close {
        width: 56px;
        height: 56px;
        top: 10px !important;
        right: 10px !important;
        margin: 0 !important;
    }
    
    #lightboxModal .btn-close::before,
    #lightboxModal .btn-close::after {
        width: 28px;
        height: 4px;
    }
}

/* Small phones: Ultra compact 3-column grid */
@media (max-width: 576px) {
    .memories-header h4 {
        font-size: 0.8rem;
    }
    
    .memories-header h1 {
        font-size: 1.5rem;
    }
    
    .gallery-item {
        border-radius: 2px;
    }
    
    .gallery-caption {
        padding: 0.4rem;
    }
    
    .gallery-caption p {
        font-size: 0.7rem;
        line-height: 1.3;
    }
    
    .gallery-caption .caption-date {
        font-size: 0.65rem;
        margin-top: 0.25rem;
    }
    
    .gallery-media .play-overlay {
        width: 35px;
        height: 35px;
    }
    
    .play-overlay i {
        font-size: 14px;
    }
}

/* ==========================================
   LOADING ANIMATION
   ========================================== */

.gallery-item.loading .gallery-media {
    background: linear-gradient(
        90deg,
        #e0f2fe 0%,
        #bae6fd 50%,
        #e0f2fe 100%
    );
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}
