/* Skip Link for Accessibility - Phase 1, Task 1.6 */
.skip-to-content {
  position: absolute;
  top: 0;
  left: 0;
  background: #000;
  color: #fff;
  padding: 8px 16px;
  text-decoration: none;
  z-index: 100000;
  border-radius: 0 0 4px 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-150%);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.skip-to-content:focus,
.skip-to-content:focus-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Semantic Variables (The Source of Truth) */
  --aipg-bg-main: #0f172a;
  --aipg-bg-card: #1e293b;
  --aipg-bg-sidebar: #0a0f1e;
  --aipg-text-primary: #f1f5f9;
  --aipg-text-secondary: #94a3b8;
  --aipg-text-accent: #60a5fa;
  --aipg-accent-primary: #8b5cf6;
  --aipg-border-color: #334155;
  --aipg-radius-sm: 0.5rem;
  --aipg-radius-md: 0.75rem;
  --aipg-radius-lg: 1rem;
  --aipg-radius-xl: 1.25rem;
  --aipg-radius-2xl: 1.5rem;
  --aipg-radius-full: 9999px;

  /* Legacy Mapping (for backward compatibility during migration) */
  --primary-color: var(--aipg-accent-primary);
  --primary-dark: var(--aipg-accent-primary);
  --secondary-color: #3b82f6;
  --bg-dark: var(--aipg-bg-main);
  --bg-darker: var(--aipg-bg-sidebar);
  --bg-card: var(--aipg-bg-card);
  --text-primary: var(--aipg-text-primary);
  --text-secondary: var(--aipg-text-secondary);
  --border-color: var(--aipg-border-color);
  --hover-color: #2563eb;
  --success-color: #10b981;
  --warning-color: #f59e0b;
}

[data-aipg-theme="light"] {
  --aipg-bg-main: #f8fafc;
  --aipg-bg-card: #ffffff;
  --aipg-bg-sidebar: #f1f5f9;
  --aipg-text-primary: #0f172a;
  --aipg-text-secondary: #475569;
  --aipg-text-accent: #2563eb;
  --aipg-accent-primary: #7c3aed;
  --aipg-border-color: #cbd5e1;
}

body.aipg-body {
  font-family: var(--aipg-font-family, "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  background-color: var(--aipg-bg-main);
  color: var(--aipg-text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

[data-aipg-theme="light"] .aipg-header {
  background-color: rgba(248, 250, 252, 0.88);
}

.aipg-container {
  max-width: var(--aipg-max-width, 1400px);
  margin: 0 auto;
  padding: 0 2rem;
}

/* Theme Mode Toggle UI */
.aipg-mode-toggle {
  background: var(--aipg-bg-card);
  border: 1px solid var(--aipg-border-color);
  color: var(--aipg-text-primary);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: 1rem;
}

.aipg-mode-toggle:hover {
  border-color: var(--aipg-accent-primary);
  background: var(--aipg-bg-sidebar);
}

.aipg-mode-icon {
  font-size: 20px;
  width: 20px;
  height: 20px;
}

/* Header Styles */
.aipg-header {
  background-color: rgba(15, 23, 42, 0.82);
  background-color: color-mix(in srgb, var(--aipg-bg-main) 82%, transparent);
  border-bottom: 1px solid var(--aipg-border-color);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.aipg-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.aipg-logo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-icon {
  flex-shrink: 0;
}

.logo-text h1 {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--aipg-accent-primary), var(--aipg-text-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.25rem;
}

.logo-text p {
  font-size: 0.875rem;
  color: var(--aipg-text-secondary);
}

.aipg-menu {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--aipg-text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  transition: all 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--aipg-text-primary);
  background-color: var(--aipg-bg-card);
}

.nav-admin {
  background: var(--aipg-accent-gradient);
  color: white;
}

.nav-admin:hover {
  background: var(--aipg-accent-gradient);
  filter: brightness(1.1);
  color: white;
}

/* Breadcrumb */
.aipg-breadcrumb {
  padding: 1rem 0;
  font-size: 0.875rem;
  color: var(--aipg-text-secondary);
}

.aipg-breadcrumb a {
  color: var(--aipg-text-secondary);
  text-decoration: none;
  transition: color 0.3s;
}

.aipg-breadcrumb a:hover {
  color: var(--aipg-accent-primary);
}

/* Hero Section */
.aipg-hero {
  padding: 3rem 0;
  text-align: center;
}

.aipg-hero .aipg-container {
  position: relative;
  overflow: hidden;
  border-radius: var(--aipg-radius-2xl);
}

.aipg-hero.has-image .aipg-container {
  min-height: min(420px, 48vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
}

.hero-image {
  position: absolute;
  inset: 0;
}

.hero-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.35), rgba(15, 23, 42, 0.82));
}

.hero-image .hero-banner-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-title {
  position: relative;
  z-index: 1;
  font-size: 3rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--aipg-accent-primary), var(--aipg-text-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1rem;
}

.hero-subtitle {
  position: relative;
  z-index: 1;
  font-size: 1.25rem;
  color: var(--aipg-text-secondary);
  max-width: 700px;
  margin: 0 auto;
}

.hero-banner-wrapper {
  width: 100%;
  border-radius: 1.5rem;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  margin-bottom: 2rem;
}

.hero-banner-image {
  width: 100%;
  height: auto;
  display: block;
}

/* Search and Filter Section - Premium Overhaul */
.aipg-search-section {
  padding: 3rem 0;
  background: radial-gradient(circle at top right, color-mix(in srgb, var(--aipg-accent-primary) 5%, transparent), transparent 40%);
}

.search-filter-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  background: rgba(30, 41, 59, 0.4);
  padding: 2.5rem;
  border-radius: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.search-main-row {
  display: flex;
  gap: 1.5rem;
  align-items: stretch;
  width: 100%;
}

.search-box {
  flex: 1;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary-color);
  z-index: 2;
}

