/* ==========================================================================
   Prompt Pocket - Design System & Stylesheet (Refined & Compact 12-Grid)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Font Families */
  --font-display: 'Fredoka', 'Quicksand', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Neutral Surface Palette */
  --bg-app: #F8F9FA;
  --bg-surface: #FFFFFF;
  --bg-surface-subtle: #F1F3F5;
  --bg-card: #FFFFFF;
  --bg-card-hover: #FFFFFF;
  
  --border-subtle: #E9ECEF;
  --border-medium: #DEE2E6;
  --border-strong: #CED4DA;

  --text-main: #1A1D20;
  --text-muted: #6C757D;
  --text-subtle: #868E96;
  --text-on-accent: #111315;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.04), 0 2px 4px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 10px 24px rgba(0, 0, 0, 0.06), 0 4px 8px rgba(0, 0, 0, 0.03);
  --shadow-modal: 0 20px 40px rgba(0, 0, 0, 0.12), 0 8px 16px rgba(0, 0, 0, 0.05);

  /* Transitions */
  --trans-fast: 150ms cubic-bezier(0.16, 1, 0.3, 1);
  --trans-normal: 220ms cubic-bezier(0.16, 1, 0.3, 1);
  --trans-spring: 300ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Radii */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-pill: 9999px;

  /* Layout Dimensions (Aligned perfectly) */
  --sidebar-width: 240px;
  --header-height: 64px;
  --footer-height: 48px;

  /* Default Theme: Spring Coral */
  --accent: #F59C9A;
  --accent-soft: #FDF0EF;
  --accent-sidebar: #F59C9A;
  --accent-card-border: #FAC8C6;
  --accent-medium: #E87A77;
  --accent-strong: #AB2C28;
  --accent-contrast: #380E0D;
  --sidebar-bg: #FCE8E7;          /* lighter tone for sidebar background */
  --sidebar-btn-bg: #F5A8A6;      /* slightly deeper tone for buttons */
  --sidebar-text: #380E0D;
  --sidebar-text-muted: rgba(56, 14, 13, 0.72);
  --sidebar-border: rgba(56, 14, 13, 0.15);
  --sidebar-btn-shadow: rgba(56, 14, 13, 0.14);
  --sidebar-brand-bg: rgba(255,255,255,0.55);
  --sidebar-brand-border: rgba(56, 14, 13, 0.18);
}

/* --- Dynamic Theme Variants (6 Curated Pastel Themes) --- */

/* 1. Periwinkle Pale Blue (#9ECCF0) */
[data-theme="periwinkle-blue"] {
  --accent: #9ECCF0;
  --accent-soft: #EEF6FC;
  --accent-sidebar: #9ECCF0;
  --accent-card-border: #C8E1F7;
  --accent-medium: #78B5E6;
  --accent-strong: #246B9E;
  --accent-contrast: #0E293D;
  --sidebar-bg: #DAEDF8;
  --sidebar-btn-bg: #8EC4EE;
  --sidebar-text: #0E293D;
  --sidebar-text-muted: rgba(14, 41, 61, 0.72);
  --sidebar-border: rgba(14, 41, 61, 0.15);
  --sidebar-btn-shadow: rgba(14, 41, 61, 0.14);
  --sidebar-brand-bg: rgba(255,255,255,0.55);
  --sidebar-brand-border: rgba(14, 41, 61, 0.18);
}

/* 2. Soft Pink (#F5C8C4) */
[data-theme="soft-pink"] {
  --accent: #F5C8C4;
  --accent-soft: #FDF3F2;
  --accent-sidebar: #F5C8C4;
  --accent-card-border: #FADCDA;
  --accent-medium: #E8A8A2;
  --accent-strong: #A6463F;
  --accent-contrast: #381514;
  --sidebar-bg: #FCEDEC;
  --sidebar-btn-bg: #EDADAA;
  --sidebar-text: #381514;
  --sidebar-text-muted: rgba(56, 21, 20, 0.72);
  --sidebar-border: rgba(56, 21, 20, 0.15);
  --sidebar-btn-shadow: rgba(56, 21, 20, 0.14);
  --sidebar-brand-bg: rgba(255,255,255,0.55);
  --sidebar-brand-border: rgba(56, 21, 20, 0.18);
}

