/* ================================================================
   ScribeAI — Mobile-first stylesheet
   Base = mobile, enhancements via min-width queries
   ================================================================ */

:root {
  --font-ui: "Segoe UI Variable Text", "Segoe UI Variable", "Segoe UI", "Inter", system-ui, -apple-system, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI Variable", "Segoe UI", "Inter", system-ui, sans-serif;

  --black: #000000;
  --sidebar-bg: #040c07;
  --sidebar-line: rgba(134, 239, 172, 0.12);

  --ink: #0c1512;
  --muted: #5c6b64;
  --card: #ffffff;
  --line: #dce5e0;

  --emerald-100: #d1fae5;
  --emerald-200: #86efac;
  --emerald-400: #4ade80;
  --emerald-600: #059669;
  --emerald-700: #047857;
  --emerald-900: #064e3b;

  --bg: #f4f8f5;
  --radius: 14px;
  --shadow: 0 12px 30px rgba(6, 78, 59, 0.08);

  /* safe areas for notch / home bar */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  /* layout */
  --topbar-h: 54px;
  --sidebar-w: 290px;
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  height: 100%;
  /* prevent elastic bounce on iOS outside scroll areas */
  overscroll-behavior: none;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--bg);
  /* prevent body scroll, each scrollable area manages its own */
  overflow: hidden;
  overscroll-behavior: none;
}

h1, h2, h3, p { margin: 0; }

.hidden { display: none !important; }

/* ============================================================
   INTERACTIVE RESETS
   ============================================================ */

button {
  font-family: inherit;
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
}

input {
  font-family: inherit;
  border: 0;
  background: none;
  padding: 0;
}

input:focus, button:focus-visible {
  outline: 2px solid var(--emerald-600);
  outline-offset: 2px;
}

/* ============================================================
   LOGO
   ============================================================ */

.logo {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.logo-img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.logo-text {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: #fff;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 10px;
  background: var(--emerald-600);
  color: #fff;
  padding: 0.75rem 1.1rem;
  font-weight: 600;
  font-size: 0.95rem;
  font-family: inherit;
  min-height: 44px;
  /* no tap delay on mobile */
  touch-action: manipulation;
  transition: background 120ms ease, box-shadow 120ms ease;
  white-space: nowrap;
}

.btn:active {
  background: var(--emerald-700);
}

@media (hover: hover) {
  .btn:hover {
    background: var(--emerald-700);
    box-shadow: 0 8px 20px rgba(5, 150, 105, 0.25);
  }
}

.btn.ghost {
  background: #e8efeb;
  color: var(--emerald-900);
}

.btn.ghost:active { background: #dbe6e0; }

@media (hover: hover) {
  .btn.ghost:hover { background: #dbe6e0; box-shadow: none; }
}

.btn.outline {
  background: transparent;
  color: #e7fff2;
  border: 1px solid rgba(134, 239, 172, 0.45);
}

.btn.xl {
  padding: 1rem 2rem;
  font-size: 1.05rem;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--emerald-400) 0%, var(--emerald-600) 100%);
  color: #02100a;
  font-weight: 700;
  min-height: 52px;
}

.btn.new-meeting {
  width: 100%;
  background: transparent;
  border: 1px solid rgba(134, 239, 172, 0.35);
  color: var(--emerald-200);
}

.btn.new-meeting:active {
  background: rgba(134, 239, 172, 0.08);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  color: rgba(209, 250, 229, 0.85);
  touch-action: manipulation;
  flex-shrink: 0;
}

.icon-btn svg {
  width: 22px;
  height: 22px;
}

.icon-btn:active {
  background: rgba(134, 239, 172, 0.1);
}

.link-btn {
  color: rgba(167, 243, 208, 0.6);
  font-size: 0.8rem;
  touch-action: manipulation;
}

.link-btn:active { color: var(--emerald-200); }

/* ============================================================
   LANDING
   ============================================================ */

.landing {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  color: #ecfdf5;
  background: var(--black);
}

.velaris-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.landing-nav,
.hero,
.feature-band,
.landing-footer {
  position: relative;
  z-index: 1;
}

.landing-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(1rem + var(--safe-top)) 1.2rem 1rem;
}

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2.5rem 1.2rem 2rem;
}

