/* Supplementary CSS for Tailwind utilities not included in Metronic's pre-built styles.css */

/* --- Layout & Positioning --- */
.inset-0 { inset: 0; }
.z-50 { z-index: 50; }
.left-1\/2 { left: 50%; }
.-translate-x-1\/2 { transform: translateX(-50%); }
.top-\[20\%\] { top: 20%; }
.top-\[30\%\] { top: 30%; }
.overflow-y-auto { overflow-y: auto; }
.ml-auto { margin-left: auto; }
.w-px { width: 1px; }

/* Arbitrary widths/heights */
.h-\[70px\] { height: 70px; }
.max-h-\[400px\] { max-height: 400px; }
.min-h-\[400px\] { min-height: 400px; }
.max-w-\[370px\] { max-width: 370px; }
.max-w-\[400px\] { max-width: 400px; }
.max-w-\[600px\] { max-width: 600px; }

/* --- Backgrounds --- */
.bg-black\/50 { background-color: rgba(0, 0, 0, 0.5); }
.bg-black\/30 { background-color: rgba(0, 0, 0, 0.3); }
.bg-red-50 { background-color: oklch(97.1% 0.013 17.38); }
.bg-amber-50 { background-color: oklch(98.7% 0.026 102.212); }

/* --- Borders --- */
.border-amber-200 { border-color: oklch(90.1% 0.076 70.697); }

/* --- Text Colors --- */
.text-red-500 { color: oklch(63.7% 0.237 25.331); }
.text-amber-700 { color: oklch(55.4% 0.135 66.442); }

/* --- Shadows --- */
.shadow-2xl {
  --tw-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
}

/* --- Transitions --- */
.transition-shadow {
  transition-property: box-shadow;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}

/* --- Padding --- */
.p-6 { padding: 1.5rem; }

/* --- Outline --- */
.outline-none { outline: none; }

/* --- Responsive: md --- */
@media (min-width: 48rem) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* --- Responsive: lg --- */
@media (min-width: 64rem) {
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:overflow-hidden { overflow: hidden; }
  .lg\:ps-\(--sidebar-width\) { padding-inline-start: var(--sidebar-width); }
}

/* --- Hover states --- */
.hover\:bg-muted:hover { background-color: var(--muted); }
.hover\:shadow-md:hover {
  --tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
}

/* --- Focus states --- */
.focus\:border-primary:focus { border-color: var(--primary); }

/* --- Pseudo-classes --- */
.last\:border-b-0:last-child { border-bottom-width: 0; }
.placeholder\:text-secondary-foreground::placeholder { color: var(--secondary-foreground); }

/* --- Dark mode --- */
.dark .dark\:bg-amber-950\/20 { background-color: rgba(69, 52, 16, 0.2); }
.dark .dark\:bg-red-950\/20 { background-color: rgba(69, 16, 16, 0.2); }
.dark .dark\:border-amber-800 { border-color: oklch(47.6% 0.114 61.907); }
.dark .dark\:text-amber-300 { color: oklch(87.1% 0.15 84.112); }

