/* ═══════════════════════════════════════════════════════════════════
   Ideas Review — Mobile PWA styles (split-screen layout)
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Reset & base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
  height: -webkit-fill-available;
  height: 100dvh;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: -webkit-fill-available;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #f9fafb;
}

/* ─── Safe area (notch / home indicator) ────────────────────────── */
#app-header {
  padding-top: env(safe-area-inset-top, 0px);
}

/* ─── Scrollbar hiding ──────────────────────────────────────────── */
.no-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }

/* Thin scrollbars in panes */
::-webkit-scrollbar            { width: 4px; height: 4px; }
::-webkit-scrollbar-track      { background: transparent; }
::-webkit-scrollbar-thumb      { background: #d1d5db; border-radius: 2px; }
::-webkit-scrollbar-thumb:hover{ background: #9ca3af; }

/* ─── Split container ───────────────────────────────────────────── */
#split-container {
  /* flex-1 set inline + Tailwind, fills the gap between header and bottom */
}

#top-pane {
  /* flex-1 from Tailwind — expands to fill remaining space above divider */
  -webkit-overflow-scrolling: touch;
}

#bottom-pane {
  /* Height set via JS (default ~42% of container); min-height enforced in JS */
  -webkit-overflow-scrolling: touch;
}

/* ─── Split divider & pane tabs ─────────────────────────────────── */
#split-divider {
  user-select: none;
  -webkit-user-select: none;
}

#split-divider.is-dragging {
  background-color: #e5e7eb;
}

#divider-grip {
  -webkit-tap-highlight-color: transparent;
}

.pane-tab {
  appearance: none;
  background: none;
  border: none;
  outline: none;
  padding: 0 16px;
  height: 100%;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s;
}

.pane-tab.active {
  color: #2563eb;
  font-weight: 600;
}

/* Active underline via pseudo-element */
.pane-tab::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 8px;
  right: 8px;
  height: 2px;
  background: transparent;
  border-radius: 2px;
  transition: background-color 0.15s;
}

.pane-tab.active::after {
  background: #2563eb;
}

/* ─── Idea cards ─────────────────────────────────────────────────── */
.idea-card {
  transition: box-shadow 0.15s;
}
.idea-card.reviewed  { border-left: 3px solid #4ade80; }
.idea-card.discarded { border-left: 3px solid #f87171; opacity: 0.65; }

/* ─── Tree accordion ────────────────────────────────────────────── */
.tree-group-content {
  display: none;
}
.tree-group.open > .tree-group-content {
  display: block;
}
.tree-group.open > .tree-group-header .tree-caret {
  transform: rotate(90deg);
}

.tree-caret {
  display: inline-block;
  font-size: 0.6rem;
  line-height: 1;
  transition: transform 0.15s ease;
  flex-shrink: 0;
  color: #9ca3af;
}

.tree-idea {
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  min-height: 44px;
}
.tree-idea:active { background-color: #eff6ff; }

/* Ideas already added to any collection — amber warm tint + left accent */
.tree-idea--collected {
  background-color: #fffbeb;
  border-left: 2px solid #f59e0b;
  border-radius: 0 8px 8px 0;
}
.tree-idea--collected:active { background-color: #fef3c7; }

/* Compact pill showing which collection(s) an idea belongs to */
.idea-col-pill {
  flex-shrink: 0;
  max-width: 80px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 4px;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

/* ─── Line clamp ─────────────────────────────────────────────────── */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ─── Markdown prose ─────────────────────────────────────────────── */
.md-body h1 { font-size: 1.1rem; font-weight: 700; margin: 0.5rem 0 0.4rem; color: #111827; }
.md-body h2 { font-size: 1rem;   font-weight: 600; margin: 0.4rem 0 0.35rem; color: #1f2937; }
.md-body h3 { font-size: 0.9rem; font-weight: 600; margin: 0.35rem 0 0.25rem; color: #374151; }
.md-body p  { font-size: 0.875rem; line-height: 1.7; color: #374151; margin-bottom: 0.6rem; }
.md-body strong { color: #1f2937; }
.md-body em     { color: #4b5563; }
.md-body code {
  background: #f3f4f6; padding: 1px 5px; border-radius: 3px;
  font-size: 0.78rem; font-family: ui-monospace, 'Cascadia Code', monospace; color: #374151;
}
.md-body pre {
  background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px;
  padding: 0.75rem; overflow-x: auto; margin-bottom: 0.75rem;
}
.md-body pre code { background: none; padding: 0; }
.md-body ul, .md-body ol { padding-left: 1.5rem; margin-bottom: 0.6rem; }
.md-body li { font-size: 0.875rem; line-height: 1.65; color: #374151; margin-bottom: 0.25rem; }
.md-body hr { border-color: #e5e7eb; margin: 0.75rem 0; }
.md-body blockquote {
  border-left: 3px solid #d1d5db; padding-left: 0.75rem;
  color: #6b7280; font-style: italic; margin-bottom: 0.6rem;
}
.md-body a { color: #2563eb; text-decoration: underline; }

/* ─── Search overlay ─────────────────────────────────────────────── */
.search-overlay-anim {
  transform: translateY(0);
  transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}

/* ─── Idea detail bottom sheet ───────────────────────────────────── */
.detail-panel-translate {
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}
.detail-panel-translate.sheet-open {
  transform: translateY(0);
}

#detail-content {
  /* Ensure content clears home indicator on iOS */
  padding-bottom: max(2rem, env(safe-area-inset-bottom, 1rem));
}

/* ─── Highlight flash (duplicate pulse) ─────────────────────────── */
@keyframes highlight-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5); }
  60%  { box-shadow: 0 0 0 8px rgba(59, 130, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}
.highlight-flash { animation: highlight-pulse 0.7s ease-out; }

/* ─── Search highlight ───────────────────────────────────────────── */
mark { background-color: #fef08a; border-radius: 2px; padding: 0 1px; }

/* ─── Toast ─────────────────────────────────────────────────────── */
#toast {
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
}
.toast-hidden  { opacity: 0; transform: translateX(-50%) translateY(8px); }
.toast-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ─── Status button colours ──────────────────────────────────────── */
.status-btn-reviewed  { background: #22c55e; color: #fff; }
.status-btn-discarded { background: #f87171; color: #fff; }
.status-btn-pending   { background: #e5e7eb; color: #374151; }
