/* ── Base ───────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }

/* ── Dark mode surface overrides for Tailwind class strategy ────────────────── */
.dark body { background-color: #0f172a; color: #e2e8f0; }

/* ── Card ───────────────────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: 1rem;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
}
.dark .card {
  background: #1e293b;
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
}

/* ── Recording pulse ────────────────────────────────────────────────────────── */
@keyframes pulse-ring {
  0%   { transform: scale(.8); opacity: 1; }
  100% { transform: scale(2);  opacity: 0; }
}
.rec-pulse::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #ef4444;
  animation: pulse-ring 1.2s ease-out infinite;
}
.rec-pulse { position: relative; display: inline-block; }

/* ── Split editor ───────────────────────────────────────────────────────────── */
.split-editor {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.split-editor > * {
  flex: 1;
  min-width: 0;
  min-height: 16rem;
  overflow-y: auto;
}
.split-editor > .minutes-resize-handle {
  flex: 0 0 auto;
  min-height: 0;
  overflow: visible;
}
.minutes-resize-handle {
  display: none;
  flex-shrink: 0;
  width: 10px;
  cursor: col-resize;
  align-self: stretch;
  position: relative;
  z-index: 5;
}
@media (min-width: 640px) {
  .split-editor {
    flex-direction: row;
    height: 28rem;
    gap: 0;
  }
  .split-editor > * {
    min-height: 0;
  }
  .split-editor .minutes-editor-pane,
  .split-editor #minutes-preview {
    flex: 1 1 0;
    min-width: 100px;
  }
  .minutes-editor-pane {
    min-height: 0;
  }
  .minutes-resize-handle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .minutes-resize-handle::after {
    content: '';
    display: block;
    width: 3px;
    height: 40px;
    border-radius: 2px;
    background: #cbd5e1;
    transition: background .15s;
  }
  .dark .minutes-resize-handle::after { background: #475569; }
  .minutes-resize-handle:hover::after,
  .minutes-resize-handle.dragging::after { background: #6366f1; }
  #main-layout.layout-wide #left-panel .split-editor {
    flex-direction: row;
    height: 28rem;
    gap: 0;
  }
  #main-layout.layout-wide #left-panel .split-editor > *:not(.minutes-resize-handle) {
    min-height: 0;
  }
  #left-panel.panel-narrow .minutes-resize-handle {
    display: none;
  }
}
.minutes-editor-pane {
  display: flex;
  flex-direction: column;
  min-height: 16rem;
  overflow: hidden;
}
.minutes-editor-pane #minutes-editor {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
#minutes-editor {
  resize: none;
  font-family: 'JetBrains Mono', 'Fira Mono', ui-monospace, monospace;
  font-size: .82rem;
  line-height: 1.6;
  padding: .75rem;
  border-radius: .5rem;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #1e293b;
  outline: none;
}
#minutes-editor:focus { border-color: #6366f1; box-shadow: 0 0 0 2px #6366f133; }
.dark #minutes-editor { background: #0f172a; border-color: #334155; color: #e2e8f0; }

/* ── Markdown preview prose ─────────────────────────────────────────────────── */
#minutes-preview {
  padding: .75rem 1rem;
  border-radius: .5rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  font-size: .875rem;
  line-height: 1.7;
  color: #1e293b;
}
.dark #minutes-preview { background: #0f172a; border-color: #334155; color: #cbd5e1; }