/* --- Prose (document content) --- */
.prose {
  color: var(--foreground);
  max-width: 65ch;
  line-height: 1.75;
}
.prose p { margin-top: 1.25em; margin-bottom: 1.25em; }
.prose h1 { font-size: 2.25em; margin-top: 0; margin-bottom: 0.8em; font-weight: 800; line-height: 1.1; }
.prose h2 { font-size: 1.5em; margin-top: 2em; margin-bottom: 1em; font-weight: 700; line-height: 1.3; }
.prose h3 { font-size: 1.25em; margin-top: 1.6em; margin-bottom: 0.6em; font-weight: 600; line-height: 1.6; }
.prose a { color: var(--primary); text-decoration: underline; }
.prose strong { font-weight: 600; }
.prose ul { list-style-type: disc; margin-top: 1.25em; margin-bottom: 1.25em; padding-left: 1.625em; }
.prose ol { list-style-type: decimal; margin-top: 1.25em; margin-bottom: 1.25em; padding-left: 1.625em; }
.prose li { margin-top: 0.5em; margin-bottom: 0.5em; }
.prose blockquote { font-style: italic; border-left: 0.25rem solid var(--border); padding-left: 1em; margin-top: 1.6em; margin-bottom: 1.6em; }
.prose code { font-size: 0.875em; font-weight: 600; background: var(--muted); padding: 0.2em 0.4em; border-radius: 0.25rem; }
.prose pre { background: var(--muted); border-radius: 0.375rem; padding: 0.85em 1.15em; overflow-x: auto; margin-top: 1.7em; margin-bottom: 1.7em; }
.prose pre code { font-weight: 400; background: transparent; padding: 0; border-radius: 0; font-size: 0.875em; }
.prose img { max-width: 100%; height: auto; margin-top: 2em; margin-bottom: 2em; border-radius: 0.375rem; }
.prose table { width: 100%; border-collapse: collapse; margin-top: 2em; margin-bottom: 2em; }
.prose th, .prose td { border: 1px solid var(--border); padding: 0.57em 0.85em; text-align: left; }
.prose th { font-weight: 600; background: var(--muted); }
.prose hr { border-color: var(--border); margin-top: 3em; margin-bottom: 3em; }

.prose-sm { font-size: 0.875rem; line-height: 1.7; }
.prose-sm p { margin-top: 0.85em; margin-bottom: 0.85em; }

.dark .dark\:prose-invert { color: var(--foreground); }

/* --- Custom component classes --- */

/* Metronic button variants not in base build */
.kt-btn-light {
  background-color: var(--muted);
  color: var(--foreground);
  border: 1px solid var(--border);
}
.kt-btn-light:hover {
  background-color: var(--accent);
}

.kt-btn-warning {
  background-color: oklch(79.5% 0.184 86.047);
  color: white;
}
.kt-btn-warning:hover {
  background-color: oklch(68.1% 0.162 75.834);
}

/* Toolbar buttons for tiptap editor */
.toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  height: 1.75rem;
  padding: 0 0.375rem;
  border-radius: 0.375rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--foreground);
  cursor: pointer;
  font-size: 0.75rem;
  white-space: nowrap;
  transition: background-color 150ms, border-color 150ms;
}
.toolbar-btn:hover {
  background-color: var(--muted);
  border-color: var(--border);
}
.toolbar-btn.active {
  background-color: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

/* --- Bubble Menu (appears on text selection) --- */
.bubble-menu {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.25rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.bubble-menu button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.25rem;
  border: none;
  background: transparent;
  color: var(--foreground);
  cursor: pointer;
  font-size: 0.8125rem;
}
.bubble-menu button:hover {
  background: var(--muted);
}
.bubble-menu button.active {
  background: var(--primary);
  color: var(--primary-foreground);
}
.bubble-sep {
  width: 1px;
  height: 1rem;
  background: var(--border);
  margin: 0 0.125rem;
}

/* --- Floating Menu (appears on empty lines) --- */
.floating-menu {
  padding: 0.25rem 0.5rem;
}
.floating-hint {
  color: var(--muted-foreground);
  font-size: 0.8125rem;
}
.floating-hint kbd {
  display: inline-block;
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  padding: 0 0.25rem;
  font-size: 0.75rem;
  font-family: inherit;
  line-height: 1.5;
}

/* --- Slash Command Menu --- */
.slash-menu {
  position: fixed;
  z-index: 100;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  width: 260px;
  max-height: 320px;
  overflow-y: auto;
  padding: 0.25rem;
}
.slash-menu-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.5rem 0.625rem;
  border: none;
  border-radius: 0.375rem;
  background: transparent;
  color: var(--foreground);
  cursor: pointer;
  text-align: left;
}
.slash-menu-item:hover, .slash-menu-item.selected {
  background: var(--muted);
}
.slash-menu-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.25rem;
  border: 1px solid var(--border);
  background: var(--background);
  font-size: 0.8125rem;
  font-weight: 600;
  flex-shrink: 0;
}
.slash-menu-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.slash-menu-title {
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.2;
}
.slash-menu-desc {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  line-height: 1.3;
}
.slash-menu-empty {
  padding: 1rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

/* --- Toast notifications --- */
.jasper-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 100;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: opacity 300ms;
}
.jasper-toast[data-type="success"] {
  background: oklch(62.7% 0.194 149.214);
  color: white;
}
.jasper-toast[data-type="error"] {
  background: oklch(57.7% 0.245 27.325);
  color: white;
}