.hero-kicker {
  display: inline-block;
  border: 1px solid rgba(134, 239, 172, 0.35);
  background: rgba(6, 78, 59, 0.35);
  color: var(--emerald-200);
  border-radius: 999px;
  padding: 0.4rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 1.4rem;
  backdrop-filter: blur(4px);
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 10vw, 5rem);
  font-weight: 800;
  line-height: 1.06;
  color: #fff;
  letter-spacing: -0.03em;
  text-shadow: 0 2px 40px rgba(0, 0, 0, 0.4);
}

.hero h1 em {
  font-style: normal;
  background: linear-gradient(90deg, var(--emerald-200) 0%, var(--emerald-400) 55%, var(--emerald-600) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  margin: 1.2rem auto 2rem;
  max-width: 520px;
  font-size: 1rem;
  line-height: 1.7;
  color: rgba(209, 250, 229, 0.75);
}

.hero-cta {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  width: 100%;
  max-width: 480px;
}

.hero-cta .btn.xl {
  width: 100%;
}

.hero-hint {
  margin-top: 0.9rem;
  font-size: 0.84rem;
  color: rgba(167, 243, 208, 0.5);
  min-height: 1.2em;
}

.feature-band {
  border-top: 1px solid rgba(134, 239, 172, 0.14);
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
}

.feature-grid {
  padding: 1.4rem 1.2rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.feature svg {
  width: 24px;
  height: 24px;
  color: var(--emerald-400);
}

.feature h3 {
  margin: 0.55rem 0 0.3rem;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
}

.feature p {
  color: rgba(209, 250, 229, 0.5);
  font-size: 0.82rem;
  line-height: 1.5;
}

.landing-footer {
  text-align: center;
  padding: 1rem 1rem calc(1rem + var(--safe-bottom));
  color: rgba(167, 243, 208, 0.35);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

/* ============================================================
   APP SHELL (mobile-first)
   ============================================================ */

.app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* ------ Drawer overlay (mobile) ------ */

.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 40;
  opacity: 0;
  transition: opacity 200ms ease;
  backdrop-filter: blur(2px);
}

.drawer-overlay.visible {
  display: block;
  opacity: 1;
}

/* ------ Sidebar (drawer on mobile, fixed column on desktop) ------ */

.sidebar {
  position: fixed;
  inset-block: 0;
  left: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: #d6efe2;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: calc(var(--safe-top) + 0.8rem) 0.9rem calc(var(--safe-bottom) + 0.9rem);
  border-right: 1px solid var(--sidebar-line);
  z-index: 50;
  transform: translateX(-100%);
  transition: transform 220ms cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.close-btn {
  color: rgba(167, 243, 208, 0.6);
}

.meeting-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.meeting-item {
  border-radius: 10px;
  padding: 0.65rem 0.7rem;
  transition: background 120ms ease;
  min-height: 44px;
  touch-action: manipulation;
}

.meeting-item:active {
  background: rgba(134, 239, 172, 0.1);
}

.meeting-item.active {
  background: rgba(134, 239, 172, 0.13);
}

.meeting-item-title {
  width: 100%;
  text-align: left;
  color: #e5f7ec;
  font-weight: 500;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  touch-action: manipulation;
}

.meeting-item .meta {
  color: rgba(167, 243, 208, 0.45);
  font-size: 0.74rem;
  margin-top: 0.15rem;
}

.sidebar-footer {
  border-top: 1px solid var(--sidebar-line);
  padding-top: 0.8rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--emerald-400) 0%, var(--emerald-700) 100%);
  color: #02100a;
  font-weight: 700;
  flex-shrink: 0;
}

.user-info { min-width: 0; }

.user-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ------ App body (right of sidebar on desktop) ------ */

.app-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ------ Mobile top bar ------ */

.mobile-topbar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: calc(var(--safe-top) + 0.4rem) calc(0.75rem + var(--safe-right)) 0.4rem calc(0.75rem + var(--safe-left));
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--sidebar-line);
  min-height: var(--topbar-h);
  flex-shrink: 0;
  z-index: 10;
}

.topbar-title {
  flex: 1;
  text-align: center;
  color: #e5f7ec;
  font-weight: 600;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 0.25rem;
}

/* ------ Main scrollable area ------ */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1rem 1rem calc(1rem + var(--safe-bottom));
  overscroll-behavior: contain;
}

