
/* Gallery styling */
.gallery-header {
  position: relative;
}

.gallery-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
}

.gallery-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background-color: var(--border-color);
}

.gallery-button {
  min-width: 140px;
  white-space: nowrap;
}

/* Gallery Toggle Styling */
.gallery-toggle {
  display: flex;
  background-color: var(--color-secondary);
  border-radius: 6px;
  padding: 2px;
  gap: 0;
}

.toggle-button {
  background: transparent;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  color: var(--color-text);
  opacity: 0.6;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-button:hover {
  background-color: rgba(255, 255, 255, 0.1);
  opacity: 0.8;
}

.toggle-button.active {
  background-color: var(--color-white);
  color: var(--color-text);
  opacity: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Dark theme adjustments */
[data-bs-theme="dark"] .toggle-button.active {
  background-color: var(--color-text);
  color: var(--color-white);
}

/* Responsive button sizing */
@media (max-width: 576px) {
  .gallery-button {
    min-width: 120px;
    font-size: 0.875rem;
  }
}

.gallery-content {
  padding-top: 0;
}

.gallery-actions {
  display: flex;
  gap: 0.5rem;
}

/* Grid layout for thumbnails */
.image-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-gap: 15px;
  margin-bottom: 20px;
}

/* For smaller screens, show two columns */
@media (max-width: 768px) {
  .image-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* For mobile, show one column */
@media (max-width: 576px) {
  .image-grid {
    grid-template-columns: 1fr;
  }
}

.image-grid-item {
  width: 100%;
}

.image-square-container {
  position: relative;
  width: 100%;
  padding-bottom: 100%; /* 1:1 Aspect Ratio */
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.image-square-container img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover; /* This ensures the image covers the area without stretching */
  object-position: top;
}

/* Delete button styles */
.image-delete-button {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: rgba(220, 53, 69, 0.8); /* Red with opacity */
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0; /* Hidden by default */
  transition: opacity 0.2s ease-in-out;
  z-index: 10;
}

.image-square-container:hover .image-delete-button {
  opacity: 1; /* Show on hover */
}

.image-delete-button:hover {
  background-color: rgba(220, 53, 69, 1); /* Solid red on hover */
}

/* Styling for the container when an image is being deleted */
.image-square-container.deleting {
  opacity: 0.7;
  transition: opacity 0.3s ease-in-out;
}

/* Carousel Styles */
.carousel {
  position: relative;
  max-width: 100%;
  margin: 0 auto;
}

.carousel-inner {
  position: relative;
  width: 100%;
  height: 400px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.carousel-item {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.carousel-item.active {
  opacity: 1;
}

.carousel-item .position-relative {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.carousel-item img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  width: auto;
  height: auto;
}

/* Carousel Controls */
.carousel-control-prev,
.carousel-control-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: all 0.2s ease;
}

.carousel-control-prev {
  left: 15px;
}

.carousel-control-next {
  right: 15px;
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
  background: rgba(0, 0, 0, 0.9);
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
  width: 16px;
  height: 16px;
  background-size: contain;
  background-repeat: no-repeat;
}

.carousel-control-prev-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23ffffff'%3e%3cpath d='m3.86 8.753 5.482 4.796c.646.566 1.658.106 1.658-.753V3.204a1 1 0 0 0-1.659-.753l-5.48 4.796a1 1 0 0 0 0 1.506z'/%3e%3c/svg%3e");
}

.carousel-control-next-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23ffffff'%3e%3cpath d='m12.14 8.753-5.482 4.796c-.646.566-1.658.106-1.658-.753V3.204a1 1 0 0 1 1.659-.753l5.48 4.796a1 1 0 0 1 0 1.506z'/%3e%3c/svg%3e");
}

/* Carousel delete button styles */
.carousel-delete-button {
  position: absolute;
  top: 20px;
  right: 20px;
  background-color: rgba(220, 53, 69, 0.8);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
  z-index: 10;
}

.carousel-item:hover .carousel-delete-button,
.carousel-item .position-relative:hover .carousel-delete-button {
  opacity: 1;
}

.carousel-delete-button:hover {
  background-color: rgba(220, 53, 69, 1);
}