/* --- Editor placeholder styles --- */
/* Only show placeholder on the very first empty paragraph (editor-level) */
.tiptap p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  color: var(--muted-foreground);
  pointer-events: none;
  height: 0;
}
/* Heading placeholders (shown via showOnlyCurrent) */
.tiptap h1.is-empty::before,
.tiptap h2.is-empty::before,
.tiptap h3.is-empty::before,
.tiptap h4.is-empty::before {
  content: attr(data-placeholder);
  float: left;
  color: var(--muted-foreground);
  pointer-events: none;
  height: 0;
}

/* --- Block Handle Controls (Notion-like + and ⋮⋮) --- */
#editor {
  position: relative;
}

#editor > .tiptap {
  padding-left: 2.5rem;
}

.block-handle {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 1px;
  opacity: 0;
  transition: opacity 100ms ease;
  z-index: 10;
  pointer-events: none;
}

.block-handle.visible {
  opacity: 1;
  pointer-events: auto;
}

.block-handle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.5rem;
  border-radius: 0.25rem;
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  padding: 0;
  transition: color 100ms, background-color 100ms;
}

.block-handle-btn:hover {
  background: var(--muted);
  color: var(--foreground);
}

.block-handle .drag-handle {
  cursor: grab;
}

.block-handle .drag-handle:active {
  cursor: grabbing;
}

/* Drop indicator line for block reordering */
.block-drop-indicator {
  position: absolute;
  left: 2rem;
  right: 1rem;
  height: 2px;
  background: var(--primary);
  border-radius: 1px;
  pointer-events: none;
  z-index: 11;
}

/* ==============================================================
   Outline-like Visual Overhaul
   ============================================================== */

/* 1. Dark mode: seamless body background (match card bg) */
html.dark body {
  background-color: var(--background);
}

/* 2. Sidebar: right border separator */
#sidebar {
  border-right: 1px solid var(--border);
}

/* 3. Content cards: transparent in dark mode for direct content flow */
html.dark .kt-container-fixed .kt-card {
  border-color: transparent;
  background-color: transparent;
  box-shadow: none;
}

/* 4. Collection grid cards: keep card look (interactive tiles) */
html.dark .grid .kt-card {
  border-color: var(--border);
  background-color: var(--card);
}
html.dark .grid .kt-card:hover {
  border-color: var(--ring);
}

/* 5. Sidebar hover controls (+) */
.sidebar-controls {
  display: none;
  align-items: center;
  gap: 1px;
  flex-shrink: 0;
}

.kt-menu-link:hover .sidebar-controls {
  display: flex;
}

.sidebar-ctrl-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 0.25rem;
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  padding: 0;
  font-size: 0.625rem;
}

.sidebar-ctrl-btn:hover {
  color: var(--foreground);
  background-color: var(--accent);
}

/* 6. Sidebar: cleaner hover effect */
#sidebar .kt-menu-link {
  transition: background-color 100ms ease;
}

/* 7. Document list items: subtle separator in dark mode */
html.dark .kt-container-fixed .kt-card-content > a {
  border-color: var(--border);
}

/* 8. Light mode: keep standard Metronic card look but softer shadows */
.kt-container-fixed .kt-card {
  --tw-shadow: 0 1px 2px 0 rgba(0,0,0,0.03);
}
