/* Image Gallery Specific Styles */
.image-gallery-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 120px 0 80px;
  margin-top: 56px;
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 2rem;
  color: var(--primary-color);
  position: relative;
  padding-bottom: 1rem;
}

.section-title::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 3px;
  background: var(--primary-color);
  border-radius: 2px;
}

/* Basic Image Layouts */
.float-left-img {
  float: left;
  margin: 0 1rem 1rem 0;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.float-left-img:hover {
  transform: scale(1.05);
}

.float-right-img {
  float: right;
  margin: 0 0 1rem 1rem;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.float-right-img:hover {
  transform: scale(1.05);
}

.inline-icon {
  vertical-align: middle;
  margin: 0 4px;
  border-radius: 50%;
  transition: transform 0.3s ease;
}

.inline-icon:hover {
  transform: rotate(360deg);
}

.text-content {
  overflow: hidden; /* Clear floats */
  line-height: 1.6;
}

/* Positioned Images */
.position-container {
  position: relative;
  height: 300px;
  background: #f8f9fa;
  border-radius: 8px;
  padding: 2rem;
  overflow: hidden;
}

.absolute-img {
  position: absolute;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  cursor: pointer;
}

.absolute-img:hover {
  transform: scale(1.1);
  z-index: 10;
}

.absolute-img.top-left {
  top: 10px;
  left: 10px;
}

.absolute-img.top-right {
  top: 10px;
  right: 10px;
}

.absolute-img.bottom-left {
  bottom: 10px;
  left: 10px;
}

.absolute-img.bottom-right {
  bottom: 10px;
  right: 10px;
}

.position-content {
  text-align: center;
  padding: 2rem;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  margin: 2rem;
}

.relative-container {
  position: relative;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
}

.relative-img {
  position: relative;
  left: 20px;
  top: -10px;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.relative-img:hover {
  left: 40px;
  top: -20px;
}

/* Fixed Image */
.fixed-image {
  position: fixed;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  z-index: 1000;
  background: white;
  padding: 10px;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: none;
  animation: bounceIn 0.5s ease;
}

.fixed-image.show {
  display: block;
}

.fixed-close {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--danger-color);
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: translateY(-50%) scale(0.3);
  }
  50% {
    opacity: 1;
    transform: translateY(-50%) scale(1.05);
  }
  70% {
    transform: translateY(-50%) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }
}

/* Flexbox Gallery */
.flex-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

.flex-item {
  position: relative;
  flex: 1 1 calc(50% - 0.5rem);
  min-width: 150px;
  overflow: hidden;
  border-radius: 8px;
  cursor: pointer;
}

.flex-item img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.flex-item:hover img {
  transform: scale(1.1);
}

.flex-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  color: white;
}

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

.flex-overlay .material-icons {
  font-size: 2rem;
}

/* CSS Grid Gallery */
.grid-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  grid-auto-rows: 100px;
  gap: 1rem;
}

.grid-item {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  cursor: pointer;
}

.grid-item.large {
  grid-column: span 2;
  grid-row: span 2;
}

.grid-item.tall {
  grid-row: span 2;
}

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

.grid-item:hover img {
  transform: scale(1.1);
}

.grid-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.8));
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.3s ease;
  color: white;
}

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

