/* Image Detail Page - Minimalist Gallery Style */

/* Import minimal design variables */
:root {
  --primary-blue: #0066cc;
  --primary-blue-hover: #0052a3;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --text-muted: #999999;
  --bg-white: #ffffff;
  --bg-light-gray: #fafafa;
  --border-light: #f0f0f0;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
  --transition-fast: 0.2s ease;
  --transition-base: 0.3s ease;
}

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

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

.main-image {
  position: relative;
  background: var(--bg-white);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base);
}

.main-image:hover {
  box-shadow: var(--shadow-md);
}

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

/* Gallery for multiple images */
.gallery-item {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

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

/* Gallery thumbnails */
.gallery-thumbnails {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: var(--bg-light-gray);
  border-top: 1px solid var(--border-light);
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) var(--bg-light-gray);
  position: relative;
  z-index: 5;
}

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

.gallery-thumbnails::-webkit-scrollbar-track {
  background: var(--bg-light-gray);
}

.gallery-thumbnails::-webkit-scrollbar-thumb {
  background: var(--border-light);
  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 var(--transition-fast);
  pointer-events: auto;
  position: relative;
  z-index: 5;
}

.gallery-thumbnail:hover {
  border-color: var(--primary-blue);
  transform: scale(1.05);
}

.gallery-thumbnail.active {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 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: 16px;
  background: var(--bg-light-gray);
  border-top: 1px solid var(--border-light);
  position: relative;
  z-index: 10;
}

.gallery-nav button {
  padding: 8px 16px;
  border: 1px solid var(--border-light);
  background: var(--bg-white);
  color: var(--text-secondary);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.gallery-nav button:hover:not(:disabled) {
  background: var(--bg-light-gray);
  border-color: var(--primary-blue);
  color: var(--primary-blue);
}

.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: 2rem;
}

.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(--border-light);
}

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

.author a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.author a:hover {
  color: var(--primary-blue);
}

.like-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid var(--border-light);
  background: var(--bg-white);
  color: var(--text-secondary);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.like-btn:hover {
  border-color: var(--primary-blue);
  color: var(--primary-blue);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.like-btn.liked {
  background: var(--primary-blue);
  border-color: var(--primary-blue);
  color: white;
}

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

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

/* Prompts Section */
.prompts-section {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: var(--shadow-sm);
}

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

.prompt-description {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
  line-height: 1.5;
}

.prompt-item {
  background: var(--bg-light-gray);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  transition: all var(--transition-base);
}

.prompt-item:hover {
  background: var(--bg-white);
  border-color: var(--primary-blue);
  box-shadow: var(--shadow-sm);
}

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

.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-blue);
  color: white;
  font-size: 14px;
  font-weight: 600;
  border-radius: 6px;
}

.prompt-language {
  font-size: 18px;
  color: var(--text-muted);
}

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

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

.copy-btn:hover {
  background: var(--primary-blue-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.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.copied {
  background: #10b981;
}

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

.prompt-content-wrapper {
  margin-top: 1rem;
}

.prompt-text {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 1rem;
  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(--bg-light-gray);
  border-radius: 3px;
}

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

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

/* Share Section */
.share-section {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.share-section h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  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 var(--transition-fast);
}

.share-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.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(--bg-light-gray);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

.share-btn.copy-link:hover {
  background: var(--primary-blue);
  color: white;
  border-color: var(--primary-blue);
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--primary-blue);
  color: white;
  padding: 16px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 1000;
  opacity: 0;
  transition: all var(--transition-base);
  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 var(--transition-fast);
  flex-shrink: 0;
}

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

/* Toast variants */
.toast.error {
  background: #ef4444;
}

.toast.warning {
  background: #f59e0b;
}

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

  .image-section {
    position: static;
  }

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

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

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

  .meta-info {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }

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

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

  .prompts-section,
  .share-section {
    padding: 1.5rem;
  }
}

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

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

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

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

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

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