/* Gallery Styles */

/* ---- Gallery Container ---- */
.gallery-section {
  padding: 80px 0;
  background: var(--paper);
}

.gallery-container {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
}

/* ---- Gallery Tabs ---- */
.gallery-tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 40px;
  padding: 0 20px;
}

.gallery-tab {
  background: transparent;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: capitalize;
  position: relative;
  overflow: hidden;
}

.gallery-tab::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: var(--gradient);
  transition: left 0.3s ease;
  z-index: -1;
}

.gallery-tab:hover::before,
.gallery-tab.active::before {
  left: 0;
}

.gallery-tab:hover,
.gallery-tab.active {
  color: white;
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

/* ---- Gallery Grid ---- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  padding: 20px;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.5s ease;
}

.gallery-grid.loaded {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Gallery Item ---- */
.gallery-item {
  position: relative;
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  cursor: pointer;
  aspect-ratio: 4/3;
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

/* ---- Gallery Media ---- */
.gallery-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #f8f9fa;
  transition: all 0.3s ease;
}

.gallery-item:hover .gallery-media {
  transform: scale(1.02);
}

/* ---- Video Thumbnail Specific ---- */
.gallery-item.video .gallery-media {
  object-fit: cover;
  pointer-events: none; /* Prevent video controls from interfering */
}

.gallery-item.video video.gallery-media {
  object-position: center;
}

/* ---- Gallery Overlay ---- */
.gallery-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(0, 0, 0, 0.4) 0%,
    rgba(0, 0, 0, 0.6) 100%
  );
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.gallery-play-icon {
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  opacity: 0.9;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-item:hover .gallery-play-icon {
  transform: scale(1.15);
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ---- Gallery Info ---- */
.gallery-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px;
  background: linear-gradient(
    transparent 0%,
    rgba(0, 0, 0, 0.7) 100%
  );
  color: white;
  transform: translateY(100%);
  transition: all 0.3s ease;
}

.gallery-item:hover .gallery-info {
  transform: translateY(0);
}

.gallery-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  text-transform: capitalize;
}

.gallery-type {
  font-size: 12px;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Google Drive Badge removed - no longer needed */

/* ---- Error State ---- */
.gallery-item.error-state {
  background: #f5f5f5;
  border: 2px dashed #ddd;
}

.gallery-item.error-state::before {
  content: '⚠️ Failed to load';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #666;
  font-size: 14px;
  text-align: center;
  z-index: 2;
}

.gallery-item.error-state .gallery-media {
  opacity: 0.3;
}

/* ---- Loading State ---- */
.gallery-item:not(.loaded) .gallery-media {
  opacity: 0.7;
  filter: blur(2px);
}

.gallery-item.loaded .gallery-media {
  opacity: 1;
  filter: none;
  transition: all 0.5s ease;
}

/* ---- Loading States ---- */
.gallery-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top: 3px solid var(--brand);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.gallery-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

/* ---- Video Specific Styles ---- */
.gallery-item.video::after {
  content: '▶';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 32px;
  color: white;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  opacity: 0.8;
  transition: all 0.3s ease;
  z-index: 2;
  pointer-events: none;
}

.gallery-item.video:hover::after {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.1);
}

/* ---- Video Placeholder ---- */
.video-placeholder {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

.video-thumbnail-placeholder {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-lg);
  transition: all 0.3s ease;
  cursor: pointer;
}

.gallery-item:hover .video-thumbnail-placeholder {
  transform: scale(1.02);
}

.gallery-item.video .video-thumbnail-placeholder {
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%) !important;
}

/* ---- Responsive Styles ---- */

/* Large Desktop */
@media (min-width: 1200px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 32px;
    padding: 24px;
  }
  
  .gallery-tabs {
    gap: 20px;
    margin-bottom: 48px;
  }
  
  .gallery-tab {
    padding: 14px 28px;
    font-size: 15px;
  }
}