/* 3. Spring Coral (#F59C9A) */
[data-theme="spring-coral"] {
  --accent: #F59C9A;
  --accent-soft: #FDF0EF;
  --accent-sidebar: #F59C9A;
  --accent-card-border: #FAC8C6;
  --accent-medium: #E87A77;
  --accent-strong: #AB2C28;
  --accent-contrast: #380E0D;
  --sidebar-bg: #FCE8E7;
  --sidebar-btn-bg: #F5A8A6;
  --sidebar-text: #380E0D;
  --sidebar-text-muted: rgba(56, 14, 13, 0.72);
  --sidebar-border: rgba(56, 14, 13, 0.15);
  --sidebar-btn-shadow: rgba(56, 14, 13, 0.14);
  --sidebar-brand-bg: rgba(255,255,255,0.55);
  --sidebar-brand-border: rgba(56, 14, 13, 0.18);
}

/* 4. Peach Fuzz (#FFBE98) */
[data-theme="peach-fuzz"] {
  --accent: #FFBE98;
  --accent-soft: #FFF4EE;
  --accent-sidebar: #FFBE98;
  --accent-card-border: #FEDDCB;
  --accent-medium: #F59E6A;
  --accent-strong: #B0501A;
  --accent-contrast: #3B1804;
  --sidebar-bg: #FFF0E4;
  --sidebar-btn-bg: #FFCAAA;
  --sidebar-text: #3B1804;
  --sidebar-text-muted: rgba(59, 24, 4, 0.72);
  --sidebar-border: rgba(59, 24, 4, 0.15);
  --sidebar-btn-shadow: rgba(59, 24, 4, 0.14);
  --sidebar-brand-bg: rgba(255,255,255,0.55);
  --sidebar-brand-border: rgba(59, 24, 4, 0.18);
}

/* 5. Butter Yellow (#FFE7AB) */
[data-theme="butter-yellow"] {
  --accent: #FFE7AB;
  --accent-soft: #FFFBF2;
  --accent-sidebar: #FFE7AB;
  --accent-card-border: #FEEFD0;
  --accent-medium: #E8C96E;
  --accent-strong: #8A6808;
  --accent-contrast: #332500;
  --sidebar-bg: #FFFAE6;
  --sidebar-btn-bg: #FAEFC0;
  --sidebar-text: #332500;
  --sidebar-text-muted: rgba(51, 37, 0, 0.72);
  --sidebar-border: rgba(51, 37, 0, 0.15);
  --sidebar-btn-shadow: rgba(51, 37, 0, 0.14);
  --sidebar-brand-bg: rgba(255,255,255,0.55);
  --sidebar-brand-border: rgba(51, 37, 0, 0.18);
}

/* 6. Pistachio Green (#C5DBA9) */
[data-theme="pistachio-green"] {
  --accent: #C5DBA9;
  --accent-soft: #F5F9F0;
  --accent-sidebar: #C5DBA9;
  --accent-card-border: #DFEDCE;
  --accent-medium: #A4C67D;
  --accent-strong: #4F7327;
  --accent-contrast: #1D2D0C;
  --sidebar-bg: #E8F3DC;
  --sidebar-btn-bg: #C8DDB0;
  --sidebar-text: #1D2D0C;
  --sidebar-text-muted: rgba(29, 45, 12, 0.72);
  --sidebar-border: rgba(29, 45, 12, 0.15);
  --sidebar-btn-shadow: rgba(29, 45, 12, 0.14);
  --sidebar-brand-bg: rgba(255,255,255,0.55);
  --sidebar-brand-border: rgba(29, 45, 12, 0.18);
}

/* --- Global Body & Layout --- */
html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  color: var(--text-main);
  background-color: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

/* --- Sidebar (Theme Accent Background) --- */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg, var(--accent-soft));
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 40;
  transition: background var(--trans-normal), transform var(--trans-normal);
}

