/* Prompts Page Styles */

/* Hero Section */
.prompts-hero {
  padding: 120px 24px 32px;
  background: var(--bg);
  position: relative;
}

.prompts-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(136, 233, 93, 0.08), transparent),
    radial-gradient(ellipse 60% 40% at 80% 60%, rgba(94, 140, 200, 0.05), transparent);
  pointer-events: none;
}

.prompts-hero-content {
  max-width: var(--max);
  margin: 0 auto;
  text-align: center;
  position: relative;
  z-index: 1;
}

.prompts-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.1;
}

.prompts-subtitle {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 28px;
}

/* Category Filter */
.category-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  position: sticky;
  top: 64px;
  z-index: 40;
  padding: 16px 24px;
  background: var(--bg);
  box-shadow: 0 1px 0 0 rgba(58, 57, 51, 0);
  transition: box-shadow 0.2s ease;
}

.category-filter.is-sticky {
  box-shadow: 0 1px 0 0 rgba(58, 57, 51, 0.5);
}

.filter-left {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-right {
  display: flex;
  gap: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 3px;
}

.sort-btn {
  padding: 6px 14px;
  border-radius: 100px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sort-btn:hover {
  color: var(--text);
}

.sort-btn.active {
  background: var(--green);
  color: var(--bg);
  font-weight: 600;
}

.category-btn {
  padding: 8px 16px;
  border-radius: 100px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  overflow: hidden;
}

.category-btn:hover {
  border-color: var(--green);
  color: var(--green);
  transform: translateY(-1px);
}

.category-btn.active {
  background: var(--green);
  border-color: var(--green);
  color: var(--bg);
  font-weight: 600;
}

/* Prompts Grid Section - Masonry Layout */
.prompts-grid-section {
  padding: 24px 16px 60px;
  background: var(--bg);
  min-height: 60vh;
  width: 100%;
}

.prompts-container {
  width: 100%;
  max-width: none;
  margin: 0;
}

/* Fixed Column Grid - 2 to 7 columns based on screen width, full width */
.prompts-grid {
  display: flex;
  gap: 12px;
  width: 100%;
}

.grid-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0; /* Prevent overflow */
}

/* Default: 7 columns for large screens */
.grid-column:nth-child(1),
.grid-column:nth-child(2),
.grid-column:nth-child(3),
.grid-column:nth-child(4),
.grid-column:nth-child(5),
.grid-column:nth-child(6),
.grid-column:nth-child(7) {
  display: flex;
}

.grid-column:nth-child(8),
.grid-column:nth-child(9),
.grid-column:nth-child(10) {
  display: none;
}

/* 6 columns */
@media (max-width: 1600px) {
  .grid-column:nth-child(7) {
    display: none;
  }
}

/* 5 columns */
@media (max-width: 1400px) {
  .grid-column:nth-child(6) {
    display: none;
  }
}

/* 4 columns */
@media (max-width: 1100px) {
  .grid-column:nth-child(5) {
    display: none;
  }
}

/* 3 columns */
@media (max-width: 800px) {
  .grid-column:nth-child(4) {
    display: none;
  }
  .prompts-grid {
    gap: 10px;
  }
  .grid-column {
    gap: 10px;
  }
}

/* 2 columns (minimum) */
@media (max-width: 550px) {
  .grid-column:nth-child(3) {
    display: none;
  }
  .prompts-grid {
    gap: 8px;
  }
  .grid-column {
    gap: 8px;
  }
}

@media (max-width: 400px) {
  .prompts-grid-section {
    padding: 16px 8px 40px;
  }
}

/* Prompt Card - Grid Item */
.prompt-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel);
  cursor: pointer;
  opacity: 0;
  transform: translateY(30px);
  will-change: transform, opacity;
}

.prompt-card-image {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.25s ease;
}

@media (max-width: 800px) {
  .prompt-card {
    border-radius: 10px;
  }
}

@media (max-width: 480px) {
  .prompt-card {
    border-radius: 8px;
  }
}

.prompt-card:hover .prompt-card-image {
  transform: scale(1.03);
}

