/**
 * RK Spordikool Gallery & Lightbox Styles
 * Clickable thumbnails with keyboard-navigable lightbox
 */

/* Gallery Section Styles */
.gallery-section {
    background: linear-gradient(135deg, #B8DCF2 0%, #E3F2FD 100%);
    padding: 100px 0;
    position: relative;
    overflow: hidden;
}

/* Section Title */
.gallery-section .section-title-center {
    color: var(--text-color);
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 4rem;
    text-align: center;
    position: relative;
}

/* Remove the line below title */
.gallery-section .section-title-center::after {
    display: none;
}

/* Gallery Carousel Container */
.gallery-carousel {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* Gallery Track */
.gallery-track {
    display: flex;
    transition: transform 0.5s ease-in-out;
    gap: 0.5rem;
    padding: 0.5rem;
}

/* Gallery Items - Remove spacing and hover effects */
.gallery-item {
    flex: 0 0 calc(33.333% - 0.333rem);
    min-width: 300px;
    cursor: pointer;
    transition: none;
}

.gallery-image-container {
    position: relative;
    width: 100%;
    height: 250px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    transition: none;
}

/* Remove hover effects */
.gallery-image-container:hover {
    transform: none;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: none;
}

/* Remove image scaling on hover */
.gallery-item:hover img {
    transform: none;
}

/* Remove Gallery Overlay completely */
.gallery-overlay {
    display: none;
}

.gallery-overlay-content {
    display: none;
}

.zoom-icon {
    display: none;
}

.gallery-caption {
    display: none;
}

/* Gallery Navigation */
.gallery-prev,
.gallery-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  font-size: 1.5rem;
  color: var(--rk-text);
  cursor: pointer;
  box-shadow: var(--rk-shadow-md);
  transition: all var(--rk-time-fast) var(--rk-ease);
  z-index: 10;
}

.gallery-prev {
  left: var(--rk-space-4);
}

.gallery-next {
  right: var(--rk-space-4);
}

.gallery-prev:hover,
.gallery-next:hover {
  background: white;
  transform: translateY(-50%) scale(1.1);
}

/* Gallery Indicators */
.gallery-indicators {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.gallery-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: 2px solid var(--rk-blue);
    cursor: pointer;
    transition: all 0.3s ease;
}

.gallery-indicator.active,
.gallery-indicator:hover {
    background: var(--bright-yellow);
    transform: scale(1.2);
}

/* Lightbox Styles */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image-container {
    position: relative;
    max-width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* Lightbox Navigation */
.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-color);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.lightbox-close {
    top: 20px;
    right: 20px;
}

.lightbox-prev {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: var(--bright-yellow);
    transform: scale(1.1);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.3);
}

.lightbox-prev:hover {
    transform: translateY(-50%) scale(1.1);
}

.lightbox-next:hover {
    transform: translateY(-50%) scale(1.1);
}

/* Lightbox Caption */
.lightbox-caption {
    position: absolute;
    bottom: -50px;
    left: 0;
    right: 0;
    color: white;
    text-align: center;
    font-size: 1rem;
    background: rgba(0, 0, 0, 0.7);
    padding: var(--rk-space-3) var(--rk-space-4);
    border-radius: var(--rk-radius-lg);
    backdrop-filter: blur(10px);
}

/* Counter */
.lightbox-counter {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    padding: 0.5rem 1rem;
    border-radius: 15px;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .gallery-track {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--rk-space-3);
  }

  .gallery-prev,
  .gallery-next {
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
  }

  .lightbox__container {
    max-width: 95vw;
    max-height: 95vh;
  }

  .lightbox__nav {
    width: 50px;
    height: 50px;
    font-size: 1.25rem;
  }

  .lightbox__prev {
    left: -60px;
  }

  .lightbox__next {
    right: -60px;
  }

  .lightbox__close {
    top: -50px;
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .lightbox__caption {
    bottom: -40px;
    font-size: 0.9rem;
    padding: var(--rk-space-2) var(--rk-space-3);
  }
}

@media (max-width: 480px) {
  .gallery-track {
    grid-template-columns: 1fr;
  }

  .lightbox__prev,
  .lightbox__next {
    width: 45px;
    height: 45px;
    font-size: 1.125rem;
  }

  .lightbox__prev {
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
  }

  .lightbox__next {
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
  }

  .lightbox__close {
    top: 20px;
    right: 20px;
  }

  .lightbox__caption {
    position: static;
    margin-top: var(--rk-space-4);
  }
}

/* Prevent scrolling when lightbox is open */
body.lightbox-open {
  overflow: hidden;
  height: 100vh;
}

/* Loading state */
.lightbox__content.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 200px;
  min-height: 200px;
}

.lightbox__content.loading::after {
  content: '';
  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); }
}

/* Animations */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

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

.lightbox-overlay.active .lightbox-content {
    animation: fadeInUp 0.3s ease;
}

/* High contrast mode support */
@media (prefers-contrast: more) {
    .gallery-overlay {
        background: rgba(0, 0, 0, 0.8);
    }

    .gallery-prev,
    .gallery-next,
    .lightbox-close,
    .lightbox-prev,
    .lightbox-next {
        background: #ffffff;
        border: 2px solid var(--text-color);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .gallery-item,
    .gallery-image-container,
    .gallery-item img,
    .gallery-overlay,
    .gallery-overlay-content,
    .gallery-prev,
    .gallery-next,
    .lightbox-overlay,
    .lightbox-close,
    .lightbox-prev,
    .lightbox-next {
        transition: none;
    }

    .gallery-item:hover .gallery-image-container,
    .gallery-item:hover img,
    .gallery-prev:hover,
    .gallery-next:hover {
        transform: none;
    }

    .zoom-icon {
        animation: none;
    }

    .lightbox-overlay.active .lightbox-content {
        animation: none;
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .gallery-item {
        flex: 0 0 calc(50% - 0.25rem);
        min-width: 250px;
    }

    .gallery-image-container {
        height: 200px;
    }
}

@media (max-width: 768px) {
    .gallery-section {
        padding: 60px 0;
    }

    .gallery-item {
        flex: 0 0 calc(100% - 1rem);
        min-width: 280px;
    }

    .gallery-track {
        gap: 0.25rem;
        padding: 0.25rem;
    }

    .gallery-image-container {
        height: 180px;
    }

    .gallery-prev,
    .gallery-next {
        width: 50px;
        height: 50px;
    }

    .gallery-prev {
        left: 10px;
    }

    .gallery-next {
        right: 10px;
    }

    .gallery-section .section-title-center {
        font-size: 2rem;
        margin-bottom: 3rem;
    }
}
