/* ============================================================
   PROMPT LIBRARY — SIDEBAR LAYOUT
   Replaces all horizontal chip/cat-tab behaviour on desktop/tablet.
   Mobile keeps the bottom-sheet drawer.
   ============================================================ */

/* ── Page shell ── */
#page-prompts {
  padding: 0 !important;
}

/* ── Prompt type tabs (Text / Image) — always at the top ── */
.prompt-type-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 60px;
  z-index: 40;
}
.prompt-type-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}
.prompt-type-btn.active,
.prompt-type-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ── Main two-column wrapper ── */
.prompts-layout {
  display: flex;
  align-items: flex-start;
  min-height: calc(100vh - 120px);
}

/* ═══════════════════════════════════════════════
   LEFT SIDEBAR — UPGRADED & PREMIUM
═══════════════════════════════════════════════ */
.prompts-sidebar {
  width: 280px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 113px;               /* topbar (60) + type-bar (~53) */
  height: calc(100vh - 113px);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  padding: 12px 0;
}
.prompts-sidebar::-webkit-scrollbar { width: 4px; }
.prompts-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar-heading {
  padding: 12px 24px 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.8;
}

.sidebar-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 24px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  user-select: none;
  margin: 2px 0;
}

/* Hover effects */
.sidebar-nav-item:hover {
  background: rgba(91, 76, 255, 0.04);
  color: var(--text);
  padding-left: 28px; /* subtle slide-in feel */
}

.sidebar-nav-item:hover .sidebar-nav-icon {
  transform: scale(1.18);
  filter: drop-shadow(0 2px 6px rgba(91, 76, 255, 0.25));
}

/* Selected Category left accent indicator & states */
.sidebar-nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 15%;
  height: 70%;
  width: 4px;
  background: linear-gradient(180deg, var(--primary), #8b5cf6);
  border-radius: 0 4px 4px 0;
  opacity: 0;
  transform: scaleY(0.3);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sidebar-nav-item.active {
  background: linear-gradient(90deg, rgba(91, 76, 255, 0.08) 0%, rgba(124, 58, 237, 0.02) 100%);
  color: var(--primary);
  font-weight: 700;
}

.sidebar-nav-item.active::before {
  opacity: 1;
  transform: scaleY(1);
}

.sidebar-nav-item.active .sidebar-nav-icon {
  transform: scale(1.15);
  filter: drop-shadow(0 2px 8px rgba(91, 76, 255, 0.3));
}

.sidebar-nav-icon {
  font-size: 20px; /* Larger icons */
  width: 26px;
  text-align: center;
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.2s ease;
}

.sidebar-nav-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.sidebar-nav-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: 12px;
  flex-shrink: 0;
  transition: all 0.2s ease;
  border: 1px solid var(--border);
}

.sidebar-nav-item:hover .sidebar-nav-count {
  border-color: rgba(91, 76, 255, 0.2);
  color: var(--text);
}

.sidebar-nav-item.active .sidebar-nav-count {
  background: rgba(91, 76, 255, 0.15);
  color: var(--primary);
  border-color: rgba(91, 76, 255, 0.25);
  transform: scale(1.05);
}

/* ═══════════════════════════════════════════════
   RIGHT CONTENT AREA
═══════════════════════════════════════════════ */
.prompts-main {
  flex: 1;
  min-width: 0;
  padding: 20px 24px 40px;
}

.prompts-main-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.prompts-main-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  flex: 1;
  min-width: 160px;
}
.prompts-search-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
  height: 38px;
  min-width: 220px;
  max-width: 320px;
  flex: 1;
  transition: border-color .2s;
}
.prompts-search-inline:focus-within {
  border-color: var(--primary);
  background: var(--surface);
}
.prompts-search-inline svg { flex-shrink: 0; color: var(--muted); }
.prompts-search-inline input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--text);
}
.prompts-search-inline input::placeholder { color: var(--muted); }

/* ═══════════════════════════════════════════════
   TABLET — slide-out filter panel
═══════════════════════════════════════════════ */
@media (min-width: 768px) and (max-width: 1023px) {
  .prompts-sidebar {
    position: fixed;
    left: -280px;
    top: 60px;
    height: calc(100vh - 60px);
    z-index: 200;
    width: 280px;
    border-right: 1px solid var(--border);
    box-shadow: 4px 0 24px rgba(0,0,0,.12);
    transition: left .3s cubic-bezier(.4,0,.2,1);
  }
  .prompts-sidebar.open {
    left: 0;
  }
  .prompts-layout {
    flex-direction: column;
  }
  .prompts-main {
    padding: 16px 20px 40px;
    width: 100%;
  }
  .tablet-filter-btn {
    display: inline-flex !important;
  }
  .sidebar-overlay {
    display: block !important;
  }
}

/* tablet filter toggle button */
.tablet-filter-btn {
  display: none;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}
.tablet-filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* sidebar overlay for tablet */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 199;
}

/* ═══════════════════════════════════════════════
   MOBILE — bottom sheet drawer
═══════════════════════════════════════════════ */
@media (max-width: 767px) {
  .prompts-sidebar {
    /* hidden off-screen, becomes bottom sheet */
    position: fixed;
    left: 0;
    right: 0;
    bottom: -100%;
    top: auto;
    width: 100%;
    height: auto;
    max-height: 70vh;
    border-right: none;
    border-top: 1px solid var(--border);
    border-radius: 20px 20px 0 0;
    z-index: 300;
    transition: bottom .3s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 -8px 40px rgba(0,0,0,.18);
  }
  .prompts-sidebar.open {
    bottom: 0;
  }
  .prompts-layout {
    flex-direction: column;
  }
  .prompts-main {
    padding: 12px 16px 100px;
    width: 100%;
  }
  .mobile-filter-btn {
    display: inline-flex !important;
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 299;
  }
  .sidebar-overlay.open {
    display: block;
  }
  /* drag handle */
  .sidebar-handle {
    display: block !important;
  }
  .prompts-main-header {
    flex-wrap: wrap;
    gap: 8px;
  }
  .prompts-search-inline {
    min-width: 100%;
    order: 3;
  }
  .prompts-main-title {
    font-size: 15px;
  }
}