/* Tablet */
@media (max-width: 1024px) {
  .gallery-section {
    padding: 60px 0;
  }
  
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    padding: 16px;
  }
  
  .gallery-tabs {
    gap: 12px;
    margin-bottom: 32px;
  }
  
  .gallery-tab {
    padding: 10px 20px;
    font-size: 13px;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .gallery-section {
    padding: 40px 0;
  }
  
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    padding: 12px;
  }
  
  .gallery-tabs {
    gap: 8px;
    margin-bottom: 24px;
    padding: 0 12px;
  }
  
  .gallery-tab {
    padding: 8px 16px;
    font-size: 12px;
  }
  
  .gallery-info {
    padding: 12px;
  }
  
  .gallery-title {
    font-size: 13px;
  }
  
  .gallery-type {
    font-size: 11px;
  }
}

/* Small Mobile */
@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    padding: 8px;
  }
  
  .gallery-tabs {
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }
  
  .gallery-tab {
    width: 100%;
    max-width: 200px;
    text-align: center;
  }
  
  .gallery-item.video::after {
    font-size: 24px;
  }
}

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

/* ---- Google Drive Lightbox Styles ---- */
.google-drive-lightbox .google-drive-preview {
  text-align: center;
  max-width: 90vw;
  max-height: 80vh;
}

.google-drive-lightbox .lightbox-image {
  max-width: 100%;
  max-height: 60vh;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  margin-bottom: 20px;
}

.google-drive-lightbox .google-drive-video {
  width: 80vw;
  height: 60vh;
  max-width: 1200px;
  max-height: 675px;
  min-width: 320px;
  min-height: 240px;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  border: none;
  margin-bottom: 20px;
}

.google-drive-lightbox .drive-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: white;
  text-align: center;
}

.google-drive-lightbox .drive-icon {
  font-size: 64px;
  margin-bottom: 20px;
}

.google-drive-lightbox .drive-fallback h3 {
  font-size: 24px;
  margin-bottom: 10px;
  color: white;
}

.google-drive-lightbox .drive-fallback p {
  font-size: 16px;
  opacity: 0.8;
  margin-bottom: 20px;
}

/* Google Drive video fallback button */
.google-drive-lightbox .btn-drive-view {
  display: inline-block;
  background: #4285f4;
  color: white;
  padding: 12px 24px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  margin-top: 15px;
}

.google-drive-lightbox .btn-drive-view:hover {
  background: #3367d6;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(66, 133, 244, 0.3);
}

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

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

.lightbox-overlay .lightbox-image,
.lightbox-overlay .lightbox-media,
.lightbox-overlay .lightbox-video {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-overlay .lightbox-video {
  background: #000;
  min-width: 320px;
  min-height: 240px;
}

.lightbox-overlay .lightbox-close {
  position: absolute;
  top: -50px;
  right: -10px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  font-size: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.lightbox-overlay .lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.lightbox-overlay .lightbox-caption {
  color: white;
  text-align: center;
  margin-top: 20px;
  font-size: 16px;
  font-weight: 500;
  max-width: 80vw;
}

.lightbox-overlay .lightbox-counter {
  color: rgba(255, 255, 255, 0.8);
  text-align: center;
  margin-top: 10px;
  font-size: 14px;
}

.lightbox-overlay .lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  z-index: 10;
}

.lightbox-overlay .lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-50%) scale(1.1);
}

.lightbox-overlay .lightbox-prev {
  left: 20px;
}

.lightbox-overlay .lightbox-next {
  right: 20px;
}

.lightbox-overlay .lightbox-image {
  transition: opacity 0.15s ease;
}

/* Mobile adjustments for navigation and video */
@media (max-width: 768px) {
  .lightbox-overlay .lightbox-nav {
    width: 44px;
    height: 44px;
  }
  
  .lightbox-overlay .lightbox-prev {
    left: 10px;
  }
  
  .lightbox-overlay .lightbox-next {
    right: 10px;
  }
  
  .lightbox-overlay .lightbox-close {
    top: -40px;
    right: 0;
  }
  
  .lightbox-overlay .lightbox-video {
    max-width: 95vw;
    max-height: 70vh;
    min-width: 280px;
    min-height: 200px;
  }
  
  .lightbox-overlay .lightbox-content {
    max-width: 95vw;
    max-height: 95vh;
  }
}

/* ---- Animation Delays ---- */
.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:nth-child(7) { animation-delay: 0.7s; }
.gallery-item:nth-child(8) { animation-delay: 0.8s; }

/* ---- Fade In Animation ---- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.gallery-item {
  animation: fadeInUp 0.6s ease forwards;
  opacity: 0;
  transform: translateY(30px);
}
