/* Solaris Design Tokens & Base Styles */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --color-bg:         #0f0f0f;
  --color-surface:    #1a1a1a;
  --color-surface-2:  #242424;
  --color-border:     #2e2e2e;
  --color-accent:     #7c5cfc;
  --color-accent-dim: #4a3a99;
  --color-accent-hover: #9078ff;
  --color-text:       #e8e8e8;
  --color-text-muted: #888888;
  --color-danger:     #e05252;
  --color-success:    #52c07a;
  --color-warning:    #e0a852;
  --radius-sm:        6px;
  --radius-md:        12px;
  --radius-lg:        20px;
  --font-body:        'Inter', system-ui, sans-serif;
  --font-mono:        'JetBrains Mono', monospace;
}

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

html {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  padding-bottom: 72px; /* space for bottom nav */
}

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

/* Typography */
h1 { font-size: 1.5rem; font-weight: 600; }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1.1rem; font-weight: 500; }
.text-muted { color: var(--color-text-muted); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-mono { font-family: var(--font-mono); }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }

/* Layout */
.container {
  width: 100%;
  max-width: 768px;
  margin: 0 auto;
  padding: 0 16px;
}

.page-header {
  padding: 20px 0 12px;
}

.page-header h1 {
  margin-bottom: 4px;
}

/* Cards */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn:hover { opacity: 0.9; }

.btn-primary {
  background: var(--color-accent);
  color: #fff;
}

.btn-primary:hover { background: var(--color-accent-hover); color: #fff; }

.btn-secondary {
  background: var(--color-surface-2);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-block { width: 100%; }

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: border-color 0.15s;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--color-accent);
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
}

.form-error {
  color: var(--color-danger);
  font-size: 0.8rem;
  margin-top: 4px;
}

/* Tags */
.tag-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.tag-pill--colored {
  border-color: transparent;
  color: #fff;
}

.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Entry Card */
.entry-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 8px;
  display: block;
  color: var(--color-text);
  transition: border-color 0.15s;
}

.entry-card:hover {
  border-color: var(--color-accent-dim);
  color: var(--color-text);
}

.entry-card__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.entry-card__type-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.entry-card__title {
  font-weight: 500;
  font-size: 0.95rem;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-card__date {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.entry-card__body {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
}

.entry-card__footer {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Entry detail */
.entry-detail__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}

.entry-detail__body {
  font-size: 1rem;
  line-height: 1.7;
  white-space: pre-wrap;
}

.entry-detail__actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

/* Search */
.search-bar {
  position: relative;
  margin-bottom: 16px;
}

.search-bar__input {
  width: 100%;
  padding: 12px 16px 12px 42px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.95rem;
}

.search-bar__input:focus {
  outline: none;
  border-color: var(--color-accent);
}

.search-bar__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  font-size: 1rem;
}

/* Filter bar */
.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
}

.filter-bar::-webkit-scrollbar { display: none; }

.filter-chip {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--color-surface);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: all 0.15s;
}

.filter-chip:hover,
.filter-chip--active {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

/* Quick capture grid */
.capture-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.capture-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s;
  text-decoration: none;
}

.capture-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-text);
}

.capture-btn__icon {
  font-size: 1.5rem;
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 1000;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 12px;
  color: var(--color-text-muted);
  font-size: 0.65rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s;
}

.bottom-nav__item:hover,
.bottom-nav__item--active {
  color: var(--color-accent);
}

.bottom-nav__icon {
  font-size: 1.25rem;
}

/* Section headers */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0 8px;
}

.section-header__title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-muted);
}

.empty-state__icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state__text {
  font-size: 0.95rem;
  margin-bottom: 16px;
}

/* Badge / count */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--color-accent);
  color: #fff;
}

/* Pin indicator */
.pin-icon { color: var(--color-warning); }

/* Image thumbnail */
.entry-thumbnail {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

/* Utility */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.hidden { display: none; }

/* Auth page */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo__text {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-accent);
}

/* ── Phase 2: Recorder UI ────────────────────────────── */

.recorder-container {
  text-align: center;
  padding: 20px 0;
}

.waveform-canvas {
  width: 100%;
  height: 120px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.record-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid var(--color-border);
  background: var(--color-danger);
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 16px 0;
}

.record-btn:hover {
  transform: scale(1.05);
}

.record-btn--recording {
  animation: pulse-record 1.5s ease-in-out infinite;
  border-color: var(--color-danger);
}

.record-btn__inner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  transition: all 0.2s;
}

.record-btn--recording .record-btn__inner {
  width: 20px;
  height: 20px;
  border-radius: 4px;
}

@keyframes pulse-record {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 82, 82, 0.4); }
  50% { box-shadow: 0 0 0 16px rgba(224, 82, 82, 0); }
}

.timer-display {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 500;
  color: var(--color-text);
  margin: 8px 0;
}

.transcript-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  min-height: 100px;
  max-height: 200px;
  overflow-y: auto;
  text-align: left;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-top: 16px;
}

