/* ============================================
   Prompt Manager Styles - EasyLife Theme
   ============================================ */

[hidden] { display: none !important; }

/* ---- CSS Variables (reuse Easylife tokens) ---- */
:root {
  --pm-surface-bg: rgba(12, 16, 28, 0.72);
  --pm-surface-border: rgba(255, 255, 255, 0.16);
  --pm-surface-shadow: 0 28px 65px rgba(5, 7, 12, 0.55);
  --pm-text-primary: rgba(255, 255, 255, 0.96);
  --pm-text-secondary: rgba(255, 255, 255, 0.72);
  --pm-accent: #4ade80;
  --pm-accent-soft: rgba(74, 222, 128, 0.18);
  --pm-danger: #fb7185;
  --pm-danger-soft: rgba(251, 113, 133, 0.18);
  --pm-muted-border: rgba(255, 255, 255, 0.12);
  --pm-card-bg: linear-gradient(145deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  --pm-card-border: rgba(255, 255, 255, 0.16);
  --pm-card-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  --pm-card-solid-bg: rgb(24, 29, 44);
  --pm-fade-solid: rgb(24, 29, 44);
  --pm-fade-85: rgba(24, 29, 44, 0.85);
  --pm-fade-50: rgba(24, 29, 44, 0.5);
  --pm-fade-20: rgba(24, 29, 44, 0.2);
  --pm-input-bg: rgba(255, 255, 255, 0.06);
  --pm-input-border: rgba(255, 255, 255, 0.16);
  --pm-input-text: rgba(255, 255, 255, 0.96);
  --pm-input-placeholder: rgba(255, 255, 255, 0.4);
  --pm-line-color: rgba(74, 222, 128, 0.08);
  --pm-topbar-bg: rgba(0, 0, 0, 0.4);
}

:root[data-theme='light'] {
  --pm-surface-bg: rgba(255, 255, 255, 0.18);
  --pm-surface-border: rgba(148, 163, 184, 0.28);
  --pm-surface-shadow: none;
  --pm-text-primary: rgba(255, 255, 255, 0.94);
  --pm-text-secondary: rgba(255, 255, 255, 0.72);
  --pm-muted-border: rgba(148, 163, 184, 0.24);
  --pm-card-bg: linear-gradient(145deg, rgba(15, 23, 42, 0.06), rgba(15, 23, 42, 0.02));
  --pm-card-border: rgba(148, 163, 184, 0.3);
  --pm-card-shadow: 0 12px 28px rgba(148, 163, 184, 0.18);
  --pm-card-solid-bg: rgb(245, 247, 250);
  --pm-fade-solid: rgb(245, 247, 250);
  --pm-fade-85: rgba(245, 247, 250, 0.85);
  --pm-fade-50: rgba(245, 247, 250, 0.5);
  --pm-fade-20: rgba(245, 247, 250, 0.2);
  --pm-input-bg: rgba(15, 23, 42, 0.04);
  --pm-input-border: rgba(15, 23, 42, 0.16);
  --pm-input-text: rgba(255, 255, 255, 0.94);
  --pm-input-placeholder: rgba(255, 255, 255, 0.5);
  --pm-line-color: rgba(74, 222, 128, 0.06);
  --pm-topbar-bg: rgba(230, 235, 245, 0.6);
}

/* ---- Page Layout ---- */
.prompts-main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  overflow-x: hidden;
}

/* ---- Floating Lines Background Canvas ---- */
.prompts-bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ---- Header ---- */
.prompts-header {
  padding: 24px 32px 16px;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.prompts-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.prompts-header h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--pm-text-primary);
  margin: 0;
}

.prompts-header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  justify-content: flex-end;
}

/* Reuse inbox category toggle + back button styles */
.prompts-page .category-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 12px;
  background: var(--control-bg);
  border: 1px solid var(--control-border);
  color: var(--pm-text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(12px);
}

.prompts-page .category-toggle:hover {
  background: var(--control-hover-bg);
  border-color: var(--control-hover-border);
  transform: translateY(-1px);
}

/* ---- Google-inspired Search Section ---- */
.prompts-search-section {
  padding: 0 32px;
  margin-bottom: 24px;
  position: relative;
  z-index: 2;
}

