/* Base reset */
body,
html {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Georgia", serif;
  color: #333333;
  background-color: #f9f9f9;
  display: flex;
  flex-direction: column;
}

header {
  background-color: #003057; /* deep navy */
  color: white;
  padding: 1rem 1.5rem;
  text-align: center;
  font-weight: 600;
  font-size: 1.4rem;
  letter-spacing: 0.02em;
  border-bottom: 3px solid #5c92bf; /* subtle secondary accent */
  flex: 0 0 auto;
}

header h1 {
  margin: 0;
  font-family: "Noto Sans", sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: white;
}

footer {
  background-color: #e5e8eb;
  color: #2f2f2f;
  text-align: center;
  padding: 0.8rem 1rem;
  font-size: 0.9rem;
  border-top: 2px solid #5c92bf;
  flex: 0 0 auto;
}

a {
  color: #005fa3;
  text-decoration: none;
  font-weight: 500;
}

a:hover {
  color: #003057;
  text-decoration: underline;
}

/* Layout containers */
#main-container {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: #f9fafb;
}

#pane-wrapper {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#panes {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  overflow: hidden;
  transition: all 0.3s ease;
}

.pane {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem;
  padding-bottom: 2rem;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
}

#transcript-pane {
  margin-right: 0.5rem;
}

#transcript-paragraph {
  white-space: pre-line;   /* honor \n, but still collapse extra spaces */
  overflow-y: auto;
}

#outline-pane {
  margin-left: 0.5rem;
}

/* Divider for desktop */
#divider {
  flex: 0 0 auto;
  width: 6px;
  background-color: #ccc;
  cursor: col-resize;
  border-radius: 3px;
  transition: background 0.2s;
  margin: 0 2px;
}
#divider:hover {
  background-color: #aaa;
}

/* Divider updated to match functional behavior */
.divider {
  width: 6px;
  cursor: col-resize;
  touch-action: none;
  background: #f3f4f6;
  border-left: 1px solid #e5e7eb;
  border-right: 1px solid #e5e7eb;
}

/* Tabs visible on mobile */
.tabs {
  display: none;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
}
.tab-btn {
  appearance: none;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 0.4rem 0.8rem;
  font-weight: 600;
  background: #f9fafb;
  cursor: pointer;
}
.tab-btn[aria-selected="true"] {
  background: #eef2ff;
  border-color: #6366f1;
}

/* Responsive Behavior */
@media (max-width: 900px) {
  .tabs { display: flex; }
  #divider { display: none; }

  /* Show exactly one pane as a flex item that can scroll */
  #panes { 
    min-height: 0;
    flex-direction: column; 
  }
  .pane { display: none; }
  .pane[data-visible="true"] {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;     /* critical for scrolling within flex children */
    overflow: auto;
  }
}


/* Desktop layout */
@media (min-width: 901px) {
  .tabs { display: none; }
  .pane { display: block !important; }
}

/* Transcript styling */
/* #transcript h3 {
  margin-top: 1em;
  margin-bottom: 0.5em;
  font-size: 1.25em;
  color: #005175;
  border-bottom: 2px solid #005175;
  padding-bottom: 0.2em;
}

#transcript pre {
  white-space: pre-wrap;      /* Wrap text but preserve existing line breaks *\/
  word-wrap: break-word;      /* Break long words *\/
  overflow-wrap: anywhere;    /* Safe wrapping for very long URLs/strings *\/
  font-family: "Merriweather", Georgia, serif;
  background: linear-gradient(180deg, #f9f9f7 0%, #f3f4f2 100%);
  border-radius: 6px;
  padding: 0.9rem 1rem;
  margin-top: 0.4rem;
  line-height: 1.55;
  font-size: 0.95rem;
  color: #2f2f2f;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04),
              0 1px 3px rgba(0, 0, 0, 0.05);
  opacity: 1;
  transition: max-height 1s ease, opacity 1s ease;
}

#transcript pre:hover {
  background: #f7f9fa;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* Caption text *\/
#transcript p {
  margin: 0.5em 0;
  line-height: 1.5;
  white-space: pre-wrap;
} */

/* Outline styling */
.outline-block {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  min-height: 0; /* ensures scrollable area can shrink properly */
  margin: 0.5rem;
  padding: 0.75rem;
  border: 1px solid #dfe3e6;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  border-radius: 0.5rem;
  background: #fff;
  transition: margin 0.3s ease;
}

.outline-block h3 {
  font-size: 1.1em;
  color: #005175;
  margin: 1em 0 0.3em; 
}

#outline-completed {
  margin-bottom: 1rem;
}

#outline-live {
  min-height: 3em;
  flex: 0 0 auto;
  display: block;
}

#outline-live pre {
  white-space: pre-wrap;
  margin: 0 0 0.5em 0;
}

#outline-live #last-updated {
  font-size: 0.9em;
  color: #666;
  margin-top: 0.35em;
}

/* Markdown-rendered outlines */
.outline-content {
  font-family: "Merriweather", Georgia, serif;
  background: linear-gradient(180deg, #f9f9f7 0%, #f3f4f2 100%);
  border-left: 4px solid #5c92bf; /* soft blue accent */
  border-radius: 6px;
  padding: 0.9rem 1rem;
  margin-top: 0.4rem;
  white-space: normal;
  line-height: 1.55;
  font-size: 0.95rem;
  color: #2f2f2f;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04),
              0 1px 3px rgba(0, 0, 0, 0.05);
  opacity: 1;
  transition: max-height 1s ease, opacity 1s ease;
}

.outline-content:hover {
  background: #f7f9fa;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
}

.outline-content h2,
.outline-content h3,
.outline-content h4 {
  color: #003057;
  margin-top: .5em;
  margin-bottom: 0.1em;
}
.outline-content p{
  margin-bottom: 0em;
  margin-top: .5em;
}
.outline-content ul,
.outline-content ol {
  margin: 0.5em 0 0.5em 0.5em;
  padding-left: 1em;
}
.outline-content li {
  margin-bottom: 0.1em;
}
.outline-content em {
  color: #444;
}

/* Collapsible outline sections */
.outline-toggle {
  font-weight: 600;
  color: #005fa3;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.25rem;
}

.outline-toggle .arrow {
  color: #5c92bf;
  font-size: 0.8em;
  display: inline-block;
  transition: transform 0.2s ease;
}

.outline-toggle.open .arrow {
  transform: rotate(90deg);
}

.outline-content.collapsed {
  max-height: 0 !important;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  margin: 0;
  padding: 0;
}

/* Auto-scroll toggle and status */
#controls {
  margin: 0.5rem 0;
}

/* Modal (disclaimer) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.modal-backdrop[aria-hidden="false"] {
  display: flex;
}
.modal {
  width: min(720px, 92vw);
  max-height: 85vh;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}
.modal-title {
  margin: 0 0 0.5rem 0;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
}
.modal-body {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 0.85rem;
  overflow: auto;
  background: #fafafa;
  max-height: 48vh;
}
.modal-body p {
  margin: 0 0 0.8rem 0;
  line-height: 1.5;
}
.modal-ack {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.9rem 0;
  font-size: 0.95rem;
}
.btn {
  align-self: center;
  border: none;
  border-radius: 10px;
  padding: 0.6rem 1.1rem;
  font-weight: 600;
  background: #005175;
  color: white;
  cursor: pointer;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.fineprint {
  font-size: 0.85em;
  color: #6b7280;
}

/* Accessibility focus */
.modal a:focus,
.modal button:focus,
.modal input:focus,
.modal-body:focus {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}
