/* ===== APP LAYOUT ===== */
.app-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 80px 32px 60px;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 60px;
  align-items: start;
  min-height: 100vh;
}

/* ===== RECORD SECTION ===== */
.record-section {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 140px);
  position: relative;
}

/* Starfield background for hero feel */
.record-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 40%, rgba(245, 158, 11, 0.07) 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 50% 50%, rgba(196, 181, 253, 0.04) 0%, transparent 60%);
  pointer-events: none;
}

.record-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* ─── Orb — hero element ─── */
.record-orb {
  position: relative;
  width: 260px;
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  /* Outer ambient glow */
  filter: drop-shadow(0 0 40px rgba(245, 158, 11, 0.12));
}

/* Idle: slow gentle pulse of outer rings */
.orb-ring--outer {
  border-color: rgba(245, 158, 11, 0.18);
  animation: ring-idle 4s ease-in-out infinite;
}
.orb-ring--middle {
  border-color: rgba(245, 158, 11, 0.14);
  animation: ring-idle 4s ease-in-out infinite 0.7s;
}
@keyframes ring-idle {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.06); opacity: 0.9; }
}

/* Recording: fast wave rings emanating outward */
.record-orb.is-recording .orb-ring--outer {
  border-color: rgba(245, 158, 11, 0.4);
  animation: ring-wave-out 1.8s ease-out infinite;
}
.record-orb.is-recording .orb-ring--middle {
  border-color: rgba(245, 158, 11, 0.35);
  animation: ring-wave-out 1.8s ease-out infinite 0.6s;
}
@keyframes ring-wave-out {
  0%   { transform: scale(0.85); opacity: 0; }
  20%  { opacity: 0.7; }
  80%  { opacity: 0.3; }
  100% { transform: scale(1.25); opacity: 0; }
}

/* Orb core — the big tap target */
.orb-core {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: var(--bg-3);
  border: 1.5px solid rgba(245, 158, 11, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 48px rgba(245, 158, 11, 0.1), inset 0 1px 0 rgba(255,255,255,0.04);
  position: relative;
  z-index: 2;
}

/* Idle mic icon — subtle glow */
.orb-core svg { color: var(--fg-muted); transition: color 0.2s, filter 0.2s; filter: drop-shadow(0 0 4px rgba(245,158,11,0)); }
.record-orb:hover .orb-core {
  border-color: rgba(245, 158, 11, 0.55);
  box-shadow: 0 0 70px rgba(245, 158, 11, 0.2);
  transform: scale(1.04);
}
.record-orb:hover .orb-core svg { color: var(--fg); filter: drop-shadow(0 0 6px rgba(245,158,11,0.3)); }

/* Subtle ring press feedback */
.record-orb:active .orb-core { transform: scale(0.97); }

.mic-btn {
  background: none;
  border: none;
  color: var(--fg-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  padding: 0;
  transition: color 0.2s;
}
.mic-btn:hover { color: var(--fg); }

/* Recording state */
.record-orb.is-recording .orb-core {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.7);
  box-shadow: 0 0 80px rgba(245, 158, 11, 0.4), 0 0 120px rgba(245, 158, 11, 0.15);
  animation: orb-breathe 1.8s ease-in-out infinite;
}
.record-orb.is-recording .mic-btn { color: var(--highlight); }
@keyframes orb-breathe {
  0%, 100% { transform: scale(1); box-shadow: 0 0 80px rgba(245, 158, 11, 0.35), 0 0 120px rgba(245, 158, 11, 0.1); }
  50% { transform: scale(1.06); box-shadow: 0 0 100px rgba(245, 158, 11, 0.5), 0 0 160px rgba(245, 158, 11, 0.2); }
}

.record-status {
  font-family: 'Playfair Display', serif;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--fg);
  text-align: center;
  min-height: 36px;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.record-status.is-recording { color: var(--highlight); }

.record-instruction {
  font-size: 0.78rem;
  color: var(--fg-muted);
  text-align: center;
  opacity: 0.65;
  letter-spacing: 0.04em;
  font-weight: 500;
}

.record-duration {
  font-family: 'DM Sans', sans-serif;
  font-size: 1.4rem;
  font-weight: 300;
  color: var(--fg);
  letter-spacing: 0.06em;
  min-height: 36px;
  font-variant-numeric: tabular-nums;
  opacity: 0.8;
}

.record-hint {
  font-size: 0.8rem;
  color: var(--fg-muted);
  text-align: center;
  max-width: 340px;
  line-height: 1.55;
  min-height: 20px;
  opacity: 0.8;
}

.mic-permission-error {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 12px;
  padding: 16px 20px;
  color: var(--fg-muted);
  font-size: 0.85rem;
  text-align: center;
  max-width: 340px;
}

/* ===== TRANSCRIPT SECTION ===== */
.transcript-section {
  padding: 40px 0;
}

.transcript-container {
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.section-eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.7;
}

.transcript-heading {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.transcript-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px 24px;
  position: relative;
  overflow: hidden;
}
.transcript-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(to right, var(--accent), transparent);
}