.prompts-search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 640px;
  margin: 0 auto;
  background: var(--pm-surface-bg);
  backdrop-filter: blur(26px);
  border: 1px solid var(--pm-surface-border);
  border-radius: 28px;
  padding: 10px 16px;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.prompts-search-box:focus-within {
  border-color: var(--pm-accent);
  box-shadow: 0 0 0 3px var(--pm-accent-soft);
}

.prompts-search-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--pm-text-secondary);
}

.prompts-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--pm-input-text);
  font-size: 1rem;
  font-family: inherit;
}

.prompts-search-input::placeholder {
  color: var(--pm-input-placeholder);
}

.prompts-add-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--pm-accent);
  background: var(--pm-accent-soft);
  color: var(--pm-accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 180ms ease;
  flex-shrink: 0;
}

.prompts-add-btn:hover {
  background: var(--pm-accent);
  color: #05070c;
  transform: scale(1.08);
}

.prompts-add-btn svg {
  width: 18px;
  height: 18px;
}

.prompts-add-btn--large {
  width: auto;
  height: auto;
  border-radius: 16px;
  padding: 12px 24px;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
}

/* ---- Prompts Grid (Tiles) ---- */
.prompts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  padding: 0 32px 40px;
  position: relative;
  z-index: 2;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

/* ---- Prompt Tile Card (rutiner.html style) ---- */
.prompt-tile {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
  background: var(--pm-card-solid-bg);
  border: 1px solid var(--pm-card-border);
  box-shadow: var(--pm-card-shadow);
  min-height: 64px;
  display: flex;
  align-items: center;
}

.prompt-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

/* Tile image (fade-right, like rutiner recommended cards) */
.prompt-tile__image {
  position: absolute;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

.prompt-tile__image::before {
  content: '';
  position: absolute;
  top: 0;
  left: -20%;
  width: 70%;
  height: 100%;
  background: linear-gradient(
    to right,
    var(--pm-fade-solid) 0%,
    var(--pm-fade-85) 25%,
    var(--pm-fade-50) 50%,
    var(--pm-fade-20) 75%,
    transparent 100%
  );
  z-index: 2;
}

.prompt-tile__image::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    to right,
    var(--pm-fade-solid) 0%,
    var(--pm-fade-85) 40%,
    var(--pm-fade-50) 70%,
    transparent 100%
  );
  z-index: 3;
}

.prompt-tile__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border-radius: 0 15px 15px 0;
}

/* Tile content overlay (sits above image) */
.prompt-tile__content {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 4;
  flex: 1;
  min-width: 0;
}

.prompt-tile__info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.prompt-tile__name {
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.35;
  color: var(--pm-text-primary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prompt-tile__meta {
  font-size: 0.85rem;
  color: var(--pm-text-secondary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Tile action buttons ---- */
.prompt-tile__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  flex-shrink: 0;
}

.prompt-tile__action-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  color: var(--pm-text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 160ms ease;
}

.prompt-tile__action-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: var(--pm-text-primary);
  border-color: rgba(255, 255, 255, 0.28);
}

.prompt-tile__action-btn svg {
  width: 16px;
  height: 16px;
}

/* ---- Send-to dropdown (ChatGPT / Claude / Google) ---- */
.prompt-tile__send-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--pm-surface-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--pm-surface-border);
  border-radius: 14px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 170px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
  z-index: 100;
  opacity: 0;
  transform: translateY(-4px) scale(0.96);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.prompt-tile__send-dropdown.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.prompt-tile__send-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--pm-text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  border-radius: 10px;
  cursor: pointer;
  transition: background 140ms ease;
  white-space: nowrap;
}

.prompt-tile__send-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.prompt-tile__send-option img {
  width: 20px;
  height: 20px;
  border-radius: 4px;
}

/* ---- Empty State ---- */
.prompts-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 64px 32px;
  position: relative;
  z-index: 2;
}

.prompts-empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.6;
}

.prompts-empty h3 {
  color: var(--pm-text-primary);
  margin: 0 0 8px;
  font-size: 1.25rem;
}