.main-head {
  margin-bottom: 0.75rem;
}

.title-input {
  width: 100%;
  font-family: var(--font-display);
  color: var(--ink);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  border-bottom: 2px solid transparent;
  padding: 0.1rem 0;
  background: transparent;
  transition: border-color 130ms ease;
  /* iOS zoom prevention: min 16px */
  -webkit-text-size-adjust: 100%;
}

.title-input:focus {
  outline: none;
  border-bottom-color: #bcd9cb;
}

.muted {
  color: var(--muted);
  font-size: 0.84rem;
}

/* ============================================================
   STAGES
   ============================================================ */

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.9rem;
  padding: 2rem 1rem;
  min-height: 60dvh;
}

.stage h2 {
  font-size: 1.3rem;
  font-weight: 700;
}

.stage .muted {
  max-width: 360px;
  line-height: 1.6;
}

/* Record button — mobile sized */
.record-btn {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--emerald-400) 0%, var(--emerald-600) 100%);
  color: #02100a;
  box-shadow: 0 14px 44px rgba(5, 150, 105, 0.4);
  touch-action: manipulation;
  transition: transform 130ms ease, box-shadow 130ms ease;
  -webkit-tap-highlight-color: transparent;
}

.record-btn:active {
  transform: scale(0.95);
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.35);
}

.record-btn svg {
  width: 42px;
  height: 42px;
}

.record-btn.recording {
  background: #dc2626;
  color: #fff;
  animation: pulse 1.6s ease-in-out infinite;
}

.stop-square {
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #fff;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.5); }
  50% { box-shadow: 0 0 0 24px rgba(220, 38, 38, 0); }
}

.rec-timer {
  font-size: 1.15rem;
  font-weight: 700;
  color: #dc2626;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.dots span { animation: blink 1.4s infinite; }
.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

.live-transcript {
  width: 100%;
  max-height: 260px;
  overflow-y: auto;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
  -webkit-overflow-scrolling: touch;
}

.live-transcript p {
  margin: 0 0 0.45rem;
  line-height: 1.6;
  font-size: 0.93rem;
}

.live-transcript .interim {
  color: var(--muted);
  font-style: italic;
}

.stt-warning {
  color: #a13215;
  background: #fde5e1;
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-size: 0.88rem;
  text-align: center;
  width: 100%;
  max-width: 420px;
}

.spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 4px solid var(--emerald-100);
  border-top-color: var(--emerald-600);
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   NOTES
   ============================================================ */

.notes-stage {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.notes-toolbar {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.ai-output {
  display: grid;
  gap: 0.8rem;
}

.ai-section {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  background: var(--card);
  box-shadow: var(--shadow);
}

.ai-section h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--emerald-700);
  margin-bottom: 0.5rem;
}

.ai-section p,
.ai-section li {
  font-size: 0.93rem;
  line-height: 1.6;
}

.ai-section ul {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.3rem;
}

.ai-section.notes p { white-space: pre-wrap; }

.ai-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
}

.email-draft {
  background: #fbfdfc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  margin-top: 0.5rem;
}

.email-draft .subject {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}

.email-draft .body {
  color: #33463e;
  font-size: 0.86rem;
  white-space: pre-wrap;
}

.action-item {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
}

.prio {
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  text-transform: uppercase;
  flex-shrink: 0;
  margin-top: 0.2rem;
}