.grid-overlay h6 {
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.grid-overlay p {
  margin: 0;
  font-size: 0.875rem;
}

.grid-overlay .material-icons {
  font-size: 2rem;
  margin: auto;
}

/* Filter Effects */
.filter-demo {
  text-align: center;
  margin: 1rem 0;
}

.filter-image {
  max-width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 8px;
  transition: filter 0.3s ease;
}

/* Transform Gallery */
.transform-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.transform-item {
  text-align: center;
  padding: 1rem;
  border-radius: 8px;
  background: #f8f9fa;
  transition: all 0.3s ease;
}

.transform-item img {
  width: 100%;
  max-width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  transition: transform 0.3s ease;
}

.transform-label {
  margin-top: 0.5rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.scale-hover:hover img {
  transform: scale(1.2);
}

.rotate-hover:hover img {
  transform: rotate(15deg);
}

.skew-hover:hover img {
  transform: skewX(10deg);
}

.flip-hover:hover img {
  transform: rotateY(180deg);
}

/* Lightbox Gallery */
.lightbox-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.lightbox-item {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  cursor: pointer;
  aspect-ratio: 4 / 3;
}

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

.lightbox-item:hover img {
  transform: scale(1.1);
}

.lightbox-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  color: white;
}

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

.lightbox-overlay .material-icons {
  font-size: 3rem;
}

/* Lightbox Modal */
.lightbox-modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  animation: fadeIn 0.3s ease;
}

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

.lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  text-align: center;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  color: white;
  font-size: 2rem;
  font-weight: bold;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transition: background 0.3s ease;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.lightbox-caption {
  color: white;
  padding: 1rem 0;
  font-size: 1.1rem;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  padding: 1rem;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.3s ease;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.3);
}

.lightbox-nav.prev {
  left: -60px;
}

.lightbox-nav.next {
  right: -60px;
}

.lightbox-nav .material-icons {
  font-size: 1.5rem;
}

/* Image Carousel */
.image-carousel {
  position: relative;
}

.carousel-container {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  aspect-ratio: 3 / 2;
}

.carousel-track {
  display: flex;
  transition: transform 0.3s ease;
  height: 100%;
}

.carousel-slide {
  min-width: 100%;
  position: relative;
}

.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carousel-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  color: white;
  padding: 2rem 1rem 1rem;
}

.carousel-caption h6 {
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.carousel-caption p {
  margin: 0;
  font-size: 0.875rem;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.8);
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.3s ease;
  z-index: 10;
}

.carousel-btn:hover {
  background: white;
  transform: translateY(-50%) scale(1.1);
}

.carousel-btn.prev {
  left: 10px;
}

.carousel-btn.next {
  right: 10px;
}

.carousel-indicators {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  background: #dee2e6;
  cursor: pointer;
  transition: background 0.3s ease;
}

.indicator.active {
  background: var(--primary-color);
}

.indicator:hover {
  background: var(--primary-light);
}

/* Masonry Gallery */
.masonry-gallery {
  column-count: 3;
  column-gap: 1rem;
  column-fill: balance;
}

.masonry-item {
  display: inline-block;
  width: 100%;
  margin-bottom: 1rem;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  break-inside: avoid;
}

.masonry-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.masonry-item img {
  width: 100%;
  height: auto;
  display: block;
}

.masonry-content {
  padding: 1rem;
}

.masonry-content h6 {
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.masonry-content p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.5;
}

.masonry-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.tag {
  background: var(--primary-color);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* Responsive Design */
@media (max-width: 992px) {
  .masonry-gallery {
    column-count: 2;
  }

  .grid-gallery {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }

  .grid-item.large {
    grid-column: span 1;
    grid-row: span 1;
  }

  .transform-gallery {
    grid-template-columns: 1fr;
  }
}

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

  .masonry-gallery {
    column-count: 1;
  }

  .flex-gallery {
    flex-direction: column;
  }

  .flex-item {
    flex: none;
  }

  .lightbox-gallery {
    grid-template-columns: repeat(2, 1fr);
  }

  .lightbox-nav {
    display: none;
  }

  .position-container {
    height: 200px;
    padding: 1rem;
  }

  .absolute-img {
    width: 60px !important;
    height: 60px !important;
  }

  .carousel-btn {
    padding: 0.25rem;
  }

  .carousel-caption {
    padding: 1rem 0.5rem 0.5rem;
  }

  .carousel-caption h6 {
    font-size: 0.875rem;
  }

  .carousel-caption p {
    font-size: 0.75rem;
  }
}

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

  .transform-gallery {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .transform-item {
    padding: 0.5rem;
  }

  .transform-item img {
    max-width: 80px;
    height: 80px;
  }

  .float-left-img,
  .float-right-img {
    float: none;
    display: block;
    margin: 0 auto 1rem;
  }

  .text-content {
    text-align: center;
  }
}