.prompts-empty p {
  color: var(--pm-text-secondary);
  margin: 0 0 24px;
  font-size: 0.95rem;
}

/* ============================================
   EDITOR VIEW — Redesigned single-column layout
   ============================================ */
.prompts-editor-view {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  z-index: 2;
}

/* ---- Sticky top bar ---- */
.prompts-editor-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 32px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--pm-topbar-bg);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--pm-muted-border);
  flex-shrink: 0;
}

.prompts-editor-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 12px;
  background: var(--control-bg);
  border: 1px solid var(--control-border);
  color: var(--pm-text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(12px);
  text-decoration: none;
}

.prompts-editor-back:hover {
  background: var(--control-hover-bg);
  border-color: var(--control-hover-border);
  transform: translateY(-1px);
}

.prompts-editor-back svg {
  width: 18px;
  height: 18px;
}

.prompts-editor-topbar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--pm-text-secondary);
  opacity: 0;
  transition: opacity 300ms ease;
}

.prompts-editor-topbar-status.is-visible {
  opacity: 1;
}

.prompts-editor-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pm-accent);
  flex-shrink: 0;
}

/* ---- Scrollable editor area ---- */
.prompts-editor-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 32px 60px;
}

.prompts-editor-container {
  max-width: 780px;
  margin: 0 auto;
  width: 100%;
}

/* ---- Hero image ---- */
.prompts-editor-hero {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  margin-top: 24px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--pm-muted-border);
}

.prompts-editor-hero img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.prompts-editor-hero-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
}

.prompts-editor-hero-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 160ms ease;
}

.prompts-editor-hero-btn:hover {
  background: var(--pm-danger);
  border-color: var(--pm-danger);
}

.prompts-editor-hero-btn svg {
  width: 16px;
  height: 16px;
}

/* ---- Title (Notion-style) ---- */
.prompts-editor-title-area {
  margin-top: 28px;
  padding: 0 4px;
}

.prompts-editor-title-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--pm-text-primary);
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  font-weight: 700;
  font-family: inherit;
  padding: 8px 0;
  line-height: 1.3;
  transition: color 200ms ease;
}

.prompts-editor-title-input::placeholder {
  color: var(--pm-input-placeholder);
}

/* ---- Metadata strip ---- */
.prompts-editor-meta-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--pm-muted-border);
}

.prompts-editor-meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--pm-text-secondary);
  font-size: 0.85rem;
}

.prompts-editor-meta-item svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: 0.6;
}

.prompts-editor-meta-sep {
  width: 1px;
  height: 16px;
  background: var(--pm-muted-border);
  flex-shrink: 0;
}

.prompts-editor-meta-date {
  font-size: 0.8rem;
  opacity: 0.7;
}

.prompts-editor-category {
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--pm-input-bg);
  border: 1px solid var(--pm-input-border);
  color: var(--pm-input-text);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: border-color 200ms ease;
}

.prompts-editor-category:focus {
  border-color: var(--pm-accent);
}

.prompts-editor-category option {
  background: #1a1f30;
  color: #fff;
}

/* ---- Content card ---- */
.prompts-editor-content-card {
  background: var(--pm-surface-bg);
  backdrop-filter: blur(22px);
  border: 1px solid var(--pm-surface-border);
  border-radius: 16px;
  overflow: hidden;
  transition: border-color 200ms ease;
}

.prompts-editor-content-card:focus-within {
  border-color: var(--pm-accent);
}

.prompts-editor-textarea {
  width: 100%;
  min-height: 320px;
  background: transparent;
  border: none;
  padding: 24px 28px;
  color: var(--pm-input-text);
  font-size: 1rem;
  font-family: inherit;
  line-height: 1.75;
  resize: vertical;
  outline: none;
  display: block;
}

.prompts-editor-textarea::placeholder {
  color: var(--pm-input-placeholder);
}

.prompts-editor-content-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 8px 20px;
  border-top: 1px solid var(--pm-muted-border);
}

.prompts-editor-char-count {
  font-size: 0.75rem;
  color: var(--pm-text-secondary);
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
}