.transcript-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--highlight);
  animation: pulse 1.5s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.transcript-label span {
  font-size: 0.72rem;
  color: var(--fg-muted);
  font-weight: 500;
  letter-spacing: 0.06em;
}

.transcript-text {
  font-size: 0.95rem;
  color: var(--fg);
  line-height: 1.75;
  margin-bottom: 14px;
  min-height: 50px;
  font-style: italic;
}

.transcript-meta {
  font-size: 0.68rem;
  color: var(--accent-dim);
  font-weight: 500;
  letter-spacing: 0.03em;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ===== GAP FILLING ===== */
.gap-section { display: flex; flex-direction: column; gap: 14px; }

.gap-heading {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.gap-topic {
  color: var(--highlight);
  font-style: italic;
}

.gap-sub {
  font-size: 0.85rem;
  color: var(--fg-muted);
  line-height: 1.65;
  opacity: 0.85;
}

.gap-input {
  width: 100%;
  min-height: 110px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  color: var(--fg);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  line-height: 1.65;
  resize: vertical;
  transition: border-color 0.25s, box-shadow 0.25s;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.gap-input:focus {
  outline: none;
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px rgba(196,181,253,0.1), 0 2px 12px rgba(0,0,0,0.2);
}
.gap-input::placeholder { color: var(--fg-muted); }

/* ===== ENTRY PREVIEW ===== */
.entry-preview { display: flex; flex-direction: column; gap: 18px; }

.entry-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.entry-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(to right, var(--highlight), transparent);
}

.entry-meta {
  font-size: 0.72rem;
  color: var(--accent-dim);
  font-weight: 500;
  letter-spacing: 0.04em;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.entry-body {
  font-size: 0.92rem;
  color: var(--fg);
  line-height: 1.8;
  white-space: pre-wrap;
}

.entry-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 4px;
}

/* ===== BUTTONS ===== */
.btn {
  padding: 13px 26px;
  border-radius: 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.01em;
}

.btn--primary {
  background: var(--accent);
  color: #0d0f1a;
  box-shadow: 0 4px 16px rgba(196,181,253,0.3);
}
.btn--primary:hover {
  background: #d4c5ff;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(196,181,253,0.4);
}
.btn--primary:active { transform: translateY(0); box-shadow: 0 2px 8px rgba(196,181,253,0.2); }

.btn--ghost {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border);
}
.btn--ghost:hover {
  background: var(--bg-3);
  color: var(--fg);
  border-color: var(--fg-muted);
}

/* ===== SAVE CONFIRM ===== */
.save-confirm {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  background: rgba(196, 181, 253, 0.07);
  border: 1px solid rgba(196, 181, 253, 0.18);
  border-radius: 14px;
  font-size: 0.88rem;
  color: var(--fg-muted);
}
.save-confirm-icon {
  color: var(--accent);
  flex-shrink: 0;
}

/* ===== HISTORY SIDEBAR ===== */
.history-sidebar {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

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

.history-header h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.01em;
}

.history-clear {
  font-size: 0.72rem;
  color: var(--fg-muted);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  opacity: 0.7;
}
.history-clear:hover { color: var(--fg); opacity: 1; }

.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.history-entry {
  padding: 14px 16px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}
.history-entry:hover {
  border-color: var(--accent-dim);
  background: var(--card);
  transform: translateX(-2px);
}

.history-entry-date {
  font-size: 0.68rem;
  color: var(--accent-dim);
  font-weight: 500;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.history-entry-preview {
  font-size: 0.8rem;
  color: var(--fg-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.history-empty {
  text-align: center;
  padding: 24px 16px;
  font-size: 0.82rem;
  color: var(--fg-muted);
  line-height: 1.7;
  opacity: 0.7;
}

/* ─── Orb rings (override theme.css landing sizing for app page) ─── */
.record-orb .orb-ring--outer {
  width: 260px;
  height: 260px;
  border-radius: 50%;
  border: 1px solid;
}
.record-orb .orb-ring--middle {
  width: 190px;
  height: 190px;
  border-radius: 50%;
  border: 1px solid;
}
@media (max-width: 900px) {
  .app-main {
    grid-template-columns: 1fr;
    padding: 80px 24px 40px;
    gap: 40px;
  }
  .history-sidebar {
    position: static;
    max-height: none;
  }
  .record-section { min-height: auto; }
}