/* --- Brand Block (elevated card, separated from sidebar bg) --- */
.sidebar-header {
  padding: 10px 10px 0;
  flex-shrink: 0;
}

.app-brand-block {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--sidebar-brand-bg, rgba(255,255,255,0.55));
  border: 1px solid var(--sidebar-brand-border, rgba(0,0,0,0.12));
  border-radius: var(--radius-lg);
  padding: 8px 10px 9px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.09);
  backdrop-filter: blur(6px);
  margin-bottom: 8px;
}

.app-brand-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sidebar-text);
  flex-shrink: 0;
}

.app-brand-icon svg {
  width: 30px;
  height: 30px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0px;
  line-height: 1;
}

.brand-text h1 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--sidebar-text);
  white-space: nowrap;
  line-height: 1.15;
}

.brand-text span {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.9px;
  color: var(--sidebar-text-muted);
  text-transform: uppercase;
  line-height: 1.2;
}

/* --- Sidebar Nav (organized with fixed top filters, sticky section header, and scrollable categories) --- */
.sidebar-nav {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.sidebar-nav-fixed {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 8px;
}

.sidebar-section-header {
  flex-shrink: 0;
  position: relative;
  z-index: 5;
  background: var(--sidebar-bg, var(--accent-soft));
  padding: 8px 12px 4px;
  margin-top: 2px;
}

.sidebar-section-header .nav-section-title,
.nav-section-title {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--sidebar-text-muted);
  padding: 0;
  margin: 0;
}

.sidebar-categories-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 2px 8px 8px;
  scrollbar-width: none;       /* Firefox */
  -ms-overflow-style: none;   /* IE/Edge */
}

.sidebar-categories-scroll::-webkit-scrollbar {
  display: none;               /* Chrome/Safari */
}

/* Category button as individual card */
.category-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,0.45);
  background: var(--sidebar-btn-bg, var(--accent));
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-family: var(--font-body);
  font-size: 0.79rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--trans-fast);
  text-align: left;
  box-shadow: 0 2px 5px var(--sidebar-btn-shadow, rgba(0,0,0,0.10)),
              0 1px 2px rgba(0,0,0,0.06);
  position: relative;
}

.category-btn:hover {
  background: rgba(255,255,255,0.50);
  color: var(--sidebar-text);
  transform: translateX(3px);
  box-shadow: 0 3px 10px var(--sidebar-btn-shadow, rgba(0,0,0,0.14)),
              0 1px 3px rgba(0,0,0,0.08);
  border-color: rgba(255,255,255,0.70);
}

.category-btn.active {
  background: rgba(255,255,255,0.90);
  color: var(--sidebar-text);
  font-weight: 700;
  box-shadow: 0 3px 12px var(--sidebar-btn-shadow, rgba(0,0,0,0.18)),
              0 1px 4px rgba(0,0,0,0.10);
  border-color: rgba(255,255,255,0.95);
  transform: translateX(1px);
}

/* Name portion of button */
.category-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

/* Count badge and actions inside the button */
.category-btn-meta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  margin-left: 6px;
}

.category-edit-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-xs);
  border: none;
  background: transparent;
  color: var(--sidebar-text);
  cursor: pointer;
  opacity: 0;
  padding: 0;
  transition: opacity var(--trans-fast), background var(--trans-fast), transform var(--trans-fast);
}

.category-btn:hover .category-edit-trigger {
  opacity: 0.65;
}

.category-edit-trigger:hover {
  opacity: 1 !important;
  background: rgba(255, 255, 255, 0.50);
  transform: scale(1.1);
}

.category-count {
  font-size: 0.68rem;
  padding: 2px 7px;
  background: rgba(255,255,255,0.45);
  border-radius: var(--radius-pill);
  color: var(--sidebar-text);
  font-weight: 700;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.50);
  transition: all var(--trans-fast);
}

.category-btn.active .category-count {
  background: var(--accent-soft);
  color: var(--sidebar-text);
  border-color: var(--accent-card-border);
}

.sidebar-footer {
  height: var(--footer-height);
  padding: 0 10px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  flex-shrink: 0;
}