/* ---- Action toolbar ---- */
.prompts-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 0;
  margin-top: 4px;
  flex-wrap: wrap;
}

.prompts-editor-toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.prompts-editor-toolbar-sep {
  width: 1px;
  height: 24px;
  background: var(--pm-muted-border);
  flex-shrink: 0;
  margin: 0 4px;
}

.prompts-editor-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--pm-muted-border);
  color: var(--pm-text-secondary);
  font-size: 0.83rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 160ms ease;
  white-space: nowrap;
}

.prompts-editor-tool-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--pm-text-primary);
  border-color: rgba(255, 255, 255, 0.24);
  transform: translateY(-1px);
}

.prompts-editor-tool-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.prompts-editor-tool-chevron {
  width: 12px !important;
  height: 12px !important;
  opacity: 0.5;
  margin-left: -2px;
}

.prompts-editor-tool-btn--ai {
  border-color: var(--pm-accent);
  color: var(--pm-accent);
  background: var(--pm-accent-soft);
}

.prompts-editor-tool-btn--ai:hover {
  background: var(--pm-accent);
  color: #05070c;
}

/* Send-to dropdown in toolbar */
.prompts-editor-send-wrapper {
  position: relative;
}

.prompts-editor-send-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--pm-surface-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--pm-surface-border);
  border-radius: 12px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 180px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
  z-index: 100;
  opacity: 0;
  transform: translateY(-4px) scale(0.96);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.prompts-editor-send-dropdown.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.prompts-editor-send-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border: none;
  background: transparent;
  color: var(--pm-text-primary);
  font-size: 0.88rem;
  font-family: inherit;
  border-radius: 10px;
  cursor: pointer;
  transition: background 140ms ease;
  white-space: nowrap;
}

.prompts-editor-send-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.prompts-editor-send-option img {
  width: 20px;
  height: 20px;
  border-radius: 4px;
}

/* ---- Danger zone (delete) ---- */
.prompts-editor-danger-zone {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--pm-muted-border);
}

.prompts-editor-delete-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid rgba(251, 113, 133, 0.3);
  color: var(--pm-text-secondary);
  font-size: 0.83rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 180ms ease;
}

.prompts-editor-delete-btn svg {
  width: 15px;
  height: 15px;
}

.prompts-editor-delete-btn:hover {
  background: var(--pm-danger-soft);
  border-color: var(--pm-danger);
  color: var(--pm-danger);
}

/* ---- AI Panel (improve result) ---- */
.prompts-ai-panel {
  background: var(--pm-surface-bg);
  backdrop-filter: blur(22px);
  border: 1px solid var(--pm-accent);
  border-radius: 16px;
  overflow: hidden;
  animation: pm-panel-in 250ms ease;
}

@keyframes pm-panel-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.prompts-ai-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--pm-muted-border);
  background: rgba(74, 222, 128, 0.04);
}

.prompts-ai-panel-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.prompts-ai-panel-title-row svg {
  width: 18px;
  height: 18px;
  color: var(--pm-accent);
}

.prompts-ai-panel-header h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--pm-accent);
}

.prompts-ai-panel-close {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--pm-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 140ms ease;
}

.prompts-ai-panel-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.prompts-ai-panel-close svg {
  width: 16px;
  height: 16px;
}

.prompts-ai-panel-body {
  padding: 16px 20px;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--pm-text-primary);
  max-height: 300px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.prompts-ai-panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--pm-muted-border);
}

.prompts-ai-panel-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--pm-muted-border);
  background: transparent;
  color: var(--pm-text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 160ms ease;
}

.prompts-ai-panel-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.prompts-ai-panel-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--pm-text-primary);
}

.prompts-ai-panel-btn--primary {
  background: var(--pm-accent-soft);
  border-color: var(--pm-accent);
  color: var(--pm-accent);
}

.prompts-ai-panel-btn--primary:hover {
  background: var(--pm-accent);
  color: #05070c;
}

/* ---- AI loading spinner ---- */
.prompts-ai-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--pm-text-secondary);
  font-size: 0.9rem;
}

