/* ============================================================
   VoiceNotes — Dark Theme Stylesheet
   Matches gocomputerhelp.com dark aesthetic
   ============================================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
  --bg:             #0d1117;
  --surface:        #161b22;
  --border:         #21262d;
  --text:           #c9d1d9;
  --text-secondary: #8b949e;
  --accent:         #00bcd4;
  --accent-hover:   #00a5bb;
  --danger:         #f85149;
  --success:        #3fb950;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #30363d;
}

/* ============================================================
   Layout
   ============================================================ */

/* App root — flex column, full viewport height */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 100;
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 700;
  color: #e6edf3;
  white-space: nowrap;
  flex-shrink: 0;
}

.topbar .brand svg {
  color: var(--accent);
}

.topbar .search-wrap {
  flex: 1;
  max-width: 480px;
  margin: 0 auto;
}

.topbar .search-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 6px 12px;
  outline: none;
  transition: border-color 0.2s;
}

.topbar .search-input::placeholder {
  color: var(--text-secondary);
}

.topbar .search-input:focus {
  border-color: var(--accent);
}

.topbar .user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}

.topbar .user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #0d1117;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
}

.topbar .user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.topbar .user-name {
  font-size: 13px;
  color: var(--text);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Main Area ---------- */
.main {
  display: flex;
  flex-direction: row;
  flex: 1;
  overflow: hidden;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-section {
  padding: 12px 8px 4px;
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  margin-bottom: 2px;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 8px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
  font-size: 13px;
  transition: background 0.15s;
  user-select: none;
}

.sidebar-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-item.active {
  background: rgba(0, 188, 212, 0.12);
  color: var(--accent);
}

.sidebar-item svg {
  flex-shrink: 0;
  opacity: 0.75;
}

.sidebar-item.active svg {
  opacity: 1;
}

.sidebar-item .item-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-item .item-count {
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg);
  border-radius: 10px;
  padding: 1px 6px;
  flex-shrink: 0;
}

.folder-indent {
  padding-left: 28px;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 12px;
}

.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 12px 8px;
}

/* ---------- Note List ---------- */
.note-list {
  width: 260px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.note-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.note-list-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.note-list-scroll {
  flex: 1;
  overflow-y: auto;
}

.note-item {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.note-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.note-item.active {
  background: rgba(0, 188, 212, 0.08);
  border-left: 2px solid var(--accent);
}

.note-item-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 3px;
}

.note-item-preview {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 5px;
}

.note-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.note-item-date {
  font-size: 11px;
  color: var(--text-secondary);
}

/* ---------- Editor Pane ---------- */
.editor-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

/* Editor toolbar */
.toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.toolbar-separator {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

/* Editor title */
.editor-title-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: #e6edf3;
  font-family: var(--font);
  font-size: 1.4rem;
  font-weight: 700;
  padding: 16px 20px 12px;
  outline: none;
  flex-shrink: 0;
  transition: border-color 0.2s;
}

.editor-title-input::placeholder {
  color: var(--text-secondary);
  font-weight: 400;
}

.editor-title-input:focus {
  border-bottom-color: var(--accent);
}

/* Editor action bar (export, share, tags) */
.editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.editor-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}

/* ProseMirror content area */
.editor-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

#editor {
  height: 100%;
}

/* ---------- Voice Bar ---------- */
.voice-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.voice-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.voice-bar-status {
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 80px;
}

.voice-bar-status.recording {
  color: var(--danger);
}

.voice-bar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mode-toggle {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.mode-toggle-btn {
  padding: 5px 10px;
  font-size: 12px;
  font-family: var(--font);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.mode-toggle-btn.active {
  background: var(--accent);
  color: #0d1117;
  font-weight: 600;
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--accent);
  color: #0d1117;
  border: none;
  border-radius: 6px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, opacity 0.2s;
  white-space: nowrap;
}

.btn:hover {
  background: var(--accent-hover);
  color: #0d1117;
  text-decoration: none;
}

.btn:active {
  opacity: 0.85;
}

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

/* Small button */
.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* Ghost / outline button */
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

/* Danger button */
.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

.btn-danger:hover {
  background: rgba(248, 81, 73, 0.1);
  color: var(--danger);
}

/* Icon-only toolbar buttons */
.toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.toolbar-btn.is-active {
  background: rgba(0, 188, 212, 0.15);
  color: var(--accent);
}

/* Microphone / voice button */
.voice-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #0d1117;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  flex-shrink: 0;
}

.voice-btn:hover {
  background: var(--accent-hover);
}

.voice-btn:active {
  transform: scale(0.93);
}

.voice-btn.recording {
  background: var(--danger);
  animation: pulse 1.4s ease-in-out infinite;
}

