﻿.gallery-parent {
  position: relative;
  margin: 30px 0;
  height: 22rem;
  width: 100%;
}

.gallery-parent-tall {
  position: relative;
  margin: 30px 0;
  height: 50rem;
  width: 100%;
}

.gallery-wrapper {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 15px;
  overflow-x: scroll;
  overflow-y: hidden;
  scrollbar-color: rgb(221, 221, 230) rgb(65, 64, 64);
  scrollbar-width: auto;
  scrollbar-gutter: stable both-edges;
  scroll-behavior: smooth;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 100%;
  height: 100%;
  padding: 20px 0px;
  cursor: grab;
  z-index: -200;
}

.gallery-wrapper-tall {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 15px;
  overflow-x: scroll;
  overflow-y: hidden;
  scroll-behavior: smooth;
  margin: 30px 0;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 100%;
  height: 50rem;
  cursor: grab;
  user-select: none;
  scrollbar-color: rgb(221, 221, 230) rgb(65, 64, 64);
  z-index: -200;
}

.gallery-wrapper::-webkit-scrollbar {
  display: none;
}

.gallery-wrapper:hover::-webkit-scrollbar {
  display: none;
}

.gallery-wrapper.dragging {
  cursor: grabbing;
}

.gallery {
  display: flex;
  gap: 20px;
  padding: 10px 0;
  min-width: min-content;
  height: 100%;
  z-index: -100;
}

.gallery-item {
  flex-shrink: 0;
  position: relative;
  cursor: pointer;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  pointer-events: auto;
}

.gallery-item:hover {
  transform: translateY(-8px) scale(1.05);
  box-shadow: 0 1px 10px var(--accent-color);
}

.gallery-item img,
.gallery-item video {
  max-width: 450px;
  min-width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  pointer-events: none;
  -webkit-user-drag: none;
}

.gallery-item .play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.gallery-item.video:hover .play-icon {
  opacity: 1;
}

.play-icon::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 20px solid #667eea;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  margin-left: 4px;
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  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 {
  position: relative;
  min-width: 80vw;
  max-width: 200vw;
  max-height: 200vh;
  animation: slideIn 0.3s ease;
}

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

.modal img,
.modal video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 40px;
  color: white;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.5);
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.3s ease;
  z-index: 1002;
  border: none;
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.8);
}

.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  font-size: 30px;
  padding: 15px 25px;
  cursor: pointer;
  border-radius: 5px;
  transition: background 0.3s ease;
  z-index: 1001;
}

.modal-nav:hover {
  background: rgba(0, 0, 0, 0.8);
}

.modal-nav.prev {
  left: 20px;
}

.modal-nav.next {
  right: 20px;
}

.modal-nav:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.modal-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 10px 20px;
  border-radius: 25px;
  font-size: 14px;
  z-index: 1001;
}

.gallery-buttons {
  z-index: 500;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  width: 100%;
  position: absolute;
  top: 50%;
  left: 0px;
  user-select: none;
  pointer-events: none;
}

.gallery-button {
  display: flex;
  cursor: pointer;
  margin: 0px 10px;
  pointer-events: all !important;
}

.gallery-button img {
  width: 50px;
  height: 5rem;
  overflow: hidden;
}

.gallery-button:hover {
  transform: translateY(-8px) scale(1.05);
  filter: drop-shadow(7px 5px 2px var(--secondary-color));
  transition: 0.75s;
  -webkit-transition: 0.75s; /* Safari */
  transition-timing-function: cubic-bezier(0.011, 0.992, 0.87, 1);
}

.gallery-button:active {
  transform: translateY(10px) scale(0.9);
  transition: 1.5s;
  -webkit-transition: 0.75s; /* Safari */
  transition-timing-function: linear(
    0,
    0.035 1%,
    0.139 2.1%,
    0.962 8.2%,
    1.105 10.2%,
    1.163 12.3%,
    1.164 13.5%,
    1.148 14.8%,
    1.003 21.4%,
    0.982 23.2%,
    0.973 25.1%,
    1.004 38%,
    1
  );
}

.back {
  -webkit-transform: scaleX(-1);
  transform: scaleX(-1);
}

@media (max-width: 768px) {
  .gallery-wrapper {
    height: auto;
    overflow-x: scroll;
  }

  .gallery-parent-tall {
    height: 20rem;
  }

  .gallery-parent {
    height: auto;
  }

  .gallery-item img,
  .gallery-item video {
    width: 180px;
  }

  .gallery-wrapper-tall {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    margin: 30px 0;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 100%;
    height: 20rem;
    cursor: grab;
    user-select: none;
  }

  .gallery-button {
    transform: translateY(-50%);
  }

  .gallery-button:hover {
    transform: translateY(-51%) scale(1.01);
  }

  .gallery-button:active {
    transform: translateY(-45%) scale(0.95);
  }

  .modal-close {
    top: 10px;
    right: 10px;
    font-size: 30px;
    width: 40px;
    height: 40px;
  }

  .modal-nav {
    padding: 10px 15px;
    font-size: 20px;
  }
}