/* Card Overlay - Fast animation */
.prompt-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.85) 0%,
    rgba(0, 0, 0, 0.4) 50%,
    transparent 100%
  );
  opacity: 0;
  transition: opacity 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px;
}

.prompt-card:hover .prompt-card-overlay {
  opacity: 1;
}

.card-overlay-content {
  transform: translateY(10px);
  opacity: 0;
  transition: all 0.2s ease 0.05s;
}

.prompt-card:hover .card-overlay-content {
  transform: translateY(0);
  opacity: 1;
}

.card-author {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.card-author-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--bg);
  flex-shrink: 0;
}

.card-author-name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-use-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: var(--green);
  color: var(--bg);
  border: none;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease;
  text-decoration: none;
}

.card-use-btn:hover {
  transform: scale(1.05);
}

.card-use-btn i,
.card-use-btn .card-use-icon {
  width: 14px;
  height: 14px;
  display: block;
}

.card-likes {
  display: flex;
  align-items: center;
  gap: 4px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.75rem;
  font-weight: 500;
}

.card-likes i,
.card-likes .card-likes-icon {
  color: #ff6b6b;
  font-size: 0.875rem;
  width: 14px;
  height: 14px;
  display: block;
}

/* Loading More */
.loading-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px;
  color: var(--muted);
  font-size: 0.875rem;
  opacity: 0;
  visibility: hidden;
}

.loading-more.visible {
  opacity: 1;
  visibility: visible;
}

.loading-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   NEW MODAL LAYOUT - Image Center, Sidebar Right
   ============================================ */

.prompt-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.prompt-modal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  opacity: 0;
}

.prompt-modal.active .modal-backdrop {
  opacity: 1;
}

/* Main Content Area - Takes remaining space */
.modal-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 16px 24px 24px;
  margin-right: 380px; /* Space for sidebar */
  opacity: 0;
}

.prompt-modal.active .modal-main {
  opacity: 1;
}

@media (max-width: 900px) {
  .modal-main {
    margin-right: 0;
    padding: 12px 16px 16px;
  }
}

/* Top Actions */
.modal-top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.action-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  backdrop-filter: blur(4px);
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.action-btn i {
  font-size: 1.125rem;
}

.action-btn.keyboard-btn {
  width: auto;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
}

.action-btn.keyboard-btn span {
  font-family: var(--number-font);
}

/* Gallery Center Area */
.modal-gallery-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 0;
  position: relative;
}

.gallery-image-wrapper {
  flex: 1;
  max-width: 100%;
  max-height: calc(100vh - 180px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  overflow: hidden;
  /* No background - transparent */
}

.gallery-image-wrapper img {
  max-width: 100%;
  max-height: calc(100vh - 180px);
  object-fit: contain;
  display: block;
  border-radius: 8px;
}

.gallery-nav {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  cursor: pointer;
  display: none !important; /* Always hidden - navigation via thumbnails only */
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
  opacity: 0.7;
}

.gallery-nav.visible {
  display: none !important;
}

.gallery-nav:hover {
  background: rgba(255, 255, 255, 0.3);
  opacity: 1;
  transform: scale(1.05);
}

.gallery-nav i {
  font-size: 1.25rem;
}

/* Thumbnails - Bottom (default) */
.gallery-thumbs {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding-top: 16px;
  flex-shrink: 0;
  overflow-x: auto;
}

/* Thumbnails - Right side (when multiple images) */
.gallery-thumbs.thumbs-right {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  flex-direction: column;
  padding: 0;
  gap: 12px;
  max-height: 80%;
  overflow-y: auto;
  overflow-x: hidden;
}

.gallery-thumb {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s ease;
  flex-shrink: 0;
  background: var(--panel);
}

.gallery-thumb:hover,
.gallery-thumb.active {
  border-color: var(--green);
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Right Sidebar - Fixed */
.modal-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  height: 100vh;
  background: var(--panel);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 1001;
  opacity: 0;
  transform: translateX(100%);
}

.prompt-modal.active .modal-sidebar {
  opacity: 1;
  transform: translateX(0);
}

@media (max-width: 900px) {
  .modal-sidebar {
    width: 100%;
    transform: translateY(100%);
  }
  
  .prompt-modal.active .modal-sidebar {
    transform: translateY(0);
  }
  
  .modal-main {
    display: none;
  }
}

/* Sidebar Header */
.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.author-info-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.author-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 600;
  color: var(--bg);
  flex-shrink: 0;
}

