/* ========================================
   Modern Flip Card Gallery Styles
   ======================================== */

/* Modern Grid System */
.gallery-container {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

/* Grid responsive classes */
.grid {
  display: grid;
}
.grid-cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid-cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.grid-cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.grid-cols-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.grid-cols-6 {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.gap-4 {
  gap: 1rem;
}
.p-4 {
  padding: 1rem;
}

/* 3D Perspective and Transform */
.perspective-1000 {
  perspective: 1000px;
}

.transform-style-preserve-3d {
  transform-style: preserve-3d;
}

/* Basic flip card setup */
.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.8s;
  transform-style: preserve-3d;
}

.flip-card-inner.flipped {
  transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
}

.flip-card-back {
  transform: rotateY(180deg);
}

/* Disable hover effects when flipped */
.group.flipped .hover-scale:hover {
  transform: none !important;
}

/* Fix: Hover çakışmasını önle - flip card inner'da hover disable */
.flip-card-inner:hover ~ * .hover-scale,
.flip-card-inner .hover-scale {
  pointer-events: none;
}

/* Fix: Click sonrası hover'ı devre dışı bırak */
.group.flipped {
  pointer-events: all;
}

.group.flipped .hover-scale:hover {
  transform: none !important;
}

.group.flipped .group-hover\:opacity-100 {
  opacity: 1 !important;
}

/* Aspect ratio */
.aspect-9-16 {
  aspect-ratio: 9/16;
}

/* Modern Card Styles */
.bg-white {
  background-color: var(--bg-card);
}

[data-theme='dark'] .bg-white {
  background-color: var(--bg-card);
}

.rounded-2xl {
  border-radius: 1rem;
}

.shadow-lg {
  box-shadow: var(--shadow-lg);
}

.hover-shadow:hover {
  box-shadow: 0 20px 25px -5px rgba(139, 92, 246, 0.1), 0 10px 10px -5px rgba(139, 92, 246, 0.04);
}

[data-theme='dark'] .hover-shadow:hover {
  box-shadow: 0 20px 25px -5px rgba(139, 92, 246, 0.3), 0 10px 10px -5px rgba(139, 92, 246, 0.1);
}

.hover-scale:hover {
  transform: scale(1.02);
}

/* Fix: Flip card içindeyken hover efektini devre dışı bırak */
.flip-card-inner.flipped ~ .hover-scale:hover,
.group.flipped .hover-scale:hover {
  transform: none !important;
}

.transition-all {
  transition-property: all;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

.transition-transform {
  transition-property: transform;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

.transition-opacity {
  transition-property: opacity;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

.transition-colors {
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

.duration-200 {
  transition-duration: 200ms;
}

.duration-300 {
  transition-duration: 300ms;
}

.duration-500 {
  transition-duration: 500ms;
}

.duration-700 {
  transition-duration: 700ms;
}

.overflow-hidden {
  overflow: hidden;
}

.object-cover {
  object-fit: cover;
}

.opacity-0 {
  opacity: 0;
}

.opacity-100 {
  opacity: 1;
}

/* Gradient backgrounds */
.bg-gradient-to-t {
  background-image: linear-gradient(to top, var(--tw-gradient-stops));
}

.bg-gradient-to-br {
  background-image: linear-gradient(to bottom right, var(--tw-gradient-stops));
}

.from-black\/60 {
  --tw-gradient-from: rgba(0, 0, 0, 0.6);
  --tw-gradient-to: rgba(0, 0, 0, 0);
  --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
}

.from-blue-600 {
  --tw-gradient-from: #2563eb;
  --tw-gradient-to: rgba(37, 99, 235, 0);
  --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
}

.to-purple-700 {
  --tw-gradient-to: #7c3aed;
}

.to-transparent {
  --tw-gradient-to: transparent;
}

.via-transparent {
  --tw-gradient-stops: var(--tw-gradient-from), transparent, var(--tw-gradient-to);
}

/* Text styles */
.text-white {
  color: #ffffff;
}

.text-gray-200 {
  color: #e5e7eb;
}

.text-white\/90 {
  color: rgba(255, 255, 255, 0.9);
}

.text-white\/70 {
  color: rgba(255, 255, 255, 0.7);
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: 700;
}

.text-sm {
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.text-xs {
  font-size: 0.75rem;
  line-height: 1rem;
}

.leading-relaxed {
  line-height: 1.625;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-12 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 12;
  overflow: hidden;
}

/* Layout utilities */
.relative {
  position: relative;
}

.absolute {
  position: absolute;
}

.inset-0 {
  inset: 0px;
}

.bottom-4 {
  bottom: 1rem;
}

.left-4 {
  left: 1rem;
}

.right-4 {
  right: 1rem;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-1 {
  flex: 1 1 0%;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-1 {
  gap: 0.25rem;
}

.mb-3 {
  margin-bottom: 0.75rem;
}

.ml-2 {
  margin-left: 0.5rem;
}

.mt-1 {
  margin-top: 0.25rem;
}

.mt-3 {
  margin-top: 0.75rem;
}

.h-full {
  height: 100%;
}

.w-full {
  width: 100%;
}

.w-3 {
  width: 0.75rem;
}

.h-3 {
  height: 0.75rem;
}

.p-2 {
  padding: 0.5rem;
}

.pt-3 {
  padding-top: 0.75rem;
}

/* Button styles */
.bg-white\/20 {
  background-color: rgba(255, 255, 255, 0.2);
}

.hover-bg-white:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

.rounded-full {
  border-radius: 9999px;
}

.border-t {
  border-top-width: 1px;
}

.border-white\/20 {
  border-color: rgba(255, 255, 255, 0.2);
}

.cursor-pointer {
  cursor: pointer;
}

.group:hover .group-hover\:opacity-100 {
  opacity: 1 !important;
}

/* Responsive Grid */
@media (min-width: 640px) {
  .sm\:grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .xl\:grid-cols-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (min-width: 1536px) {
  .grid-cols-6-2xl {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

/* Animation enhancements */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.gallery-container > div {
  animation: fadeInUp 0.6s ease-out forwards;
  opacity: 0;
}

/* Improved hover effects - DISABLED: Flip animasyonunu bozuyor */
.group:hover .transition-transform {
  /* transform: scale(1.02); */
}

.group:hover .bg-gradient-to-t {
  opacity: 1;
}

/* Minimal Card Buttons */
.modern-card-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all 0.15s ease;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
}

.modern-card-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border-color: rgba(255, 255, 255, 0.3);
}

.modern-card-btn svg {
  width: 12px;
  height: 12px;
}

/* Minimal Modal Styles */
.modern-modal-content {
  background: var(--bg-card);
  border-radius: 12px;
  max-width: 550px;
  width: 100%;
  max-height: 80vh;
  overflow: hidden;
  transform: translateY(10px) scale(0.98);
  transition: all 0.2s ease;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}

.modal.active .modern-modal-content {
  transform: translateY(0) scale(1);
}

.modern-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-color);
}

.modern-modal-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.modern-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.modern-modal-close:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--primary-color);
}

.modern-modal-body {
  padding: 24px;
  max-height: 55vh;
  overflow-y: auto;
}

.modern-prompt-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  border: 1px solid var(--border-light);
  font-family: inherit;
}

.modern-prompt-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.modern-prompt-category {
  background: var(--primary-color);
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

.modern-prompt-date {
  color: var(--text-secondary);
  font-size: 0.85rem;
  background: var(--bg-primary);
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.modern-modal-footer {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: center;
}

.modern-copy-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.modern-copy-btn:hover {
  background: var(--accent-color);
}

/* Responsive Modal */
@media (max-width: 640px) {
  .modern-modal-content {
    margin: 10px;
    max-width: calc(100vw - 20px);
    border-radius: 16px;
  }

  .modern-modal-header,
  .modern-modal-body,
  .modern-modal-footer {
    padding-left: 20px;
    padding-right: 20px;
  }

  .modern-modal-title {
    font-size: 1.1rem;
  }
}

/* ========================================
   Infinite Scroll Styles - Minimal Design
   ======================================== */

.infinite-scroll-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem;
  margin: 2rem auto;
  background: transparent;
  border-radius: 50px;
  max-width: 270px;
  transition: all 0.4s ease;
  opacity: 0.8;
}

.infinite-scroll-loader:hover {
  opacity: 1;
}

.loader-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.loader-spinner i {
  font-size: 1.25rem;
  color: var(--primary-color);
  animation: spin 2s linear infinite;
}

.infinite-scroll-loader span {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.025em;
}

[data-theme='dark'] .infinite-scroll-loader span {
  color: var(--text-primary);
  opacity: 0.7;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Pulsing dots animation for more loading states */
.loading-dots {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.loading-dots::after {
  content: '';
  display: inline-block;
  animation: dots 1.5s infinite;
}

@keyframes dots {
  0%,
  20% {
    content: '';
  }
  40% {
    content: '•';
  }
  60% {
    content: '••';
  }
  80%,
  100% {
    content: '•••';
  }
}

/* Loading states for content */
.gallery-container.loading {
  opacity: 0.6;
  pointer-events: none;
}

.loaded-content {
  animation: fadeInUp 0.8s ease-out forwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Hide loader when no more content */
.infinite-scroll-loader.hidden {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.5s ease-out;
}

.infinite-scroll-loader.no-more {
  background: transparent;
  border: none;
  padding: 1rem;
}

.infinite-scroll-loader.no-more span {
  font-size: 0.8rem;
  opacity: 0.6;
  font-style: italic;
}

/* Mobile optimization */
@media (max-width: 640px) {
  .infinite-scroll-loader {
    margin: 1.5rem auto;
    padding: 1rem;
  }

  .loader-spinner {
    width: 20px;
    height: 20px;
  }

  .loader-spinner i {
    font-size: 1rem;
  }

  .infinite-scroll-loader span {
    font-size: 0.8rem;
  }
}

/* ========================================
   Modern Enhanced Loading Indicator
   ======================================== */

/* Modern loader override - more compact design */
.infinite-scroll-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  margin: 1.5rem auto;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
  border-radius: 50px;
  max-width: 220px;
  border: 1px solid rgba(102, 126, 234, 0.15);
  backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
  min-height: 44px;
}

[data-theme='dark'] .infinite-scroll-loader {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.12) 0%, rgba(118, 75, 162, 0.12) 100%);
  border-color: rgba(102, 126, 234, 0.25);
}

/* Shimmer effect */
.infinite-scroll-loader::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
  animation: shimmer 2.5s infinite;
}

/* Modern spinner rings */
.loader-spinner {
  position: relative;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader-spinner::before,
.loader-spinner::after {
  content: '';
  position: absolute;
  border: 2px solid transparent;
  border-radius: 50%;
  animation: spin 2s linear infinite;
}

.loader-spinner::before {
  width: 28px;
  height: 28px;
  border-top-color: #667eea;
  border-right-color: #667eea;
  animation-duration: 1.5s;
}

.loader-spinner::after {
  width: 20px;
  height: 20px;
  border-top-color: #764ba2;
  border-left-color: #764ba2;
  animation-duration: 1.8s;
  animation-direction: reverse;
}

/* Enhanced text styling */
.infinite-scroll-loader span {
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.025em;
  z-index: 1;
  opacity: 0.9;
}

[data-theme='dark'] .infinite-scroll-loader span {
  opacity: 0.8;
}

/* Hover effect */
.infinite-scroll-loader:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.15);
}

[data-theme='dark'] .infinite-scroll-loader:hover {
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.25);
}

/* No more content state */
.infinite-scroll-loader.no-more {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(34, 197, 94, 0.08) 100%);
  border-color: rgba(16, 185, 129, 0.2);
  padding: 0.75rem 1.25rem;
  min-height: 40px;
}

.infinite-scroll-loader.no-more span {
  font-size: 0.85rem;
  color: var(--success-color, #10b981);
  font-style: italic;
  opacity: 0.8;
}

/* Error state */
.infinite-scroll-loader.error {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(220, 38, 38, 0.08) 100%);
  border-color: rgba(239, 68, 68, 0.2);
}

.infinite-scroll-loader.error span {
  color: var(--error-color, #ef4444);
}

/* Enhanced animations */
@keyframes shimmer {
  0% {
    left: -100%;
  }
  50% {
    left: -50%;
  }
  100% {
    left: 100%;
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Pulse animation for dots */
.loading-dots::after {
  animation: loading-dots 1.2s infinite ease-in-out;
}

@keyframes loading-dots {
  0%,
  20% {
    content: '';
    opacity: 0.4;
  }
  40% {
    content: '•';
    opacity: 0.7;
  }
  60% {
    content: '••';
    opacity: 0.9;
  }
  80%,
  100% {
    content: '•••';
    opacity: 1;
  }
}

/* Smooth hide/show transitions */
.infinite-scroll-loader.hidden {
  opacity: 0;
  transform: translateY(-15px) scale(0.95);
  pointer-events: none;
  transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.infinite-scroll-loader.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Mobile responsive adjustments */
@media (max-width: 640px) {
  .infinite-scroll-loader {
    margin: 1rem auto;
    padding: 0.75rem 1.25rem;
    max-width: 200px;
    min-height: 40px;
  }

  .loader-spinner {
    width: 24px;
    height: 24px;
  }

  .loader-spinner::before {
    width: 24px;
    height: 24px;
  }

  .loader-spinner::after {
    width: 18px;
    height: 18px;
  }

  .infinite-scroll-loader span {
    font-size: 0.85rem;
  }
}

/* Performance optimizations */
.infinite-scroll-loader,
.infinite-scroll-loader::before,
.loader-spinner::before,
.loader-spinner::after {
  will-change: transform;
}

/* Accessibility improvements */
.infinite-scroll-loader[aria-hidden='true'] {
  opacity: 0;
  visibility: hidden;
}

.infinite-scroll-loader:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Modern End State Design */
.end-state {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 1;
  padding: 0.5rem 1rem;
}

.end-state .end-icon {
  width: 20px;
  height: 20px;
  color: var(--success-color, #10b981);
  animation: checkmark 0.8s ease-out forwards;
  flex-shrink: 0;
}

[data-theme='dark'] .end-state .end-icon {
  color: #34d399;
}

.end-state .end-text {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  opacity: 0.8;
  white-space: nowrap;
}

@keyframes checkmark {
  0% {
    opacity: 0;
    transform: scale(0.3) rotate(-45deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.1) rotate(0deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* Enhanced no-more state for end-state */
.infinite-scroll-loader.no-more .end-state {
  animation: fadeInScale 0.6s ease-out;
}

@keyframes fadeInScale {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