body.aipg-body .search-box input {
  width: 100%;
  padding: 1.25rem 1.5rem 1.25rem 4rem;
  background-color: rgba(15, 23, 42, 0.84);
  background-color: color-mix(in srgb, var(--aipg-bg-sidebar) 84%, transparent);
  border: 1px solid var(--border-color);
  border-radius: 1.25rem;
  color: var(--text-primary);
  font-size: 1.1rem;
  transition: all 0.3s ease;
}

body.aipg-body .search-box input:focus {
  outline: none;
  border-color: var(--primary-color);
  background-color: var(--bg-darker);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--aipg-accent-primary) 20%, transparent);
}

.filter-buttons {
  display: flex;
  gap: 0.5rem;
  background: rgba(15, 23, 42, 0.6);
  padding: 0.5rem;
  border-radius: 1.25rem;
  border: 1px solid var(--border-color);
}

.filter-btn {
  padding: 0.75rem 1.75rem;
  background: transparent;
  border: none;
  border-radius: 0.875rem;
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  color: white;
  background: rgba(255, 255, 255, 0.05);
}

.filter-btn.active {
  background: var(--aipg-accent-gradient);
  color: white;
  box-shadow: 0 4px 15px color-mix(in srgb, var(--aipg-accent-primary) 30%, transparent);
}

.aipg-advanced-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  width: 100%;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.filter-label {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--primary-color);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding-left: 0.25rem;
}

body.aipg-body select.aipg-select {
  width: 100%;
  padding: 1rem 3rem 1rem 1.5rem;
  background-color: rgba(15, 23, 42, 0.84);
  background-color: color-mix(in srgb, var(--aipg-bg-sidebar) 84%, transparent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238b5cf6' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1.25rem center;
  border: 1px solid var(--border-color);
  border-radius: var(--aipg-radius-xl);
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: all 0.3s ease;
}

body.aipg-body select.aipg-select:hover {
  border-color: var(--primary-color);
  background-color: var(--bg-darker);
}

body.aipg-body select.aipg-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--aipg-accent-primary) 20%, transparent);
}

body.aipg-body select.aipg-select option {
  background-color: var(--bg-card);
  color: var(--text-primary);
}

/* Filter Layout: Sidebar */
.filter-layout-sidebar .aipg-prompts-container {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 2rem;
  align-items: start;
}

.filter-layout-sidebar .search-filter-wrapper {
  position: sticky;
  top: 120px;
  padding: 1.5rem;
}

.filter-layout-sidebar .aipg-advanced-filters {
  grid-template-columns: 1fr;
}

/* Filter Layout: Drawer */
.aipg-drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.aipg-drawer-overlay.active {
  opacity: 1;
  visibility: visible;
}

.aipg-filter-drawer {
  position: fixed;
  top: 0;
  right: -400px;
  width: 100%;
  max-width: 400px;
  height: 100%;
  background: var(--bg-dark);
  border-left: 1px solid var(--border-color);
  z-index: 2001;
  padding: 2.5rem;
  transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}

.aipg-drawer-overlay.active .aipg-filter-drawer {
  right: 0;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.drawer-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 2rem;
  cursor: pointer;
}

.drawer-trigger-btn {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 0.875rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.filter-layout-drawer .drawer-trigger-btn {
  display: flex;
}

.filter-layout-drawer .aipg-advanced-filters {
  display: none;
  /* Controlled by drawer */
}

@media (max-width: 992px) {
  .filter-layout-sidebar .aipg-prompts-container {
    grid-template-columns: 1fr;
  }

  .filter-layout-sidebar .search-filter-wrapper {
    position: static;
  }
}

/* Legacy overrides */
.category-filter-wrapper {
  display: none !important;
}

@media (max-width: 992px) {
  .search-main-row {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-buttons {
    justify-content: center;
  }
}

/* Prompts Grid */
.aipg-prompts-section {
  padding: 2rem 0 4rem;
  min-height: 600px;
}

/* Gallery Grid Layouts */
/* Base styles - layout-specific CSS loaded separately based on gallery_layout setting */
.prompts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

/* Layout-specific styles moved to separate files:
 * - assets/css/layout-grid.css
 * - assets/css/layout-masonry.css
 * These are conditionally loaded by AssetManager based on gallery_layout setting.
 */

/* ===== MODERN CARD DESIGN ===== */
.prompt-card {
  background: linear-gradient(145deg, var(--bg-card) 0%, rgba(30, 41, 59, 0.8) 100%);
  border-radius: 1.25rem;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.prompt-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, color-mix(in srgb, var(--aipg-accent-primary) 10%, transparent) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: 1;
}

.prompt-card:hover {
  transform: translateY(-8px) scale(1.01);
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.3),
    0 0 60px color-mix(in srgb, var(--aipg-accent-primary) 15%, transparent);
  border-color: color-mix(in srgb, var(--aipg-accent-primary) 30%, transparent);
}

.prompt-card:hover::before {
  opacity: 1;
}

/* Card Shine Effect on Hover */
.prompt-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.08),
    transparent
  );
  transform: skewX(-25deg);
  transition: left 0.6s ease;
  pointer-events: none;
  z-index: 2;
}

.prompt-card:hover::after {
  left: 150%;
}

.prompt-image-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: linear-gradient(145deg, var(--bg-dark), var(--bg-card));
}

.prompt-image-wrapper.no-image {
  background: linear-gradient(145deg, var(--bg-dark), var(--bg-card));
}