#minutes-preview h1,
#minutes-preview h2,
#minutes-preview h3 { font-weight: 700; margin: 1em 0 .4em; color: #0f172a; }
.dark #minutes-preview h1,
.dark #minutes-preview h2,
.dark #minutes-preview h3 { color: #f1f5f9; }
#minutes-preview h1 { font-size: 1.2em; }
#minutes-preview h2 { font-size: 1.05em; border-bottom: 1px solid #e2e8f0; padding-bottom: .2em; }
.dark #minutes-preview h2 { border-color: #334155; }
#minutes-preview h3 { font-size: .95em; }
#minutes-preview p  { margin: .5em 0; }
#minutes-preview ul,
#minutes-preview ol { margin: .5em 0; padding-left: 1.4em; }
#minutes-preview li { margin: .2em 0; }
#minutes-preview strong { font-weight: 700; }
#minutes-preview em     { font-style: italic; }
#minutes-preview code {
  background: #f1f5f9;
  border-radius: .25em;
  padding: .1em .3em;
  font-size: .85em;
  font-family: ui-monospace, monospace;
}
.dark #minutes-preview code { background: #1e293b; }
#minutes-preview blockquote {
  border-left: 3px solid #6366f1;
  margin: .5em 0;
  padding-left: .75em;
  color: #64748b;
}
#minutes-preview hr { border: none; border-top: 1px solid #e2e8f0; margin: .75em 0; }
.dark #minutes-preview hr { border-color: #334155; }
#minutes-preview table { border-collapse: collapse; width: 100%; font-size: .85em; }
#minutes-preview th,
#minutes-preview td { border: 1px solid #e2e8f0; padding: .3em .6em; }
.dark #minutes-preview th,
.dark #minutes-preview td { border-color: #334155; }
#minutes-preview th { background: #f8fafc; font-weight: 600; }
.dark #minutes-preview th { background: #1e293b; }

/* ── Transcript area ────────────────────────────────────────────────────────── */
.transcript-split {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  flex: 1;
  min-height: 0;
}
.transcript-split.with-translation {
  flex-direction: row;
  align-items: stretch;
  gap: 0;
}
.transcript-pane,
.translation-pane {
  flex: 1;
  min-width: 0;
  min-height: 10rem;
  display: flex;
  flex-direction: column;
}
.pane-action-bar {
  flex-shrink: 0;
}
.transcript-split.with-translation .transcript-pane,
.transcript-split.with-translation .translation-pane {
  flex: 1 1 0;
  min-width: 120px;
}
.transcript-resize-handle {
  display: none;
  flex-shrink: 0;
  width: 10px;
  cursor: col-resize;
  align-self: stretch;
  position: relative;
  z-index: 5;
}
.transcript-split.with-translation .transcript-resize-handle {
  display: flex;
  align-items: center;
  justify-content: center;
}
.transcript-resize-handle::after {
  content: '';
  display: block;
  width: 3px;
  height: 40px;
  border-radius: 2px;
  background: #cbd5e1;
  transition: background .15s;
}
.dark .transcript-resize-handle::after { background: #475569; }
.transcript-resize-handle:hover::after,
.transcript-resize-handle.dragging::after { background: #6366f1; }
#transcript-area,
#translation-area {
  width: 100%;
  resize: vertical;
  min-height: 10rem;
  flex: 1;
  padding: .75rem;
  border-radius: .5rem;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #1e293b;
  font-size: .875rem;
  line-height: 1.6;
  outline: none;
}
#translation-area {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #1e293b;
}
#transcript-area:focus { border-color: #6366f1; box-shadow: 0 0 0 2px #6366f133; }
#translation-area:focus { border-color: #818cf8; box-shadow: 0 0 0 2px #6366f133; }

.dark #transcript-area,
html[data-theme="dark"] #transcript-area {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}
.dark #translation-area,
html[data-theme="dark"] #translation-area {
  background: #0f172a;
  border-color: #4338ca;
  color: #e2e8f0;
}

@media (max-width: 767px) {
  .transcript-split.with-translation { flex-direction: column; gap: .75rem; }
  .transcript-split.with-translation .transcript-resize-handle { display: none; }
  .transcript-split.with-translation .transcript-pane,
  .transcript-split.with-translation .translation-pane {
    flex: 1 1 auto;
    min-width: 0;
  }
}