.prompts-ai-loading::before {
  content: '';
  width: 18px;
  height: 18px;
  border: 2px solid var(--pm-muted-border);
  border-top-color: var(--pm-accent);
  border-radius: 50%;
  animation: pm-spin 0.8s linear infinite;
}

@keyframes pm-spin {
  to { transform: rotate(360deg); }
}

/* ---- Toast ---- */
.prompts-toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.prompts-toast {
  padding: 10px 22px;
  border-radius: 12px;
  background: var(--pm-surface-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--pm-surface-border);
  color: var(--pm-text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(10px);
  animation: pm-toast-in 250ms ease forwards;
  pointer-events: auto;
}

.prompts-toast--error {
  border-color: var(--pm-danger);
  color: var(--pm-danger);
}

.prompts-toast--success {
  border-color: var(--pm-accent);
}

@keyframes pm-toast-in {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pm-toast-out {
  to { opacity: 0; transform: translateY(10px); }
}

/* ---- Editor card wrapper ---- */
.prompts-editor-card {
  background: var(--pm-surface-bg);
  backdrop-filter: blur(22px);
  border: 1px solid var(--pm-surface-border);
  border-radius: 18px;
  padding: 24px 28px;
  margin-top: 24px;
  box-shadow: var(--pm-card-shadow);
}

/* ---- Title row with favorite ---- */
.prompts-editor-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.prompts-editor-title-row .prompts-editor-title-input {
  flex: 1;
  padding: 4px 0;
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  margin: 0;
}

.prompts-editor-favorite-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--pm-muted-border);
  background: transparent;
  color: var(--pm-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 160ms ease;
  flex-shrink: 0;
}

.prompts-editor-favorite-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.24);
}

.prompts-editor-favorite-btn.is-active {
  color: #facc15;
  border-color: rgba(250, 204, 21, 0.4);
  background: rgba(250, 204, 21, 0.12);
}

/* ---- Card image section ---- */
.prompts-editor-card-image {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--pm-muted-border);
}

.prompts-editor-card-image img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
}

.prompts-editor-card-image-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
}

.prompts-editor-card-image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100px;
  color: var(--pm-text-secondary);
  font-size: 0.85rem;
  gap: 8px;
  cursor: pointer;
  transition: background 160ms ease;
}

.prompts-editor-card-image-placeholder:hover {
  background: rgba(255, 255, 255, 0.04);
}

.prompts-editor-card-image-placeholder svg {
  width: 18px;
  height: 18px;
  opacity: 0.5;
}

/* ---- Card description ---- */
.prompts-editor-card-description {
  margin-bottom: 12px;
}

.prompts-editor-card-description textarea {
  width: 100%;
  min-height: 60px;
  background: var(--pm-input-bg);
  border: 1px solid var(--pm-input-border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--pm-input-text);
  font-size: 0.9rem;
  font-family: inherit;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: border-color 200ms ease;
}

.prompts-editor-card-description textarea:focus {
  border-color: var(--pm-accent);
}

.prompts-editor-card-description textarea::placeholder {
  color: var(--pm-input-placeholder);
}

/* ---- Card category row ---- */
.prompts-editor-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.prompts-editor-card-meta .prompts-editor-category {
  flex: 1;
  max-width: 200px;
}

/* ---- Card divider + action row ---- */
.prompts-editor-card-divider {
  height: 1px;
  background: var(--pm-muted-border);
  margin: 0 0 14px;
}

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

/* ---- Content card inner toolbar ---- */
.prompts-editor-content-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--pm-muted-border);
  flex-wrap: wrap;
}

.prompts-editor-content-toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--pm-text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 140ms ease;
}

.prompts-editor-content-toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--pm-text-primary);
}

.prompts-editor-content-toolbar-btn svg {
  width: 15px;
  height: 15px;
}

.prompts-editor-content-toolbar-btn--bold {
  font-weight: 800;
}

.prompts-editor-content-toolbar-btn--italic {
  font-style: italic;
}

.prompts-editor-card-meta-icon {
  width: 15px;
  height: 15px;
  opacity: 0.6;
  flex-shrink: 0;
  color: var(--pm-text-secondary);
}

.prompts-editor-content-toolbar-sep {
  width: 1px;
  height: 20px;
  background: var(--pm-muted-border);
  margin: 0 4px;
  flex-shrink: 0;
}