/* Modern placeholder with animated gradient */
.premium-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary);
  gap: 1rem;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--aipg-accent-primary) 5%, transparent) 0%,
    color-mix(in srgb, var(--aipg-text-accent) 5%, transparent) 50%,
    color-mix(in srgb, var(--aipg-accent-primary) 5%, transparent) 100%
  );
  background-size: 200% 200%;
  animation: gradientShift 8s ease infinite;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.premium-placeholder span {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  background: linear-gradient(135deg, var(--primary-color), var(--text-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.prompt-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

[data-aipg-theme="light"] .search-filter-wrapper {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(15, 23, 42, 0.1);
  box-shadow: 0 18px 36px -18px rgba(15, 23, 42, 0.22);
}

[data-aipg-theme="light"] body.aipg-body .search-box input,
[data-aipg-theme="light"] body.aipg-body select.aipg-select {
  background-color: rgba(248, 250, 252, 0.94);
}

[data-aipg-theme="light"] .filter-buttons {
  background: rgba(241, 245, 249, 0.9);
}

[data-aipg-theme="light"] .filter-btn:hover {
  background: rgba(15, 23, 42, 0.06);
  color: var(--aipg-text-primary);
}

[data-aipg-theme="light"] .aipg-advanced-filters {
  border-top-color: rgba(15, 23, 42, 0.1);
}

.prompt-image[data-loaded="false"] {
  filter: blur(14px);
  transform: scale(1.05);
}

.prompt-image[data-loaded="true"] {
  filter: blur(0);
}

.prompt-card:hover .prompt-image {
  transform: scale(1.08);
}

/* ===== ENHANCED BADGES ===== */
.prompt-badge {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 3;
  transition: all 0.3s ease;
}

.prompt-card:hover .prompt-badge {
  background: color-mix(in srgb, var(--aipg-accent-primary) 90%, transparent);
  border-color: color-mix(in srgb, var(--aipg-accent-primary) 50%, transparent);
}

.prompt-featured {
  position: absolute;
  top: 1rem;
  right: 1rem;
  color: var(--warning-color);
  font-size: 1.25rem;
  z-index: 3;
  filter: drop-shadow(0 2px 4px rgba(245, 158, 11, 0.4));
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0%, 100% { filter: drop-shadow(0 2px 4px rgba(245, 158, 11, 0.4)); }
  50% { filter: drop-shadow(0 2px 12px rgba(245, 158, 11, 0.7)); }
}

/* ===== ENHANCED ACTION BUTTONS ===== */
.prompt-actions {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 0.5rem;
  padding: 1.5rem;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
  z-index: 4;
}

.prompt-card:hover .prompt-actions {
  opacity: 1;
  transform: translateY(0);
}

.action-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  background: var(--aipg-accent-gradient);
  border: none;
  border-radius: 0.75rem;
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  position: relative;
  overflow: hidden;
}

.action-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.2) 100%);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--aipg-accent-primary) 40%, transparent);
}

.action-btn:hover::before {
  opacity: 1;
}

.action-btn:active {
  transform: translateY(0) scale(0.98);
}

.action-btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.action-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.1);
}

/* ===== ENHANCED CARD CONTENT ===== */
.prompt-content {
  padding: 1.5rem;
  position: relative;
  z-index: 3;
}

.prompt-title {
  color: var(--text-primary);
  display: -webkit-box;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 0.5rem;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.prompt-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.3s ease;
}

.prompt-card:hover .prompt-text {
  color: var(--text-primary);
}

/* Loading Spinner */
.loading-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 3rem;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--bg-card);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 2rem 0;
}

.page-btn {
  padding: 0.625rem 1rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 45px;
  text-align: center;
}

.page-btn:hover {
  border-color: var(--primary-color);
  color: var(--text-primary);
}

.page-btn.active {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Infinite Scroll UI */
.aipg-infinite-scroll-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 3rem 0;
  color: var(--aipg-text-secondary);
}

.aipg-infinite-scroll-status .spinner {
  display: none;
}

.aipg-infinite-scroll-status.is-loading .spinner {
  display: block;
}

.aipg-end-of-results {
  text-align: center;
  padding: 4rem 0;
  display: none;
}