/* ── Notification ───────────────────────────────────────────────────────────── */
#notification { transition: opacity .3s; }

/* ── Attendee / agenda chips ────────────────────────────────────────────────── */
.chip-list { display: flex; flex-direction: column; gap: .375rem; min-height: 2rem; }

#transcript-panel {
  display: flex;
  flex-direction: column;
}
#transcript-panel #transcript-split {
  flex: 1;
  min-height: 0;
}

/* ── Wide transcript layout ─────────────────────────────────────────────────── */
#left-panel { display: flex; flex-direction: column; gap: 1.25rem; }
#resize-handle { display: none; }

#main-layout.layout-wide {
  max-width: none !important;
  display: flex !important;
  flex-direction: row;
  gap: 0;
  height: calc(100vh - 3.5rem);
  overflow: hidden;
  align-items: stretch;
  padding-top: 1rem;
  padding-bottom: 1rem;
}
#main-layout.layout-wide #left-panel {
  width: 33.333%;
  flex-shrink: 0;
  height: 100%;
  overflow-y: auto;
  min-width: 160px;
  padding-right: .5rem;
}
#main-layout.layout-wide #resize-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 10px;
  flex-shrink: 0;
  cursor: col-resize;
  background: transparent;
  position: relative;
  z-index: 10;
}
#main-layout.layout-wide #resize-handle::after {
  content: '';
  display: block;
  width: 3px;
  height: 40px;
  border-radius: 2px;
  background: #cbd5e1;
  transition: background .15s;
}
.dark #main-layout.layout-wide #resize-handle::after { background: #475569; }
#main-layout.layout-wide #resize-handle:hover::after,
#main-layout.layout-wide #resize-handle.dragging::after { background: #6366f1; }
#main-layout.layout-wide #transcript-panel {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 200px;
  padding-left: .5rem;
}
#main-layout.layout-wide #transcript-split {
  flex: 1;
  min-height: 0;
  display: flex;
}
#main-layout.layout-wide #transcript-split #transcript-area,
#main-layout.layout-wide #transcript-split #translation-area {
  flex: 1;
  height: 100% !important;
  resize: none;
  min-height: 0;
}

/* Force single-column in wide layout (left panel is always ~1/3 wide) */
#main-layout.layout-wide #left-panel #meeting-info-grid,
#main-layout.layout-wide #left-panel #attendees-agenda-grid { grid-template-columns: 1fr; }
#main-layout.layout-wide #left-panel #meeting-info-grid .info-full { grid-column: 1; }

/* ── Left panel narrow mode (triggered by ResizeObserver via JS) ─────────────── */
#left-panel.panel-narrow #meeting-info-grid {
  grid-template-columns: 1fr !important;
}
#left-panel.panel-narrow #meeting-info-grid .info-full {
  grid-column: 1 !important;
}
#left-panel.panel-narrow #attendees-agenda-grid {
  grid-template-columns: 1fr !important;
}
#left-panel.panel-narrow .split-editor {
  flex-direction: column !important;
  height: auto !important;
  gap: .75rem;
}
#left-panel.panel-narrow .minutes-resize-handle {
  display: none !important;
}
#left-panel.panel-narrow .split-editor > * {
  min-height: 14rem;
}

/* Transcript fullscreen overlay */
#transcript-panel.transcript-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  z-index: 200 !important;
  border-radius: 0 !important;
  padding: 1rem 1.25rem !important;
  width: 100% !important;
  height: 100% !important;
  flex: none !important;
  min-width: 0 !important;
  overflow: hidden;
}
#transcript-panel.transcript-fullscreen #transcript-split {
  flex: 1;
  min-height: 0;
  display: flex;
}
#transcript-panel.transcript-fullscreen #transcript-split #transcript-area,
#transcript-panel.transcript-fullscreen #transcript-split #translation-area {
  flex: 1;
  height: 100% !important;
  resize: none;
  min-height: 0;
}