.prio.high { background: #fde5e1; color: #a13215; }
.prio.medium { background: #fdf4d7; color: #7d6105; }
.prio.low { background: #e8efeb; color: #3e514a; }

.transcript-details {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  padding: 0.7rem 0.95rem;
}

.transcript-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--emerald-700);
  user-select: none;
  min-height: 32px;
  display: flex;
  align-items: center;
}

.full-transcript { margin-top: 0.7rem; }

.full-transcript p {
  margin: 0 0 0.45rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #33463e;
}

/* ============================================================
   TABLET ≥ 640px
   ============================================================ */

@media (min-width: 640px) {
  .feature-grid {
    grid-template-columns: repeat(4, 1fr);
    padding: 2rem 2rem;
  }

  .hero {
    padding: 4rem 2rem 3rem;
  }

  .hero-cta .btn.xl {
    width: auto;
  }

  .record-btn {
    width: 130px;
    height: 130px;
  }

  .record-btn svg {
    width: 50px;
    height: 50px;
  }

  .ai-columns {
    grid-template-columns: 1fr 1fr;
  }

  .live-transcript {
    max-height: 300px;
  }
}

/* ============================================================
   DESKTOP ≥ 960px — sidebar always visible
   ============================================================ */

@media (min-width: 960px) {
  .app {
    flex-direction: row;
  }

  /* sidebar becomes a permanent left column */
  .sidebar {
    position: static;
    transform: none !important;
    width: var(--sidebar-w);
    flex-shrink: 0;
    transition: none;
    padding-top: 1.1rem;
    padding-bottom: 1.1rem;
  }

  .sidebar-top .close-btn {
    display: none;
  }

  /* overlay not needed on desktop */
  .drawer-overlay {
    display: none !important;
  }

  .app-body {
    flex: 1;
    min-width: 0;
  }

  /* hide mobile topbar */
  .mobile-topbar {
    display: none;
  }

  .main {
    padding: 1.4rem 2rem 2rem;
  }

  .stage {
    min-height: 0;
  }

  .record-btn {
    width: 130px;
    height: 130px;
  }

  .record-btn svg {
    width: 50px;
    height: 50px;
  }
}

/* ============================================================
   LARGE DESKTOP ≥ 1280px
   ============================================================ */

@media (min-width: 1280px) {
  .main {
    padding: 1.6rem 2.5rem 2.5rem;
    max-width: 1000px;
  }

  .ai-columns {
    grid-template-columns: 1fr 1fr;
  }
}

/* ============================================================
   MEETING ITEM — rename / delete (added)
   ============================================================ */

.meeting-item {
  position: relative;
}

.meeting-item-body {
  display: grid;
  gap: 0.15rem;
}

.meeting-item-actions {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.35rem;
}

.item-action-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  color: rgba(167, 243, 208, 0.5);
  touch-action: manipulation;
  transition: background 120ms ease, color 120ms ease;
}

.item-action-btn svg {
  width: 14px;
  height: 14px;
}

.item-action-btn:active,
.item-action-btn:hover {
  background: rgba(134, 239, 172, 0.12);
  color: var(--emerald-200);
}

.item-action-btn.delete:active,
.item-action-btn.delete:hover {
  background: rgba(220, 38, 38, 0.15);
  color: #fca5a5;
}

.rename-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(134, 239, 172, 0.35);
  border-radius: 8px;
  color: #e5f7ec;
  font-size: 0.88rem;
  padding: 0.4rem 0.5rem;
  font-family: inherit;
  margin-top: 0.25rem;
}

.rename-input:focus {
  outline: none;
  border-color: var(--emerald-400);
}

.delete-confirm {
  padding: 0.4rem 0;
  display: grid;
  gap: 0.35rem;
}

.delete-confirm-text {
  font-size: 0.82rem;
  color: #fca5a5;
}

.delete-confirm-btns {
  display: flex;
  gap: 0.4rem;
}

.confirm-yes {
  flex: 1;
  background: rgba(220, 38, 38, 0.75);
  color: #fff;
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0;
  font-family: inherit;
  touch-action: manipulation;
}

.confirm-yes:active { background: rgba(220, 38, 38, 0.9); }

.confirm-no {
  flex: 1;
  background: rgba(134, 239, 172, 0.08);
  color: var(--emerald-200);
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0;
  font-family: inherit;
  touch-action: manipulation;
}

.confirm-no:active { background: rgba(134, 239, 172, 0.15); }

/* ============================================================
   NOTES EDIT MODE (added)
   ============================================================ */

.edit-mode-banner {
  background: #fefce8;
  border: 1px solid #fde047;
  border-radius: 12px;
  padding: 0.8rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.edit-mode-banner p {
  font-size: 0.88rem;
  font-weight: 600;
  color: #713f12;
}

.edit-mode-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.edit-section {
  display: grid;
  gap: 0.4rem;
}

.edit-section label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--emerald-700);
}

.edit-section textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  font-family: var(--font-ui);
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--ink);
  background: #fff;
  resize: vertical;
  min-height: 60px;
}

.edit-section textarea:focus {
  outline: 2px solid rgba(5, 150, 105, 0.35);
  outline-offset: 1px;
  border-color: var(--emerald-600);
}