/* ---- Vertical right sidebar (icon bar) ---- */
.prompts-editor-right-bar {
  position: fixed;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 6px;
  background: var(--pm-surface-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--pm-surface-border);
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3);
}

.prompts-editor-right-bar-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--pm-muted-border);
  background: transparent;
  color: var(--pm-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 160ms ease;
  position: relative;
}

.prompts-editor-right-bar-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--pm-text-primary);
  border-color: rgba(255, 255, 255, 0.24);
  transform: translateY(-1px);
}

.prompts-editor-right-bar-btn svg {
  width: 18px;
  height: 18px;
}

.prompts-editor-right-bar-btn img {
  width: 20px;
  height: 20px;
  border-radius: 4px;
}

.prompts-editor-right-bar-sep {
  width: 24px;
  height: 1px;
  background: var(--pm-muted-border);
}

/* Tooltip for right bar icons */
.prompts-editor-right-bar-btn::after {
  content: attr(title);
  position: absolute;
  right: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-size: 0.75rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 140ms ease;
}

.prompts-editor-right-bar-btn:hover::after {
  opacity: 1;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .prompts-header {
    padding: 16px 16px 12px;
  }

  .prompts-search-section {
    padding: 0 16px;
  }

  .prompts-grid {
    grid-template-columns: 1fr;
    padding: 0 16px 32px;
  }

  .prompts-editor-topbar {
    padding: 12px 16px;
  }

  .prompts-editor-scroll {
    padding: 0 16px 40px;
  }

  .prompts-editor-hero img {
    height: 150px;
  }

  .prompts-editor-title-input {
    font-size: clamp(1.3rem, 4vw, 1.8rem);
  }

  .prompts-editor-meta-strip {
    flex-wrap: wrap;
    gap: 8px;
  }

  .prompts-editor-meta-sep {
    display: none;
  }

  .prompts-editor-textarea {
    min-height: 240px;
    padding: 18px 20px;
  }

  .prompts-editor-toolbar {
    gap: 6px;
  }

  .prompts-editor-tool-btn span {
    display: none;
  }

  .prompts-editor-tool-btn {
    padding: 8px 10px;
  }

  .prompts-editor-toolbar-sep {
    display: none;
  }

  .prompts-editor-card {
    padding: 18px 16px;
  }

  .prompts-editor-right-bar {
    position: static;
    transform: none;
    flex-direction: row;
    gap: 6px;
    margin-top: 12px;
    padding: 6px 10px;
    border-radius: 12px;
    width: fit-content;
  }

  .prompts-editor-right-bar-sep {
    width: 1px;
    height: 24px;
  }

  .prompts-editor-right-bar-btn::after {
    display: none;
  }
}

@media (max-width: 480px) {
  .prompts-search-box {
    border-radius: 16px;
  }

  .prompt-tile__image {
    width: 40%;
  }

  .prompts-editor-back span {
    display: none;
  }

  .prompts-editor-back {
    padding: 8px 10px;
  }
}

/* ---- Delete confirmation modal ---- */
.prompts-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.prompts-confirm-dialog {
  background: var(--pm-surface-bg);
  backdrop-filter: blur(22px);
  border: 1px solid var(--pm-surface-border);
  border-radius: 20px;
  padding: 28px 32px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.prompts-confirm-dialog h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  color: var(--pm-text-primary);
}

.prompts-confirm-dialog p {
  margin: 0 0 20px;
  color: var(--pm-text-secondary);
  font-size: 0.95rem;
}

.prompts-confirm-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}

.prompts-confirm-actions button {
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 160ms ease;
}

.prompts-confirm-cancel {
  border: 1px solid var(--pm-muted-border);
  background: transparent;
  color: var(--pm-text-secondary);
}

.prompts-confirm-cancel:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--pm-text-primary);
}

.prompts-confirm-delete {
  border: 1px solid var(--pm-danger);
  background: var(--pm-danger-soft);
  color: var(--pm-danger);
}

.prompts-confirm-delete:hover {
  background: var(--pm-danger);
  color: #fff;
}