/* ============================================================
   Recording Pulse Animation
   ============================================================ */

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(248, 81, 73, 0.6); }
  60%  { box-shadow: 0 0 0 10px rgba(248, 81, 73, 0); }
  100% { box-shadow: 0 0 0 0 rgba(248, 81, 73, 0); }
}

/* ============================================================
   Tag Pills
   ============================================================ */

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: opacity 0.15s;
}

.tag-pill:hover {
  opacity: 0.85;
}

/* Default tag colors — JavaScript can override via inline style */
.tag-pill.default {
  background: rgba(0, 188, 212, 0.12);
  color: var(--accent);
  border-color: rgba(0, 188, 212, 0.25);
}

.tag-pill .tag-remove {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  opacity: 0.7;
  font-size: 13px;
}

.tag-pill .tag-remove:hover {
  opacity: 1;
}

/* ============================================================
   Empty States
   ============================================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 24px;
  text-align: center;
  height: 100%;
  color: var(--text-secondary);
}

.empty-state svg {
  opacity: 0.3;
}

.empty-state-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.empty-state-desc {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 240px;
  line-height: 1.5;
}

/* ============================================================
   ProseMirror / Tiptap Editor Content
   ============================================================ */

.ProseMirror {
  outline: none;
  min-height: 200px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.75;
}

.ProseMirror p {
  margin-bottom: 0.75em;
}

.ProseMirror p:last-child {
  margin-bottom: 0;
}

.ProseMirror h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: #e6edf3;
  margin: 1.2em 0 0.4em;
  line-height: 1.3;
}

.ProseMirror h2 {
  font-size: 1.35rem;
  font-weight: 600;
  color: #e6edf3;
  margin: 1em 0 0.4em;
  line-height: 1.35;
}

.ProseMirror h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #e6edf3;
  margin: 0.9em 0 0.35em;
  line-height: 1.4;
}

.ProseMirror ul,
.ProseMirror ol {
  padding-left: 1.5em;
  margin-bottom: 0.75em;
}

.ProseMirror li {
  margin-bottom: 0.25em;
}

.ProseMirror li p {
  margin-bottom: 0;
}

.ProseMirror code {
  background: rgba(110, 118, 129, 0.2);
  border-radius: 4px;
  color: #e6edf3;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.875em;
  padding: 0.15em 0.4em;
}

.ProseMirror pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: #e6edf3;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.875em;
  margin-bottom: 0.75em;
  overflow-x: auto;
  padding: 14px 16px;
  line-height: 1.6;
}

.ProseMirror pre code {
  background: transparent;
  border-radius: 0;
  color: inherit;
  font-size: inherit;
  padding: 0;
}

.ProseMirror blockquote {
  border-left: 3px solid var(--accent);
  color: var(--text-secondary);
  margin: 0 0 0.75em;
  padding: 0.25em 0 0.25em 1em;
  font-style: italic;
}

.ProseMirror blockquote p {
  margin-bottom: 0;
}

.ProseMirror hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5em 0;
}

.ProseMirror a {
  color: var(--accent);
  text-decoration: underline;
}

.ProseMirror a:hover {
  color: var(--accent-hover);
}

/* Placeholder */
.ProseMirror p.is-editor-empty:first-child::before {
  color: var(--text-secondary);
  content: attr(data-placeholder);
  float: left;
  height: 0;
  pointer-events: none;
}

/* Selection */
.ProseMirror ::selection {
  background: rgba(0, 188, 212, 0.25);
}

/* ============================================================
   Misc Utilities
   ============================================================ */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.text-muted   { color: var(--text-secondary); }
.text-accent  { color: var(--accent); }

.flex          { display: flex; }
.flex-col      { flex-direction: column; }
.items-center  { align-items: center; }
.gap-2         { gap: 8px; }
.ml-auto       { margin-left: auto; }

/* ============================================================
   Mobile Responsive — max-width: 768px
   ============================================================ */

@media (max-width: 768px) {
  /* Hide sidebar and note list; editor fills width */
  .sidebar {
    display: none;
  }

  .note-list {
    width: 100%;
    border-right: none;
  }

  /* When a note is active on mobile, hide note-list and show editor */
  .note-list.hidden-mobile {
    display: none;
  }

  .editor-pane {
    width: 100%;
  }

  /* Topbar: hide user name, shrink search */
  .topbar .user-name {
    display: none;
  }

  .topbar .search-wrap {
    max-width: none;
    margin: 0;
  }

  /* Voice bar: stack on small screens */
  .voice-bar {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Editor title smaller on mobile */
  .editor-title-input {
    font-size: 1.1rem;
    padding: 12px 14px 10px;
  }

  .editor-content {
    padding: 14px;
  }

  /* Toolbar: allow wrapping */
  .toolbar {
    gap: 1px;
    padding: 4px 8px;
  }
}

@media (max-width: 480px) {
  .topbar {
    padding: 0 10px;
    gap: 8px;
  }

  .topbar .brand span {
    display: none;
  }
}
