/* ==========================================
   COMPLETE GALLERY STYLES
   Following UX Principles: Visual Hierarchy, 
   Gestalt Principles, Fitts's Law, Minimal Cognitive Load
   ========================================== */

/* ===== GALLERY PAGE HERO SECTION (Multi-Grid Layout) ===== */
.gallery-page-hero-zone {
  min-height: 30vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  padding: 1rem 0;
  /* Use default page background */
}

.gallery-hero-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  width: 100%;
}

.gallery-hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
  min-height: 60vh;
}

.gallery-hero-content-area {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.gallery-hero-text-block {
  opacity: 0;
  animation: galleryFadeInUp 0.8s ease-out 0.2s forwards;
}

.gallery-display-title {
  font-family: 'Inter', sans-serif;
  font-weight: 900;
  font-size: clamp(2.8rem, 5vw, 4.5rem);
  line-height: 1.1;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, #FFD1E2 0%, #FBF9E1 50%, #B3D2FF 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.gallery-display-subtitle {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  line-height: 1.6;
  color: rgba(227, 219, 236, 0.9);
  max-width: 500px;
  margin: 0;
}

.gallery-hero-stats-row {
  display: flex;
  gap: 2.5rem;
  opacity: 0;
  animation: galleryFadeInUp 0.8s ease-out 0.6s forwards;
}

.gallery-stat-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.gallery-stat-number {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  color: rgba(227, 219, 236, 0.9);
  line-height: 1;
  margin-bottom: 0.15rem;
}

.gallery-stat-label {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 0.9rem;
  color: rgba(227, 219, 236, 0.9);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===== ANIMATIONS ===== */
@keyframes galleryFadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes galleryFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

/* ===== RESPONSIVE HERO ===== */
@media (max-width: 1200px) {
  .gallery-hero-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
    min-height: 40vh;
  }
}

@media (max-width: 968px) {
  .gallery-hero-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
    min-height: 30vh;
  }
  
  .gallery-hero-content-area {
    gap: 2rem;
  }
  
  .gallery-hero-stats-row {
    gap: 2rem;
  }
  
  .gallery-stat-item {
    align-items: center;
  }
}

@media (max-width: 768px) {
  .gallery-page-hero-zone {
    min-height: 25vh;
    padding: 0.5rem 0;
  }
  
  .gallery-hero-container {
    padding: 0 1rem;
  }
  
  .gallery-hero-stats-row {
    gap: 1.5rem;
  }
}

@media (max-width: 480px) {
  .gallery-hero-stats-row {
    flex-direction: column;
    gap: 1rem;
  }
}

/* ===== MAIN GALLERY GRID ===== */
.gallery-main {
  /* Use default page background */
  padding: 0.5rem 0;
  min-height: 10vh;
  position: relative;
  z-index: 2;
}

.gallery-container {
  max-width: 1600px !important;
  margin: 0 auto !important;
  padding: 0 2rem !important;
}

.gallery-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
  gap: 1.5rem !important;
  padding: 3rem 0 !important;
  position: relative !important;
  /* Use masonry-style layout */
  grid-auto-rows: 1fr;
  align-items: start;
}

/* ===== GALLERY ITEMS (Following Fitts's Law - Larger Touch Targets) ===== */
.gallery-item {
  opacity: 1;
  transform: translateY(0) scale(1);
  animation: galleryItemReveal 0.8s ease-out forwards;
  position: relative;
  display: block !important;
  visibility: visible !important;
}

.gallery-item:nth-child(4n+1) { animation-delay: 0.1s; }
.gallery-item:nth-child(4n+2) { animation-delay: 0.2s; }
.gallery-item:nth-child(4n+3) { animation-delay: 0.3s; }
.gallery-item:nth-child(4n+4) { animation-delay: 0.4s; }