/* mobile filter button */
.mobile-filter-btn {
  display: none;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* drag handle visual */
.sidebar-handle {
  display: none;
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 10px auto 4px;
}

/* ═══════════════════════════════════════════════
   HIDE OLD chip/cat-tab rows completely
═══════════════════════════════════════════════ */
#page-prompts .cat-tabs,
#page-prompts .prompts-search-bar:not(.prompts-search-inline),
#promptCatTabs,
#imgPromptCatTabs {
  display: none !important;
}

/* ═══════════════════════════════════════════════
   IMAGE PROMPTS — sidebar view (reuses same layout)
═══════════════════════════════════════════════ */
.img-prompts-header .cat-tabs { display: none !important; }

/* ═══════════════════════════════════════════════
   DARK THEME ADJUSTMENTS
═══════════════════════════════════════════════ */
.dark-theme .prompts-sidebar {
  background: var(--surface);
  border-right-color: var(--border);
}
.dark-theme .sidebar-nav-item.active {
  background: rgba(91, 76, 255, .15);
}

/* ═══════════════════════════════════════════════
   DESKTOP — full sidebar always visible
═══════════════════════════════════════════════ */
@media (min-width: 1024px) {
  .prompt-type-bar {
    padding: 20px 32px 14px;
    top: 76px; /* offset for redesigned taller header */
  }
  .prompts-sidebar {
    width: 280px;
    top: 137px; /* 76px + 61px */
    height: calc(100vh - 137px);
  }
  .prompts-main {
    padding: 24px 32px 48px;
  }
  .prompts-main-title {
    font-size: 20px;
  }
  .prompts-search-inline {
    min-width: 260px;
  }
}
@media (min-width: 1280px) {
  .prompts-sidebar {
    width: 280px;
  }
  .prompts-main {
    padding: 28px 40px 56px;
  }
}

/* ═══════════════════════════════════════════════
   PREMIUM PROMPT CARD REDESIGNS
═══════════════════════════════════════════════ */

/* Grid Alignments */
#promptsGrid, #imgPromptsGrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
@media (min-width: 640px) {
  #promptsGrid, #imgPromptsGrid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 1200px) {
  #promptsGrid, #imgPromptsGrid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ── Text Prompt Cards ── */
.prompt-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  min-height: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.01);
  cursor: pointer;
}

.prompt-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary-light);
  box-shadow: 0 12px 30px rgba(91, 76, 255, 0.08);
}

.prompt-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.prompt-platform {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.prompt-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.prompt-copy-btn, .prompt-bookmark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 14px;
  transition: all 0.2s ease;
}

.prompt-copy-btn:hover, .prompt-bookmark:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  transform: scale(1.1);
}

.prompt-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 48px;
}

.prompt-cat-tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 16px;
}

.prompt-difficulty {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}


/* ── Pinterest-style Image Prompt Cards ── */
#imgPromptsGrid {
  column-count: 1;
  column-gap: 28px;
  display: block; /* Overrides the grid so masonry works */
}

@media (min-width: 640px) {
  #imgPromptsGrid {
    column-count: 2;
  }
}

@media (min-width: 1200px) {
  #imgPromptsGrid {
    column-count: 3;
  }
}

.img-prompt-card {
  position: relative;
  display: inline-block; /* Crucial for masonry column wrapping */
  width: 100%;
  margin-bottom: 28px; /* Pinterest style spacing */
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px; /* More rounded Pinterest feel */
  overflow: hidden;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.3s ease;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.02);
  cursor: pointer;
  break-inside: avoid; /* Prevents card from splitting across columns */
}

.img-prompt-card:hover {
  transform: translateY(-6px);
  border-color: var(--primary-light);
  box-shadow: 0 20px 40px rgba(91, 76, 255, 0.12);
}

/* Larger Pinterest Preview Images */
.img-prompt-preview {
  height: auto; /* Variable aspect heights for masonry look */
  min-height: 200px;
  max-height: 480px;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.img-prompt-preview img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.img-prompt-card:hover .img-prompt-preview img {
  transform: scale(1.06);
}

.img-prompt-tool-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  background: rgba(15, 23, 42, 0.75);
  color: #ffffff;
  padding: 5px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 2;
}

.img-prompt-style {
  position: absolute;
  bottom: 16px;
  left: 16px;
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  padding: 5px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  z-index: 2;
}

.dark-theme .img-prompt-style {
  background: rgba(30, 41, 59, 0.92);
  color: #f3f4f6;
}

/* More spacious Content Box */
.img-prompt-info {
  padding: 24px 28px 28px; /* Increased padding */
  display: flex;
  flex-direction: column;
}

.img-prompt-title {
  font-size: 19px; /* Enhanced typography */
  font-weight: 800;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.img-prompt-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.img-prompt-cat {
  color: var(--primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.img-prompt-preview-text {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 24px;
  display: -webkit-box;
  -webkit-line-clamp: 3; /* More text room for description */
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: auto;
  max-height: 64px;
}

/* Prominent Copy Button */
.img-prompt-copy-btn {
  width: 100%;
  height: 44px;
  border: none;
  outline: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(91, 76, 255, 0.2);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.img-prompt-copy-btn:hover {
  background: linear-gradient(135deg, #4f3fff 0%, #7c3aed 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(91, 76, 255, 0.3);
}

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