/* Animation Classes */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

.fade-in {
  animation: fadeIn 0.6s ease;
}

.slide-in-up {
  animation: slideInUp 0.6s ease;
}

/* Loading Animation */
.loading {
  position: relative;
  overflow: hidden;
}

.loading::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* Preview/Full Size Images */
.preview-container {
  margin-bottom: 1.5rem;

  width: 200px; /* Example: A fixed width for the preview area */
  height: 150px; /* Example: A fixed height for the preview area */
  overflow: hidden; /* Hide any overflow if the image is larger */
  position: relative; /* Needed for positioning the overlay */
  cursor: pointer; /* Indicate it's clickable */
}

.preview-image {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);

  width: 33.33%; /* 1/3 of its original width */
  height: 33.33%; /* 1/3 of its original height */
  /* Or, if you want it to fill the *container* and then be scaled */
  max-width: 100%; /* Ensure it doesn't overflow the container */
  max-height: 100%; /* Ensure it doesn't overflow the container */
  object-fit: cover; /* This will make the image cover the container while maintaining aspect ratio */
                     /* Other options: 'contain', 'fill', 'scale-down', 'none' */
  display: block; /* Remove any extra space below the image */
}

.preview-image:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.preview-container:hover .lightbox-overlay {
    opacity: 1;
}

.lightbox-overlay .material-icons {
    color: white;
    font-size: 48px; /* Adjust as needed */
}

.preview-thumb {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.3s ease;
}

.preview-image:hover .preview-thumb {
  transform: scale(1.05);
}

.preview-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  color: white;
  text-align: center;
}

.preview-image:hover .preview-overlay {
  opacity: 1;
}

.preview-overlay .material-icons {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.preview-text {
  font-size: 0.875rem;
  font-weight: 500;
}

.preview-info {
  padding: 1rem 0.5rem 0;
  text-align: center;
}

.preview-info h6 {
  margin-bottom: 0.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

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

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

.fullsize-content {
  position: relative;
  max-width: 95%;
  max-height: 95%;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  overflow: hidden;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.fullsize-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: rgba(0, 0, 0, 0.3);
  color: white;
}

.fullsize-header h5 {
  margin: 0;
  font-weight: 600;
}

.fullsize-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: background 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fullsize-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.fullsize-image-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  max-height: 70vh;
  overflow: hidden;
}

.fullsize-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.fullsize-image.loaded {
  opacity: 1;
}

.fullsize-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: white;
}

.fullsize-loading.hidden {
  display: none;
}

.fullsize-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: rgba(0, 0, 0, 0.3);
  color: white;
}

.fullsize-info {
  display: flex;
  align-items: center;
  font-size: 0.875rem;
}

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

.fullsize-actions .btn {
  display: flex;
  align-items: center;
  font-size: 0.875rem;
  padding: 0.375rem 0.75rem;
}

/* Responsive adjustments for full size modal */
@media (max-width: 768px) {
  .fullsize-content {
    max-width: 98%;
    max-height: 98%;
  }

  .fullsize-header,
  .fullsize-footer {
    padding: 0.75rem 1rem;
  }

  .fullsize-header h5 {
    font-size: 1rem;
  }

  .fullsize-actions {
    flex-direction: column;
    gap: 0.25rem;
  }

  .fullsize-actions .btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
  }

  .fullsize-info {
    font-size: 0.75rem;
  }
}

@media (max-width: 576px) {
  .preview-overlay .material-icons {
    font-size: 2rem;
  }

  .preview-text {
    font-size: 0.75rem;
  }

  .fullsize-footer {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
}