@keyframes galleryItemReveal {
  from {
    opacity: 0.7;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.gallery-prompt-text {
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: 0.9rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.95);
  margin: 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  max-height: 4.5em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  padding: 1rem 1.25rem;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(20px);
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.5s ease 0.2s;
  margin-bottom: 1rem;
}

.gallery-item-wrapper:hover .gallery-prompt-text {
  transform: translateY(0);
  opacity: 1;
  color: rgba(255, 255, 255, 1);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Full page indicator styling */
.gallery-full-page-indicator {
  margin-top: 0.5rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-full-page-indicator span {
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gallery-item-wrapper:hover .gallery-full-page-indicator {
  opacity: 1;
}

/* Fix image container sizing */
.gallery-item-wrapper {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  cursor: pointer;
  /* Remove fixed aspect ratio to let images display naturally */
  display: flex;
  flex-direction: column;
  /* Set a minimum height for consistency */
  min-height: 300px;
}

.gallery-image-container {
  position: relative;
  flex: 1;
  overflow: hidden;
  /* Make container take full height of wrapper */
  height: 100%;
  width: 100%;
}

.gallery-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
  display: block;
}

/* Adjust overlay positioning for better text display */
.gallery-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0;
  background: linear-gradient(to right,
    rgba(0, 0, 0, 0.3) 0%,
    rgba(0, 0, 0, 0.1) 50%,
    rgba(0, 0, 0, 0.3) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.5rem;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

/* Adjust content layout */
.gallery-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

/* Adjust actions positioning */
.gallery-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: auto;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.4s ease 0.1s;
}

.gallery-item-wrapper:hover .gallery-actions {
  opacity: 1;
  transform: translateY(0);
}

/* Gallery image link styling */
.gallery-image-link {
  display: block;
  text-decoration: none;
  color: inherit;
  height: 100%;
  width: 100%;
  cursor: pointer;
  /* Ensure link takes full container space */
  position: relative;
  flex: 1;
}

.gallery-image-link:hover {
  text-decoration: none;
  color: inherit;
}

/* Ensure buttons work properly within the link */
.gallery-image-link .gallery-action-btn {
  position: relative;
  z-index: 10;
}

/* Add subtle visual feedback for clickable images */
.gallery-item-wrapper:hover .gallery-image-link {
  transform: scale(1.02);
  transition: transform 0.3s ease;
}

.gallery-item-wrapper:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.1);
}

.gallery-item-wrapper:hover .gallery-image {
  transform: scale(1.05);
  filter: brightness(0.9);
}

/* ===== ACTION BUTTONS (Fitts's Law - Large Targets) ===== */
.gallery-action-btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(20px);
  min-width: 120px;
  position: relative;
  overflow: hidden;
}

.gallery-action-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.gallery-action-btn:hover::before {
  left: 100%;
}

.gallery-action-btn.generate-btn:hover {
  background: rgba(251, 191, 36, 0.25);
  border-color: rgba(251, 191, 36, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(251, 191, 36, 0.3);
}

.gallery-action-btn:active {
  transform: translateY(0) scale(0.98);
  transition: all 0.1s ease;
}

/* Minimal hover effects - no excessive glow */
.gallery-action-btn.view-btn:hover {
  background: rgba(96, 165, 250, 0.15);
  border-color: rgba(96, 165, 250, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.15);
}

/* ===== BADGES (Visual Hierarchy) ===== */
/* AI Badge removed - using only theme badge for cleaner UI */

.gallery-theme-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(0, 0, 0, 0.7);
  color: rgba(255, 255, 255, 0.9);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  backdrop-filter: blur(10px);
}

/* ===== RESPONSIVE DESIGN (Mobile-First) ===== */
@media (min-width: 1400px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)) !important;
    gap: 1.5rem !important;
  }
}

@media (max-width: 1400px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)) !important;
    gap: 1.5rem !important;
  }
}

@media (max-width: 1200px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)) !important;
    gap: 1.25rem !important;
  }
}

@media (max-width: 900px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
    gap: 1rem !important;
  }
}

@media (max-width: 768px) {
  .gallery-container {
    padding: 0 1.5rem !important;
  }
  
  .gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
    gap: 1rem !important;
  }
  
  .gallery-hero {
    min-height: 80vh;
  }
  
  .gallery-stats {
    flex-direction: column;
    gap: 2rem;
  }
  
  .gallery-stat-divider {
    width: 80px;
    height: 2px;
    background: linear-gradient(to right,
      transparent 0%,
      rgba(255, 255, 255, 0.3) 50%,
      transparent 100%);
  }
  
  .gallery-overlay {
    padding: 1rem !important;
  }
  
  .gallery-prompt-text {
    font-size: 0.85rem !important;
    padding: 0.75rem 1rem !important;
  }
  
  .gallery-action-btn {
    padding: 0.6rem 1.2rem !important;
    font-size: 0.8rem !important;
    min-width: 100px !important;
  }
  
  .gallery-actions {
    flex-direction: column !important;
    gap: 0.5rem !important;
  }
}