.author-names {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.author-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.author-handle {
  font-size: 0.8125rem;
  color: var(--faint);
}

.model-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--panel-2);
  border-radius: 100px;
  font-size: 0.75rem;
  color: var(--muted);
  border: 1px solid var(--line);
}

.model-badge i {
  color: var(--green);
  font-size: 0.875rem;
}

/* Sidebar Stats */
.sidebar-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--muted);
}

.stat-item i,
.stat-item .stat-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: block;
}

.stat-item .heart-icon {
  color: #ff6b6b;
}

.stat-item .eye-icon {
  color: #888;
}

.copy-prompt-btn {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.copy-prompt-btn:hover {
  background: var(--green);
  border-color: var(--green);
  color: var(--bg);
}

.copy-prompt-btn.copied {
  background: var(--green);
  border-color: var(--green);
  color: var(--bg);
}

/* Sidebar Content - Scrollable */
.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* Prompt Section */
.prompt-section {
  margin-bottom: 20px;
}

.prompt-section h3 {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.prompt-text {
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--muted);
  max-height: 120px;
  overflow: hidden;
  position: relative;
}

.prompt-text.expanded {
  max-height: none;
}

.prompt-text::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(to bottom, transparent, var(--panel));
  pointer-events: none;
}

.prompt-text.expanded::after {
  display: none;
}

.expand-prompt-btn {
  margin-top: 8px;
  padding: 0;
  background: none;
  border: none;
  color: var(--green);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.expand-prompt-btn:hover {
  opacity: 0.8;
}

/* Categories Section */
.categories-section {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.category-tag {
  padding: 6px 12px;
  background: var(--panel-2);
  border-radius: 100px;
  font-size: 0.75rem;
  color: var(--muted);
  border: 1px solid var(--line);
}

/* Related Section */
.related-section {
  margin-bottom: 20px;
}

.related-section h3 {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.related-item {
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: var(--panel-2);
  transition: transform 0.15s ease;
}

.related-item:hover {
  transform: scale(1.02);
}

.related-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Sidebar Actions */
.sidebar-actions {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: row;
  gap: 10px;
  flex-shrink: 0;
}

.action-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border-radius: 10px;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  flex: 1 1 0px;
}

.action-button.primary {
  background: var(--green);
  color: var(--bg);
  border: none;
}

.action-button.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(136, 233, 93, 0.3);
}

.action-button.secondary {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
}

.action-button.secondary:hover {
  background: var(--panel-3);
  border-color: var(--line-strong);
}

.action-button i {
  font-size: 1.125rem;
}

/* Sidebar Attribution */
.sidebar-attribution {
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  flex-shrink: 0;
}

.sidebar-attribution a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s ease;
}

.sidebar-attribution a:hover {
  color: var(--green);
}

.license-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  background: var(--panel-2);
  border-radius: 4px;
  font-size: 0.6875rem;
  color: var(--muted);
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 100px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  z-index: 2000;
  opacity: 0;
  transition: all 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast i {
  color: var(--green);
  font-size: 1.125rem;
}

.toast span {
  font-size: 0.875rem;
  color: var(--text);
  font-weight: 500;
}

/* Empty State */
.empty-state {
  column-span: all;
  text-align: center;
  padding: 60px 24px;
  color: var(--muted);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 0.875rem;
}

/* Scrollbar Styles */
.sidebar-content::-webkit-scrollbar,
.gallery-thumbs::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

.sidebar-content::-webkit-scrollbar-track,
.gallery-thumbs::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb,
.gallery-thumbs::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 2px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover,
.gallery-thumbs::-webkit-scrollbar-thumb:hover {
  background: var(--line-strong);
}