.chunk-status {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 8px;
}

/* Post-recording form */
.post-record-form {
  display: none;
  margin-top: 20px;
}

.post-record-form.active {
  display: block;
}

.audio-preview {
  width: 100%;
  margin-bottom: 16px;
}

/* ── Capture FAB ──────────────────────────────────────── */

.capture-fab {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-accent);
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 999;
  box-shadow: 0 4px 12px rgba(124, 92, 252, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.capture-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(124, 92, 252, 0.5);
}

.capture-fab--open {
  transform: rotate(45deg);
}

.capture-fab__icon {
  font-size: 1.8rem;
  line-height: 1;
  font-weight: 300;
}

/* Bottom sheet */
.capture-sheet {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1001;
}

.capture-sheet--open {
  display: block;
}

.capture-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.2s ease;
}

.capture-sheet__content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-surface);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  padding: 12px 20px 32px;
  animation: slideUp 0.25s ease;
  padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
}

.capture-sheet__handle {
  width: 36px;
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  margin: 0 auto 20px;
}

.capture-sheet__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.capture-sheet__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 8px;
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 0.15s;
}

.capture-sheet__item:hover {
  background: var(--color-accent-dim);
  color: #fff;
}

.capture-sheet__icon {
  font-size: 1.5rem;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  color: var(--color-text);
  font-size: 0.875rem;
  z-index: 2000;
  animation: slideUp 0.3s ease, fadeOut 0.3s ease 2.7s;
  pointer-events: none;
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* Responsive */
@media (min-width: 768px) {
  body { padding-bottom: 0; }

  .bottom-nav {
    position: static;
    height: auto;
    flex-direction: column;
    width: 80px;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    border-top: none;
    border-right: 1px solid var(--color-border);
    padding-top: 20px;
    justify-content: flex-start;
    gap: 4px;
  }

  .bottom-nav__item {
    padding: 12px;
  }

  .container {
    margin-left: 96px;
  }

  .capture-fab {
    bottom: 20px;
    right: 20px;
  }
}

/* ── Jarvis Chat ──────────────────────────────────────────────── */

.jarvis-chat {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 80px;
  min-height: 60vh;
}

.jarvis-msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.jarvis-msg--user {
  align-self: flex-end;
  background: var(--color-accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.jarvis-msg--assistant {
  align-self: flex-start;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-bottom-left-radius: 4px;
}

.jarvis-cited-entries {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0;
}

.jarvis-cited-entry {
  flex-shrink: 0;
  padding: 6px 10px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-decoration: none;
}

.jarvis-cited-entry:hover {
  border-color: var(--color-accent);
}

.jarvis-input-area {
  position: fixed;
  bottom: 64px;
  left: 0;
  right: 0;
  padding: 12px 16px;
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 8px;
  z-index: 100;
}

.jarvis-input {
  flex: 1;
  padding: 10px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.95rem;
}

.jarvis-input:focus {
  outline: none;
  border-color: var(--color-accent);
}

.jarvis-mic-btn, .jarvis-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.jarvis-send-btn {
  background: var(--color-accent);
  color: #fff;
}

.jarvis-mic-btn {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

.jarvis-mic-btn--active {
  background: var(--color-danger);
  border-color: var(--color-danger);
  color: #fff;
  animation: pulse-record 1.5s ease-in-out infinite;
}

/* ── Voice Orb ──────────────────────────────────────────────── */

.voice-orb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 15, 0.95);
  z-index: 2000;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.voice-orb-overlay--active {
  display: flex;
}

.voice-orb {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--color-accent);
  cursor: pointer;
  transition: all 0.3s;
}

.voice-orb--listening {
  animation: orb-pulse 2s ease-in-out infinite;
  box-shadow: 0 0 40px rgba(124, 92, 252, 0.5);
}

.voice-orb--thinking {
  animation: orb-spin 1s linear infinite;
  background: var(--color-accent-dim);
}

.voice-orb--speaking {
  box-shadow: 0 0 60px rgba(124, 92, 252, 0.7);
  animation: orb-glow 1.5s ease-in-out infinite;
}

@keyframes orb-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 40px rgba(124, 92, 252, 0.3); }
  50% { transform: scale(1.08); box-shadow: 0 0 60px rgba(124, 92, 252, 0.6); }
}

@keyframes orb-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes orb-glow {
  0%, 100% { box-shadow: 0 0 40px rgba(124, 92, 252, 0.4); }
  50% { box-shadow: 0 0 80px rgba(124, 92, 252, 0.8); }
}

.voice-orb-text {
  color: var(--color-text);
  font-size: 1rem;
  text-align: center;
  max-width: 300px;
  min-height: 48px;
}

.voice-orb-status {
  color: var(--color-text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

@media (min-width: 768px) {
  .jarvis-input-area {
    bottom: 0;
    left: 80px;
  }
  .jarvis-chat {
    padding-bottom: 80px;
  }
}