@media (max-width: 600px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
    gap: 0.75rem !important;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.5rem !important;
  }
}

/* ========================================
   IMAGE DETAIL PAGE STYLES
   ======================================== */

.image-detail-page {
  min-height: 100vh;
  padding: 6rem 0 4rem;
  /* Use default page background instead of overriding */
}

.image-detail-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
}

.detail-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.back-link, .nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--theme-text-color, rgba(255, 255, 255, 0.9));
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 500;
}

.back-link:hover, .nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 255, 255, 0.1);
}

.image-detail-content {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 4rem;
  align-items: start;
}

.image-section {
  position: sticky;
  top: 8rem;
}

.image-container {
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  background: rgba(0, 0, 0, 0.3);
}

.detail-image {
  width: 100%;
  height: auto;
  display: block;
  max-height: 80vh;
  object-fit: contain;
}

.details-section {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.image-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.image-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--theme-heading-color, rgba(255, 255, 255, 0.95));
  margin: 0;
}

.theme-tag {
  background: linear-gradient(135deg, var(--theme-primary-color, #667eea), rgba(255, 209, 0, 0.8));
  color: rgba(0, 0, 0, 0.8);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.section-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--theme-heading-color, rgba(255, 255, 255, 0.95));
  margin: 0 0 1rem 0;
}

.prompt-display {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 0 1.5rem 1.5rem 1.5rem; /* Remove top padding */
  position: relative;
}

.prompt-text {
  color: var(--theme-text-color, rgba(255, 255, 255, 0.9));
  line-height: 1.6;
  margin: 0 0 1rem 0;
  font-size: 1rem;
}

.copy-prompt-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--theme-text-color, rgba(255, 255, 255, 0.9));
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

.copy-prompt-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.metadata-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.meta-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 1rem;
}

.meta-label {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.meta-value {
  font-size: 0.95rem;
  color: var(--theme-text-color, rgba(255, 255, 255, 0.9));
  font-weight: 500;
}

.action-section {
  display: flex;
  gap: 1rem;
}

.primary-action-btn, .secondary-action-btn {
  padding: 1rem 2rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex: 1;
}

.primary-action-btn {
  background: linear-gradient(135deg, var(--theme-primary-color, #667eea), rgba(255, 209, 0, 0.8));
  color: rgba(0, 0, 0, 0.8);
}

.primary-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 209, 0, 0.3);
}

.secondary-action-btn {
  background: rgba(255, 255, 255, 0.1);
  color: var(--theme-text-color, rgba(255, 255, 255, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.secondary-action-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.related-section {
  margin-top: 2rem;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.related-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.3s ease;
  text-decoration: none;
}

.related-item:hover {
  transform: scale(1.05);
}

.related-item img {
  width: 100%;
  height: 150px;
  object-fit: cover;
}

.related-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  padding: 1rem 0.5rem 0.5rem;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.related-item:hover .related-overlay {
  transform: translateY(0);
}

.related-prompt {
  color: white;
  font-size: 0.8rem;
  line-height: 1.3;
}

/* ===== RESPONSIVE DESIGN FOR DETAIL PAGE ===== */
@media (max-width: 1024px) {
  .image-detail-content {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  
  .image-section {
    position: static;
  }
}

@media (max-width: 768px) {
  .detail-navigation {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .image-header {
    flex-direction: column;
    gap: 1rem;
  }
  
  .action-section {
    flex-direction: column;
  }
  
  .metadata-grid {
    grid-template-columns: 1fr;
  }
  
  .related-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .image-detail-container {
    padding: 0 1rem;
  }
  
  .related-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== ACCESSIBILITY & MOTION PREFERENCES ===== */
@media (prefers-reduced-motion: reduce) {
  .gallery-item,
  .gallery-item-wrapper,
  .gallery-image,
  .gallery-overlay {
    animation: none !important;
    transition: none !important;
  }
}

/* ===== DEBUG INDICATOR - COMPLETELY DISABLED ===== */
.gallery-grid::before,
.gallery-grid::after {
  display: none !important;
  content: none !important;
  visibility: hidden !important;
}