.btn-new-category {
  width: 100%;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.35);
  border: 1px dashed var(--sidebar-border);
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--trans-fast);
}

.btn-new-category:hover {
  border-color: #FFFFFF;
  color: var(--sidebar-text);
  background: #FFFFFF;
}

/* --- Main Content Area --- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-app);
}

/* --- Top Header Bar --- */
.top-header {
  height: var(--header-height);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  box-sizing: border-box;
  flex-shrink: 0;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  max-width: 360px;
}

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
}

.search-box {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-pill);
  background: var(--bg-surface-subtle);
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--text-main);
  outline: none;
  transition: all var(--trans-fast);
}

.search-input:focus {
  background: var(--bg-surface);
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Header Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  background: var(--accent);
  color: var(--accent-contrast);
  border: none;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--trans-fast);
}

.btn-primary:hover {
  background: var(--accent-medium);
  color: var(--accent-contrast);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  background: var(--bg-surface-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--trans-fast);
}

.btn-secondary:hover {
  background: var(--bg-surface);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.btn-secondary:active {
  transform: scale(0.97);
}

/* 6 Visible Theme Swatches Bar */
.theme-swatches-group {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-pill);
  height: 36px;
}

.theme-dot-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform var(--trans-fast), box-shadow var(--trans-fast), border-color var(--trans-fast);
  outline: none;
  flex-shrink: 0;
}

.theme-dot-btn:hover {
  transform: scale(1.22);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.theme-dot-btn.active {
  border-color: #FFFFFF;
  box-shadow: 0 0 0 2px var(--text-main), 0 2px 6px rgba(0, 0, 0, 0.2);
  transform: scale(1.15);
}

/* Language Segmented Pill Button */
.lang-toggle-group {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-pill);
  padding: 2px;
  height: 36px;
  gap: 2px;
}

.lang-pill-btn {
  border: none;
  background: transparent;
  padding: 0 9px;
  height: 100%;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--trans-fast);
}

.lang-pill-btn:hover {
  color: var(--text-main);
}

.lang-pill-btn.active {
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

/* --- Cards Grid Workspace (12 Prompts Grid: 4 cols x 3 rows) --- */
.workspace-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px 20px;
  overflow: hidden;
  justify-content: space-between;
}

.prompts-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 10px;
  min-height: 0;
}

/* Prompt Card - Compact & Filled */
.prompt-card {
  background: var(--bg-card);
  border: 1px solid var(--accent-card-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform var(--trans-normal), box-shadow var(--trans-normal), border-color var(--trans-fast);
  position: relative;
  overflow: hidden;
  animation: cardFadeIn 280ms ease-out backwards;
}

@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.prompt-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-strong);
}

.card-top {
  display: flex;
  gap: 12px;
  flex: 1;
  min-height: 0;
  align-items: stretch;
  overflow: hidden;
}

.card-img-wrap {
  height: 100%;
  max-height: 96px;
  min-height: 72px;
  aspect-ratio: 1 / 1;
  width: auto;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--accent-soft);
  border: 1px solid var(--accent-card-border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow: hidden;
}

.card-text {
  font-size: 0.82rem;
  line-height: 1.42;
  color: var(--text-main);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.card-bottom {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-shrink: 0;
}

.card-category-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-card-border);
  border-radius: var(--radius-pill);
  color: var(--accent-strong);
  white-space: nowrap;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.card-action-btn {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-xs);
  background: transparent;
  border: none;
  color: var(--text-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--trans-fast);
  position: relative;
}

.card-action-btn svg {
  width: 13px;
  height: 13px;
}

.card-action-btn:hover {
  background: var(--accent-soft);
  color: var(--accent-contrast);
  transform: scale(1.1);
}

.card-action-btn:active {
  transform: scale(0.92);
}

.card-action-btn.favorite-btn.is-favorite {
  color: #FF4757;
}

.card-action-btn.favorite-btn.is-favorite svg {
  fill: #FF4757;
  animation: heartPulse 300ms var(--trans-spring);
}

@keyframes heartPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.card-action-btn.copy-btn.copied {
  background: var(--accent-soft);
  color: var(--accent-contrast);
}

