/* ==========================================================================
   PromptVault — Linear / Raycast Inspired Dark UI Stylesheet
   ========================================================================== */

:root {
  color-scheme: dark;
  --bg-canvas: #020617;        /* slate-950 */
  --bg-surface: #0f172a;       /* slate-900 */
  --bg-elevated: #1e293b;      /* slate-800 */
  --border-subtle: #1e293b;    /* slate-800 */
  --border-hover: #334155;     /* slate-700 */
  --accent-primary: #6366f1;   /* indigo-500 */
  --accent-glow: rgba(99, 102, 241, 0.22);
}

* {
  box-sizing: border-box;
}

html, body {
  background-color: var(--bg-canvas);
  color: #f8fafc;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle Linear-style background grid */
.bg-linear-grid {
  background-size: 32px 32px;
  background-image: 
    linear-gradient(to right, rgba(30, 41, 59, 0.28) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(30, 41, 59, 0.28) 1px, transparent 1px);
}

/* Glassmorphism panels */
.glass-header {
  background: rgba(2, 6, 23, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.glass-modal {
  background: rgba(9, 14, 28, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* Raycast-style Command Search Input */
.command-search-wrapper {
  position: relative;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.command-search-wrapper:focus-within {
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.45), 0 8px 30px -4px rgba(99, 102, 241, 0.2);
}

/* Interactive Prompt Cards */
.prompt-card {
  position: relative;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.78) 0%, rgba(9, 14, 28, 0.92) 100%);
  border: 1px solid rgba(30, 41, 59, 0.95);
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.18s ease,
              box-shadow 0.18s ease,
              background-color 0.18s ease;
}

.prompt-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 12px 32px -10px rgba(2, 6, 23, 0.85),
              0 0 24px -6px rgba(99, 102, 241, 0.16);
}

.prompt-card.is-pinned {
  border-color: rgba(245, 158, 11, 0.35);
  background: linear-gradient(180deg, rgba(24, 24, 42, 0.85) 0%, rgba(9, 14, 28, 0.95) 100%);
}

.prompt-card.is-pinned:hover {
  border-color: rgba(245, 158, 11, 0.6);
  box-shadow: 0 12px 32px -10px rgba(2, 6, 23, 0.85),
              0 0 24px -6px rgba(245, 158, 11, 0.16);
}

/* Drag & Drop Reordering Styles */
.drag-handle {
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.drag-handle:active,
.prompt-card.is-dragging .drag-handle {
  cursor: grabbing;
}

.prompt-card.is-dragging {
  opacity: 0.42;
  transform: scale(0.97);
  border: 1px dashed #6366f1 !important;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.prompt-card.drag-over-before {
  border-color: #818cf8 !important;
  box-shadow: -4px 0 0 0 #6366f1,
              0 0 0 2px rgba(99, 102, 241, 0.45),
              0 12px 32px -8px rgba(99, 102, 241, 0.35);
  transform: translateY(-2px);
}

.prompt-card.drag-over-after {
  border-color: #818cf8 !important;
  box-shadow: 4px 0 0 0 #6366f1,
              0 0 0 2px rgba(99, 102, 241, 0.45),
              0 12px 32px -8px rgba(99, 102, 241, 0.35);
  transform: translateY(-2px);
}

/* Syntax Highlighting for {{variable}} tokens */
.var-token {
  display: inline-flex;
  align-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.05rem 0.42rem;
  margin: 0 0.08rem;
  border-radius: 0.375rem;
  background: rgba(99, 102, 241, 0.16);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.35);
  white-space: nowrap;
}

.var-token-filled {
  display: inline;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.08rem 0.42rem;
  margin: 0 0.06rem;
  border-radius: 0.375rem;
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.var-token-empty {
  display: inline;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.08rem 0.42rem;
  margin: 0 0.06rem;
  border-radius: 0.375rem;
  background: rgba(245, 158, 11, 0.16);
  color: #fcd34d;
  border: 1px dashed rgba(245, 158, 11, 0.45);
}

/* Search Highlight Mark */
mark.search-match {
  background: rgba(250, 204, 21, 0.25);
  color: #fef08a;
  padding: 0 2px;
  border-radius: 3px;
  border-bottom: 1px solid rgba(250, 204, 21, 0.6);
}

/* Keyboard Shortcut KBD Pill */
kbd.shortcut-key {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.22rem 0.42rem;
  border-radius: 0.375rem;
  background: #0f172a;
  color: #94a3b8;
  border: 1px solid #334155;
  box-shadow: inset 0 -1px 0 #1e293b;
}

/* Line Clamp Utilities */
.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-4 {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-track {
  background: #020617;
}

::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #334155;
}

/* Toast Notification Animation */
@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toast-enter {
  animation: toastSlideIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Modal Backdrop & Dialog Transition */
@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-animate {
  animation: modalPop 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
