/* Image Detail Page Styles */
.image-detail {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 40px;
  margin-top: 2rem;
}

/* Import variables from main styles */
:root {
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.8);
  --text-muted: rgba(255, 255, 255, 0.6);
  --background: #0a0a0f;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-hover: rgba(255, 255, 255, 0.1);
}

/* Image Section */
.image-section {
  position: sticky;
  top: 100px;
  height: fit-content;
}

.main-image {
  position: relative;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.main-image img {
  width: 100%;
  height: auto;
  display: block;
}

/* Gallery for multiple images */
.main-image {
  position: relative;
}

.gallery-item {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.gallery-item.active {
  display: block;
}

/* Gallery thumbnails - these are the small preview images */
.gallery-thumbnails {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--glass-border);
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--glass-border) var(--surface);
  position: relative;
  z-index: 10; /* Ensure thumbnails are above the main image but below zoom overlay */
}

.gallery-thumbnails::-webkit-scrollbar {
  height: 6px;
}

.gallery-thumbnails::-webkit-scrollbar-track {
  background: var(--surface);
}

.gallery-thumbnails::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 3px;
}

.gallery-thumbnail {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

.gallery-thumbnail:hover {
  border-color: #667eea;
  transform: scale(1.05);
}

.gallery-thumbnail.active {
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.gallery-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  padding: 20px;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--glass-border);
  position: relative;
  z-index: 10; /* Ensure nav buttons are above the main image but below zoom overlay */
}

.gallery-nav button {
  padding: 8px 16px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-primary);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
}

.gallery-nav button:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: rgba(102, 126, 234, 0.3);
  box-shadow: 0 0 20px rgba(102, 126, 234, 0.1);
}

.gallery-nav button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.gallery-counter {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Info Section */
.info-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.image-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
  margin-bottom: 0;
}

.meta-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--glass-border);
}

.author {
  font-size: 16px;
  color: var(--text-secondary);
}

.author span {
  color: var(--text-primary);
  font-weight: 500;
}

.like-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-secondary);
  border-radius: 50px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.like-btn:hover {
  border-color: #ef4444;
  color: #ef4444;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

.like-btn.liked {
  background: #ef4444;
  border-color: #ef4444;
  color: white;
}

.like-btn .heart {
  font-size: 16px;
}

.like-btn .count {
  min-width: 20px;
  text-align: center;
}

/* Tags */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 32px;
  padding: 4px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 10px 20px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  color: #475569;
  text-decoration: none;
  border-radius: 25px;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid transparent;
  background-image:
    linear-gradient(135deg, #ffffff 0%, #f8fafc 100%),
    linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  background-origin: border-box;
  background-clip: content-box, border-box;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.5) inset;
  position: relative;
  overflow: hidden;
}

.tag::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.1), transparent);
  transition: left 0.5s ease;
}

.tag:hover {
  background-image:
    linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%),
    linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  transform: translateY(-3px) scale(1.05);
  box-shadow:
    0 8px 25px rgba(99, 102, 241, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.5) inset;
  color: #4f46e5;
}

.tag:hover::before {
  left: 100%;
}

.tag-icon {
  display: inline-block;
  font-size: 18px;
  margin-right: 8px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

.tag-text {
  position: relative;
  z-index: 1;
  letter-spacing: 0.025em;
}

/* Tag animation on load */
@keyframes tagSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tag {
  animation: tagSlideIn 0.5s ease-out forwards;
}

.tag:nth-child(1) { animation-delay: 0.1s; }
.tag:nth-child(2) { animation-delay: 0.2s; }
.tag:nth-child(3) { animation-delay: 0.3s; }
.tag:nth-child(4) { animation-delay: 0.4s; }
.tag:nth-child(5) { animation-delay: 0.5s; }

/* Prompts Section */
.prompts-section {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 32px;
  margin-top: 32px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.prompts-section h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.prompts-section h2::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 24px;
  background: var(--primary-gradient);
  border-radius: 2px;
}

.prompt-item {
  background: var(--surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  transition: all 0.3s ease;
}

.prompt-item:hover {
  background: var(--surface-hover);
  border-color: rgba(102, 126, 234, 0.3);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
}

.prompt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.prompt-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.prompt-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  background: var(--primary-gradient);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  border-radius: 6px;
}

.prompt-language {
  font-size: 18px;
  opacity: 0.7;
}

.prompt-title h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.prompt-actions {
  display: flex;
  gap: 8px;
}

.prompt-content-wrapper {
  margin-top: 12px;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--primary-gradient);
  color: var(--text-primary);
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.copy-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.copy-btn:active {
  transform: translateY(0);
}

.copy-btn .copy-icon {
  font-size: 16px;
}

.copy-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.copy-btn.loading .copy-icon {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.copy-btn.copied {
  background: #10b981;
}

.copy-btn.copied:hover {
  background: #059669;
}

.prompt-text {
  background: var(--surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  max-height: 400px;
  overflow-y: auto;
}

.prompt-content {
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Menlo', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Ensure pre tag doesn't collapse */
.prompt-text pre {
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Scrollbar styling */
.prompt-text::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.prompt-text::-webkit-scrollbar-track {
  background: var(--surface);
  border-radius: 3px;
}

.prompt-text::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 3px;
}

.prompt-text::-webkit-scrollbar-thumb:hover {
  background: var(--glass-bg);
}

/* Share Section */
.share-section {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 12px;
  padding: 24px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.share-section h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.share-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
}

.share-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.share-btn.twitter {
  background: #1da1f2;
  color: white;
}

.share-btn.facebook {
  background: #1877f2;
  color: white;
}

.share-btn.reddit {
  background: #ff4500;
  color: white;
}

.share-btn.pinterest {
  background: #bd081c;
  color: white;
}

.share-btn.copy-link {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}

.share-btn.copy-link:hover {
  background: var(--surface-hover);
  border-color: rgba(102, 126, 234, 0.3);
}

/* Ad Space */
.ad-space {
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  color: #94a3b8;
  font-size: 14px;
  min-height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-space::before {
  content: "Advertisement Space";
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  padding: 16px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 10px 40px rgba(16, 185, 129, 0.3);
  z-index: 1000;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 300px;
  max-width: 90vw;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-message {
  flex: 1;
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  transform: scale(1.1);
}

/* Toast variants */
.toast.error {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 10px 40px rgba(239, 68, 68, 0.3);
}

.toast.warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 10px 40px rgba(245, 158, 11, 0.3);
}

.toast.info {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 10px 40px rgba(59, 130, 246, 0.3);
}

/* Responsive Design */
@media (max-width: 1024px) {
  .image-detail {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .image-section {
    position: static;
  }

  .info-section {
    max-width: 600px;
    margin: 0 auto;
  }
}

@media (max-width: 768px) {
  .image-detail {
    gap: 20px;
  }

  .image-title {
    font-size: 1.5rem;
  }

  .meta-info {
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
  }

  .like-btn {
    justify-content: center;
  }

  .share-buttons {
    grid-template-columns: 1fr;
  }

  .prompts-section,
  .share-section {
    padding: 20px;
  }

  .prompt-group {
    padding: 12px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 15px;
  }

  .image-title {
    font-size: 1.25rem;
  }

  .main-image {
    border-radius: 12px;
  }

  .prompts-section,
  .share-section {
    padding: 16px;
    border-radius: 8px;
  }

  .prompt-header {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }

  .copy-btn {
    width: 100%;
  }
}