/* --- Empty States --- */
.empty-state {
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  gap: 10px;
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state-icon svg {
  width: 24px;
  height: 24px;
}

.empty-state h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  text-transform: uppercase;
  color: var(--text-main);
}

.empty-state p {
  font-size: 0.82rem;
  color: var(--text-muted);
  max-width: 320px;
}

/* --- Compact Pagination Bar --- */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding-top: 8px;
  flex-shrink: 0;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--trans-fast);
}

.pagination-btn:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: var(--accent-strong);
  color: var(--accent-contrast);
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-info {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* --- Institutional & Legal Footer with Minimal Icons --- */
.app-footer {
  height: var(--footer-height);
  padding: 0 20px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
  box-sizing: border-box;
  flex-shrink: 0;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.footer-left a {
  color: var(--text-main);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--trans-fast);
}

.footer-left a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-social-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all var(--trans-fast);
}

.footer-social-btn:hover {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent-strong);
  transform: translateY(-1px);
}

.footer-social-btn svg {
  width: 14px;
  height: 14px;
}

/* --- Modals Framework --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 19, 21, 0.45);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  opacity: 0;
  transition: opacity var(--trans-normal);
}

.modal-backdrop.active {
  display: flex;
  opacity: 1;
}

.modal-window {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 540px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.96) translateY(8px);
  transition: transform var(--trans-normal);
}

.modal-backdrop.active .modal-window {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3,
.modal-window h3,
#modalAddEditTitle,
#deleteModalTitle {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-main);
  line-height: 1.2;
}

.modal-section-title,
.modal-body h4 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-main);
  line-height: 1.2;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-subtle);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--trans-fast);
}

.modal-close-btn:hover {
  background: var(--bg-surface-subtle);
  color: var(--text-main);
}

.modal-body {
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  background: var(--bg-app);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.form-textarea {
  width: 100%;
  min-height: 110px;
  padding: 10px 12px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text-main);
  background: var(--bg-surface);
  resize: vertical;
  outline: none;
}

.form-textarea:focus, .form-input:focus, .form-select:focus {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-input, .form-select {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text-main);
  background: var(--bg-surface);
  outline: none;
}

.image-dropzone {
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  cursor: pointer;
  background: var(--bg-surface-subtle);
  transition: all var(--trans-fast);
  position: relative;
}

.image-dropzone:hover {
  border-color: var(--accent-strong);
  background: var(--accent-soft);
}

.image-preview-container {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.preview-thumb {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border-medium);
}

.preview-info {
  flex: 1;
  text-align: left;
}

.preview-info span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.detail-img-large {
  width: 100%;
  max-height: 220px;
  border-radius: var(--radius-md);
  object-fit: cover;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
}

.detail-prompt-box {
  padding: 14px;
  background: var(--bg-surface-subtle);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  font-size: 0.88rem;
  line-height: 1.5;
  white-space: pre-wrap;
  user-select: text;
}

.toast-notice {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #1A1D20;
  color: #FFFFFF;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  animation: toastSlideUp 240ms var(--trans-spring);
}

@keyframes toastSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Responsive Adaptations --- */
@media (max-width: 1200px) {
  .prompts-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(4, 1fr);
  }
}

@media (max-width: 860px) {
  .prompts-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: auto;
  }
}

@media (max-width: 768px) {
  html, body {
    overflow-y: auto;
  }

  #app {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-modal);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-menu-btn {
    display: flex;
  }

  .main-content {
    height: auto;
    min-height: 100vh;
    overflow-y: visible;
  }

  .workspace-area {
    overflow: visible;
  }

  .prompts-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    gap: 10px;
  }

  .top-header {
    padding: 0 12px;
    gap: 8px;
  }

  .header-left {
    max-width: 200px;
    gap: 8px;
  }

  .theme-swatches-group {
    gap: 4px;
    padding: 0 6px;
  }

  .theme-dot-btn {
    width: 18px;
    height: 18px;
  }

  .app-footer {
    flex-direction: column;
    height: auto;
    padding: 10px 16px;
    gap: 6px;
    text-align: center;
  }
}