.aipg-end-of-results.is-visible {
  display: block;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Footer */
.aipg-footer {
  background-color: var(--bg-dark);
  border-top: 1px solid var(--border-color);
  padding: 3rem 0 1.5rem;
  margin-top: 4rem;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-section h3,
.footer-section h4 {
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.footer-brand {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.footer-section p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.social-links {
  display: flex;
  gap: 1rem;
}

.social-links a {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-card);
  border-radius: 0.5rem;
  color: var(--text-secondary);
  transition: all 0.3s ease;
}

.social-links a:hover {
  background-color: var(--primary-color);
  color: white;
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 0.75rem;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.3s;
}

.footer-links a:hover {
  color: var(--primary-color);
}

.stats {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.stat-icon {
  font-size: 1.25rem;
}

.footer-bottom {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
}

.modal-content {
  background-color: var(--bg-dark);
  margin: 5% auto;
  padding: 2rem;
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  width: 90%;
  max-width: 800px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  font-size: 2rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.3s;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-image {
  width: 100%;
  border-radius: 0.75rem;
  margin-bottom: 1.5rem;
}

.modal-title {
  font-size: 1.75rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.modal-prompt {
  background-color: var(--bg-card);
  padding: 1.5rem;
  border-radius: 0.75rem;
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
  line-height: 1.8;
  font-size: 1rem;
}

.modal-actions {
  display: flex;
  gap: 1rem;
}

.modal-btn {
  flex: 1;
  padding: 1rem;
  background-color: var(--primary-color);
  border: none;
  border-radius: 0.5rem;
  color: white;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.3s;
}

.modal-btn:hover {
  background-color: var(--primary-dark);
}

/* Single Prompt Page Styles */
.aipg-single-content {
  padding: 2rem 0 4rem;
  min-height: 70vh;
}

.single-prompt-header {
  margin-bottom: 2rem;
}

.prompt-meta-info {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.prompt-number-badge {
  background: var(--aipg-accent-gradient);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.featured-badge {
  background-color: var(--warning-color);
  color: var(--bg-dark);
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
}

.views-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.single-prompt-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  line-height: 1.2;
}

.single-prompt-layout {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 2rem;
  margin-bottom: 3rem;
}

.prompt-image-section {
  position: sticky;
  top: 100px;
  height: fit-content;
}

.single-prompt-image {
  width: 100%;
  border-radius: 1rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.aipg-youtube-player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 1rem;
  background: #000;
}

.aipg-youtube-player iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.aipg-youtube-fallback {
  margin-top: 0.75rem;
  text-align: center;
}

.prompt-video-badge {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  z-index: 2;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(220, 38, 38, 0.9);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

.no-image-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  background-color: var(--bg-card);
  border-radius: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  gap: 1rem;
}

.prompts-details-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.prompts-section-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.prompt-detail-item {
  background-color: var(--bg-card);
  border-radius: 1rem;
  padding: 1.5rem;
  border: 1px solid var(--border-color);
}

.prompt-variation-header {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.prompt-variation-header h3 {
  font-size: 1.25rem;
  color: var(--primary-color);
  font-weight: 600;
}

.prompt-text-box {
  background-color: var(--bg-darker);
  padding: 1.5rem;
  border-radius: 0.75rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
}

.prompt-text-box p {
  color: var(--text-secondary);
  line-height: 1.8;
  font-size: 1rem;
}

.prompt-actions-centered {
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
}

.primary-copy {
  max-width: 200px;
  background: var(--aipg-accent-gradient) !important;
  border: none !important;
  font-weight: 600 !important;
  box-shadow: 0 4px 15px color-mix(in srgb, var(--aipg-accent-primary) 30%, transparent) !important;
}

.prompts-details-section .prompt-actions {
  display: flex;
  gap: 1rem;
}

.prompt-action-btn {
  flex: 1;
  padding: 0.875rem 1.5rem;
  background-color: var(--primary-color);
  border: none;
  border-radius: 0.5rem;
  color: white;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.prompt-action-btn:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
}

.prompt-action-btn.share-btn {
  background-color: var(--bg-dark);
  border: 1px solid var(--border-color);
}

.prompt-action-btn.share-btn:hover {
  background-color: var(--border-color);
}

.prompt-description-section {
  background-color: var(--bg-card);
  padding: 2rem;
  border-radius: 1rem;
  margin-bottom: 2rem;
  border: 1px solid var(--border-color);
}

.prompt-description-section h2 {
  font-size: 1.5rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.description-content {
  color: var(--text-secondary);
  line-height: 1.8;
  font-size: 1rem;
}

.back-to-gallery {
  text-align: center;
  margin-top: 3rem;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.back-btn:hover {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
  transform: translateX(-5px);
}

/* Update prompt card badge to show multiple prompts indicator */
.prompt-card .prompt-count-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background-color: var(--secondary-color);
  color: white;
  padding: 0.375rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
  .aipg-nav {
    flex-direction: column;
    gap: 1rem;
  }

  .aipg-menu {
    flex-wrap: wrap;
    justify-content: center;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .search-filter-wrapper {
    flex-direction: column;
  }

  /* Layout-specific responsive styles are in separate layout CSS files */

  .footer-content {
    grid-template-columns: 1fr;
  }

  /* Responsive single prompt page */
  .single-prompt-title {
    font-size: 1.75rem;
  }

  .single-prompt-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .prompt-image-section {
    position: static;
  }

  .prompts-details-section .prompt-actions {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .aipg-container {
    padding: 0 1rem;
  }

  /* Layout-specific responsive styles are in separate layout CSS files */
}

/* Accessibility Improvements - WCAG 2.1 Level AA Compliance */

/* Focus visible styles for keyboard navigation */
*:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .prompt-card,
  .prompt-card::before,
  .prompt-card::after,
  .prompt-image,
  .prompt-featured,
  .premium-placeholder,
  .prompt-card-skeleton .skeleton-image {
    animation: none !important;
    transition: none !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {

  .prompt-card,
  .modal-content,
  .header-content {
    border: 2px solid currentColor;
  }
}

/* Screen reader only text */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Related Prompts Section */
.aipg-related-section {
  background-color: var(--bg-dark);
  padding: 4rem 0;
  margin-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.related-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 2rem;
  color: var(--text-primary);
  text-align: center;
}

.related-prompts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.related-prompt-card {
  background-color: var(--bg-card);
  border-radius: 1rem;
  overflow: hidden;
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.related-prompt-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px color-mix(in srgb, var(--aipg-accent-primary) 20%, transparent);
  border-color: var(--primary-color);
}

.related-prompt-image {
  width: 100%;
  height: 200px;
  overflow: hidden;
  display: block;
  position: relative;
}

.related-prompt-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.related-prompt-card:hover .related-prompt-image img {
  transform: scale(1.05);
}

.related-prompt-content {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.related-prompt-number {
  display: inline-block;
  background: var(--aipg-accent-gradient);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 2rem;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  width: fit-content;
}

.related-prompt-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  flex: 1;
}

.related-prompt-title a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.3s ease;
}

.related-prompt-title a:hover {
  color: var(--primary-color);
}

.related-prompt-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: auto;
}

.related-prompt-meta svg {
  opacity: 0.7;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .related-prompts-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .related-title {
    font-size: 1.5rem;
  }

  .aipg-related-section {
    padding: 2rem 0;
  }
}

@media (max-width: 480px) {
  .related-prompt-image {
    height: 150px;
  }

  .related-prompt-content {
    padding: 1rem;
  }
}

/* ==========================================================================
   Favorite Button - Gallery Cards & Single Prompt
   ========================================================================== */

/* Small variant for gallery cards (icon only) */
.aipg-favorite-btn.aipg-favorite-btn-small {
  padding: 8px;
  border-radius: 50%;
  min-width: auto;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  color: #fff;
}

.aipg-favorite-btn.aipg-favorite-btn-small .aipg-heart-icon {
  width: 20px;
  height: 20px;
}

.aipg-favorite-btn.aipg-favorite-btn-small:hover {
  background: rgba(217, 48, 37, 0.8);
  color: #fff;
  transform: scale(1.1);
}

.aipg-favorite-btn.aipg-favorite-btn-small.aipg-favorited {
  background: rgba(217, 48, 37, 0.9);
  color: #fff;
}

.aipg-favorite-btn.aipg-favorite-btn-small.aipg-favorited .aipg-heart-icon {
  fill: #fff;
  stroke: #fff;
}

/* Favorite button in prompt-actions (gallery card hover overlay) */
.prompt-actions .aipg-favorite-btn {
  flex-shrink: 0;
}

/* Single prompt page - favorite button in meta info */
.prompt-meta-info .aipg-favorite-btn {
  vertical-align: middle;
  margin-left: 0.5rem;
}

body.aipg-single-prompt .single-prompt-header .prompt-meta-info .aipg-favorite-btn {
  align-items: center;
  align-self: center;
  background: color-mix(in srgb, var(--aipg-bg-card) 82%, transparent);
  border: 1px solid color-mix(in srgb, var(--aipg-border-color) 76%, transparent);
  border-radius: 999px;
  box-shadow: none;
  color: var(--aipg-text-secondary);
  display: inline-flex;
  flex-direction: row;
  font-size: 0.72rem;
  font-weight: 800;
  gap: 0.42rem;
  height: 2rem;
  letter-spacing: 0.08em;
  line-height: 1;
  margin: 0;
  min-height: 0;
  min-width: 0;
  padding: 0 0.78rem;
  text-transform: uppercase;
  transform: none;
  width: auto;
  white-space: nowrap;
}

body.aipg-single-prompt .single-prompt-header .prompt-meta-info .aipg-favorite-btn .aipg-heart-icon {
  flex: 0 0 auto;
  height: 1rem;
  transform: none;
  width: 1rem;
}

body.aipg-single-prompt .single-prompt-header .prompt-meta-info .aipg-favorite-btn:hover {
  background: color-mix(in srgb, var(--aipg-bg-card) 80%, var(--aipg-accent-primary) 20%);
  border-color: var(--aipg-accent-primary);
  color: var(--aipg-text-accent);
  transform: translateY(-1px);
}

body.aipg-single-prompt .single-prompt-header .prompt-meta-info .aipg-favorite-btn.aipg-favorited {
  background: color-mix(in srgb, var(--aipg-bg-card) 78%, #d93025 22%);
  border-color: #d93025;
  color: #ffb4aa;
}

body.aipg-single-prompt .single-prompt-header .prompt-meta-info .aipg-favorite-btn.aipg-favorited .aipg-heart-icon {
  fill: currentColor;
  stroke: currentColor;
}

/* Single prompt page - larger button style */
.single-prompt-header .aipg-favorite-btn {
  background: var(--aipg-bg-card);
  border: 1px solid var(--aipg-border-color);
  color: var(--aipg-text-secondary);
}

.single-prompt-header .aipg-favorite-btn:hover {
  border-color: #d93025;
  color: #d93025;
  background: var(--aipg-bg-card);
}

.single-prompt-header .aipg-favorite-btn.aipg-favorited {
  background: rgba(217, 48, 37, 0.15);
  border-color: #d93025;
  color: #d93025;
}

.single-prompt-header .aipg-favorite-btn.aipg-favorited .aipg-heart-icon {
  fill: #d93025;
}

/* Light theme adjustments */
[data-aipg-theme="light"] .aipg-favorite-btn.aipg-favorite-btn-small {
  background: rgba(255, 255, 255, 0.9);
  color: #5f6368;
  border: 1px solid #dadce0;
}

[data-aipg-theme="light"] .aipg-favorite-btn.aipg-favorite-btn-small:hover {
  background: #fce8e6;
  color: #d93025;
  border-color: #d93025;
}

[data-aipg-theme="light"] .aipg-favorite-btn.aipg-favorite-btn-small.aipg-favorited {
  background: #fce8e6;
  color: #d93025;
  border-color: #d93025;
}

[data-aipg-theme="light"] .aipg-favorite-btn.aipg-favorite-btn-small.aipg-favorited .aipg-heart-icon {
  fill: #d93025;
  stroke: #d93025;
}

[data-aipg-theme="light"] .single-prompt-header .aipg-favorite-btn {
  background: #fff;
  border: 1px solid #dadce0;
  color: #5f6368;
}

[data-aipg-theme="light"] .single-prompt-header .aipg-favorite-btn:hover {
  border-color: #d93025;
  color: #d93025;
}

[data-aipg-theme="light"] .single-prompt-header .aipg-favorite-btn.aipg-favorited {
  background: #fce8e6;
  border-color: #d93025;
  color: #d93025;
}

[data-aipg-theme="light"] body.aipg-single-prompt .single-prompt-header .prompt-meta-info .aipg-favorite-btn {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(15, 23, 42, 0.12);
  color: #475569;
}

/* Responsive adjustments for favorite button */
@media (max-width: 768px) {
  .prompt-meta-info .aipg-favorite-btn {
    display: inline-flex;
    margin-top: 0;
    margin-left: 0;
  }
}

/* Gallery feedback states */
.aipg-gallery-state {
  align-items: center;
  color: var(--aipg-text-secondary);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  grid-column: 1 / -1;
  justify-content: center;
  min-height: 260px;
  padding: 3rem 1.5rem;
  text-align: center;
  width: 100%;
}

.aipg-gallery-state h3 {
  color: var(--aipg-text-primary);
  font-size: 1.25rem;
}

.aipg-gallery-state .action-btn {
  flex: none;
  margin-top: 0.5rem;
}

.prompt-card-skeleton {
  background: var(--aipg-bg-card);
  border: 1px solid var(--aipg-border-color);
  border-radius: var(--aipg-radius-xl);
  overflow: hidden;
}

.skeleton-image,
.skeleton-content span {
  animation: skeleton-shimmer 1.5s infinite;
  background: linear-gradient(90deg, var(--aipg-bg-card) 25%, var(--aipg-border-color) 50%, var(--aipg-bg-card) 75%);
  background-size: 200% 100%;
}

.skeleton-image {
  aspect-ratio: 4 / 3;
}

.skeleton-content {
  display: grid;
  gap: 0.75rem;
  padding: 1.5rem;
}

.skeleton-content span {
  border-radius: var(--aipg-radius-full);
  display: block;
  height: 0.85rem;
}

.skeleton-content span:last-child {
  width: 70%;
}

@keyframes skeleton-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.prompt-card {
  animation: aipg-card-entrance 0.4s ease both;
}

[data-aipg-theme="light"] .prompt-card {
  background: var(--aipg-bg-card);
  border-color: var(--aipg-border-color);
}

@keyframes aipg-card-entrance {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.pagination {
  align-items: center;
  flex-wrap: wrap;
}

.pagination-ellipsis {
  color: var(--aipg-text-secondary);
  padding: 0 0.25rem;
}

.aipg-scroll-top {
  background: var(--aipg-accent-primary);
  border: 0;
  border-radius: var(--aipg-radius-full);
  bottom: 1.5rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  color: #fff;
  cursor: pointer;
  height: 44px;
  opacity: 0;
  pointer-events: none;
  position: fixed;
  right: 1.5rem;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  width: 44px;
  z-index: 900;
}

.aipg-scroll-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.prompts-grid {
  container-type: inline-size;
}

@container (max-width: 620px) {
  .prompt-card .prompt-content {
    padding: 1rem;
  }
}

@media (hover: none) {
  .prompt-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transform: none;
  }

  .prompt-card:hover::after {
    left: -100%;
  }

  .prompt-actions {
    opacity: 1;
    transform: translateY(0);
  }
}

@media print {
  .aipg-header,
  .aipg-footer,
  .prompt-actions,
  .filter-buttons,
  .aipg-search-section,
  .pagination,
  .aipg-mode-toggle,
  .aipg-scroll-top {
    display: none !important;
  }

  body.aipg-body {
    background: #fff;
    color: #000;
  }

  .single-prompt-layout {
    display: block;
  }

  .prompt-card {
    break-inside: avoid;
  }
}

/* Frontend interaction layer */
.aipg-result-tools,
.aipg-filter-chips,
.aipg-density-controls {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.aipg-result-tools {
  border-top: 1px solid var(--aipg-border-color);
  justify-content: flex-end;
  padding-top: 1rem;
}

.aipg-filter-chips {
  flex: 1;
}

.aipg-filter-chip,
.aipg-density-btn {
  background: var(--aipg-bg-sidebar);
  border: 1px solid var(--aipg-border-color);
  border-radius: var(--aipg-radius-full);
  color: var(--aipg-text-secondary);
  cursor: pointer;
  padding: 0.45rem 0.8rem;
}

.aipg-filter-chip:hover,
.aipg-density-btn[aria-pressed="true"] {
  border-color: var(--aipg-accent-primary);
  color: var(--aipg-text-primary);
}

.aipg-sort-select {
  max-width: 180px;
}

.aipg-sort-label {
  color: var(--aipg-text-secondary);
  font-size: 0.85rem;
  font-weight: 700;
}

.prompts-grid {
  contain: layout paint style;
}

.prompts-grid[data-density="compact"] {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.prompts-grid[data-density="compact"] .prompt-content {
  padding: 0.85rem;
}

.prompt-card {
  contain: content;
}

.prompt-image-wrapper {
  background: var(--aipg-bg-sidebar);
}

.prompt-image {
  transition: opacity 0.25s ease, transform 0.35s ease;
}

.prompt-image:not([data-loaded="true"]) {
  opacity: 0.35;
}

.aipg-image-failed {
  object-fit: cover;
  opacity: 0.9 !important;
}

.aipg-card-copy-btn.is-copied,
.copy-btn.is-copied {
  animation: aipg-copy-pulse 0.6s ease;
}

@keyframes aipg-copy-pulse {
  50% { transform: scale(1.08); }
}

.aipg-recently-viewed {
  border-top: 1px solid var(--aipg-border-color);
  margin: 3rem 0;
  padding-top: 2rem;
}

.aipg-recent-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  margin-top: 1rem;
}

.aipg-recent-card {
  background: var(--aipg-bg-card);
  border: 1px solid var(--aipg-border-color);
  border-radius: var(--aipg-radius-md);
  color: var(--aipg-text-primary);
  overflow: hidden;
  text-decoration: none;
}

.aipg-recent-card img {
  aspect-ratio: 4 / 3;
  display: block;
  object-fit: cover;
  width: 100%;
}

.aipg-recent-card span {
  display: block;
  padding: 0.75rem;
}

.aipg-mobile-menu-trigger {
  background: transparent;
  border: 1px solid var(--aipg-border-color);
  border-radius: var(--aipg-radius-sm);
  display: none;
  padding: 0.65rem;
}

.aipg-mobile-menu-trigger span {
  background: var(--aipg-text-primary);
  display: block;
  height: 2px;
  margin: 4px 0;
  width: 22px;
}

.aipg-mobile-menu {
  background: var(--aipg-bg-card);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.25);
  height: 100vh;
  padding: 4rem 1.25rem 1.25rem;
  position: fixed;
  right: 0;
  top: 0;
  transform: translateX(105%);
  transition: transform 0.2s ease;
  width: min(82vw, 320px);
  z-index: 1200;
}

.aipg-mobile-menu.is-open {
  transform: translateX(0);
}

.aipg-mobile-menu-close {
  background: transparent;
  border: 0;
  color: var(--aipg-text-primary);
  font-size: 2rem;
  position: absolute;
  right: 1rem;
  top: 0.75rem;
}

.aipg-mobile-menu .nav-link {
  margin-bottom: 0.5rem;
}

.aipg-toast-region {
  display: grid;
  gap: 0.6rem;
  position: fixed;
  right: 1rem;
  top: 1rem;
  z-index: 3000;
}

.aipg-toast,
.aipg-offline-state {
  background: var(--aipg-bg-card);
  border: 1px solid var(--aipg-border-color);
  border-left: 4px solid var(--success-color);
  border-radius: var(--aipg-radius-sm);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
  color: var(--aipg-text-primary);
  padding: 0.75rem 1rem;
}

.aipg-toast button {
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  margin-left: 1rem;
}

.aipg-toast-error,
.aipg-offline-state {
  border-left-color: var(--warning-color);
}

.aipg-offline-state {
  bottom: 1rem;
  left: 50%;
  position: fixed;
  transform: translateX(-50%);
  z-index: 2500;
}

.aipg-single-pagination {
  align-items: center;
  background: color-mix(in srgb, var(--aipg-bg-card) 92%, transparent);
  border: 1px solid var(--aipg-border-color);
  border-radius: var(--aipg-radius-full);
  bottom: 1rem;
  display: flex;
  gap: 0.65rem;
  left: 50%;
  padding: 0.55rem;
  position: fixed;
  transform: translateX(-50%);
  z-index: 1100;
}

.aipg-single-pagination {
  bottom: 5.4rem;
  justify-content: space-between;
  max-width: 780px;
  position: fixed;
  width: calc(100% - 2rem);
}

.aipg-single-pagination a {
  color: var(--aipg-text-primary);
  overflow: hidden;
  padding: 0.55rem 0.85rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--aipg-text-accent);
  outline-offset: 3px;
}

@media (max-width: 768px) {
  .aipg-menu {
    display: none;
  }

  .aipg-mobile-menu-trigger {
    display: block;
  }

  .aipg-result-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .aipg-sort-select {
    max-width: none;
  }

  .aipg-mobile-filter-trigger {
    bottom: 1rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    position: fixed;
    right: 1rem;
    z-index: 950;
    display: inline-flex;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* Cinematic single prompt detail */
.aipg-single-prompt .aipg-single-content {
  min-height: 70vh;
  padding: 2.75rem 0 4rem;
  position: relative;
}

.aipg-single-prompt .aipg-single-content::before {
  background:
    radial-gradient(circle at 18% 5%, color-mix(in srgb, var(--aipg-accent-primary) 18%, transparent), transparent 28rem),
    radial-gradient(circle at 84% 16%, color-mix(in srgb, var(--aipg-text-accent) 12%, transparent), transparent 32rem);
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.aipg-single-prompt .aipg-single-content > .aipg-container {
  position: relative;
  z-index: 1;
}

.aipg-single-prompt .single-prompt-header {
  margin-bottom: 2.25rem;
  max-width: 980px;
}

.aipg-single-prompt .prompt-number-badge {
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.45rem 0.8rem;
}

.aipg-single-prompt .single-prompt-title {
  font-size: clamp(2.1rem, 4vw, 3.85rem);
  font-weight: 800;
  letter-spacing: -0.055em;
  line-height: 1.05;
  margin-bottom: 0;
}

.aipg-single-prompt .single-prompt-layout {
  gap: clamp(1.5rem, 3vw, 2.5rem);
  grid-template-columns: minmax(0, 1.58fr) minmax(340px, 1fr);
  margin-bottom: 2.5rem;
}

.aipg-single-prompt .prompt-image-section {
  top: 112px;
}

.aipg-single-prompt .aipg-single-media-frame {
  align-items: center;
  background:
    radial-gradient(circle at 18% 12%, color-mix(in srgb, var(--aipg-accent-primary) 20%, transparent), transparent 36%),
    radial-gradient(circle at 84% 86%, color-mix(in srgb, var(--aipg-text-accent) 14%, transparent), transparent 42%),
    color-mix(in srgb, var(--aipg-bg-card) 94%, #000 6%);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 1.35rem;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  display: flex;
  justify-content: center;
  overflow: hidden;
  padding: clamp(0.55rem, 1.2vw, 0.9rem);
  position: relative;
}

.aipg-single-prompt .single-prompt-image {
  border-radius: 0.95rem;
  display: block;
  height: auto;
  max-height: min(70vh, 720px);
  max-width: 100%;
  object-fit: contain;
  width: auto;
}

.aipg-single-prompt .aipg-youtube-player {
  background: var(--aipg-bg-card);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 1.35rem;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  display: block;
}

.prompt-panel-intro {
  margin-bottom: 0.25rem;
}

.prompt-panel-eyebrow,
.prompt-variation-kicker {
  color: var(--aipg-text-accent);
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.prompt-panel-intro h2 {
  color: var(--aipg-text-primary);
  font-size: 1.45rem;
  letter-spacing: -0.025em;
  margin: 0.25rem 0 0.35rem;
}

.prompt-panel-intro p {
  color: var(--aipg-text-secondary);
  font-size: 0.9rem;
}

.aipg-single-prompt .prompt-detail-item {
  background: linear-gradient(145deg, color-mix(in srgb, var(--aipg-bg-card) 92%, #fff 8%), var(--aipg-bg-card)) !important;
  border: 1px solid color-mix(in srgb, var(--aipg-border-color) 78%, transparent) !important;
  border-radius: 1.3rem;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.2);
  padding: 1rem;
}

.aipg-single-prompt .prompt-variation-header {
  align-items: center;
  border: 0;
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.8rem;
  padding: 0.2rem 0.25rem;
}

.prompt-variation-number {
  align-items: center;
  background: color-mix(in srgb, var(--aipg-accent-primary) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--aipg-accent-primary) 34%, transparent);
  border-radius: 999px;
  color: var(--aipg-text-accent);
  display: inline-flex;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  min-height: 1.85rem;
  padding: 0.25rem 0.65rem;
}

.aipg-single-prompt .prompt-taxonomy-info .tax-badge {
  border: 1px solid color-mix(in srgb, var(--aipg-border-color) 78%, transparent);
  border-radius: 999px;
  color: var(--aipg-text-secondary);
  font-size: 0.85rem;
  padding: 4px 12px;
}

.aipg-single-prompt .prompt-taxonomy-info .model-badge {
  background: color-mix(in srgb, var(--aipg-accent-primary) 13%, transparent);
  border-color: color-mix(in srgb, var(--aipg-accent-primary) 36%, transparent);
  color: var(--aipg-text-accent);
}

.aipg-single-prompt .prompt-taxonomy-info .category-badge {
  background: color-mix(in srgb, var(--aipg-bg-card) 72%, var(--aipg-accent-primary) 12%);
  border-color: color-mix(in srgb, var(--aipg-border-color) 84%, transparent);
  color: var(--aipg-text-primary);
}

.aipg-single-prompt .prompt-taxonomy-info .tag-badge {
  background: color-mix(in srgb, var(--aipg-bg-sidebar) 78%, transparent);
}

.aipg-single-prompt .prompt-text-box {
  background: color-mix(in srgb, var(--aipg-bg-sidebar) 88%, transparent) !important;
  border: 1px solid color-mix(in srgb, var(--aipg-border-color) 64%, transparent) !important;
  border-radius: 0.95rem;
  margin-bottom: 0;
  padding: 1.25rem;
}

.aipg-single-prompt .prompt-actions-centered {
  justify-content: stretch;
  margin-top: 0.85rem;
}

.aipg-single-prompt .primary-copy {
  max-width: none;
  width: 100%;
}

.aipg-single-prompt .prompt-description-section {
  background: linear-gradient(145deg, color-mix(in srgb, var(--aipg-bg-card) 94%, #fff 6%), var(--aipg-bg-card));
  border: 1px solid color-mix(in srgb, var(--aipg-border-color) 78%, transparent);
  border-radius: 1.3rem;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.14);
  padding: clamp(1.4rem, 3vw, 2.25rem);
}

.aipg-single-pagination {
  align-items: stretch;
  background: transparent;
  border: 0;
  border-radius: 0;
  bottom: auto;
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  left: auto;
  margin: 2.5rem auto 0;
  max-width: var(--aipg-max-width, 1400px);
  padding: 0 2rem;
  position: static;
  transform: none;
  width: 100%;
  z-index: auto;
}

.aipg-single-content .aipg-single-pagination {
  padding: 0;
}

.aipg-single-pagination a {
  background: color-mix(in srgb, var(--aipg-bg-card) 90%, transparent);
  border: 1px solid var(--aipg-border-color);
  border-radius: 1rem;
  color: var(--aipg-text-primary);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-height: 5.5rem;
  overflow: hidden;
  padding: 1rem 1.15rem;
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
}

.aipg-single-pagination-next {
  align-items: flex-end;
  grid-column: 2;
  text-align: right;
}

.aipg-single-pagination a:hover {
  background: color-mix(in srgb, var(--aipg-bg-card) 82%, var(--aipg-accent-primary) 18%);
  border-color: var(--aipg-accent-primary);
  transform: translateY(-2px);
}

.aipg-single-pagination-direction {
  color: var(--aipg-text-accent);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.aipg-single-pagination-title {
  font-size: 0.94rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.aipg-single-prompt .back-btn {
  border-radius: 999px;
}

@media (max-width: 960px) {
  .aipg-single-prompt .single-prompt-layout {
    grid-template-columns: 1fr;
  }

  .aipg-single-prompt .prompt-image-section {
    position: static;
  }
}

@media (max-width: 768px) {
  .aipg-single-prompt .aipg-single-media-frame {
    padding: 0.5rem;
  }

  .aipg-single-prompt .single-prompt-image {
    max-height: min(55vh, 460px);
  }

  .aipg-single-pagination {
    gap: 0.65rem;
    padding: 0 1rem;
  }

  .aipg-single-content .aipg-single-pagination {
    padding: 0;
  }
}

@media (max-width: 520px) {
  .aipg-single-pagination {
    grid-template-columns: 1fr;
  }

  .aipg-single-pagination-next {
    grid-column: 1;
  }
}
