header { justify-content: space-between; }

#app-nav-links {
  display: none;
  align-items: center;
  gap: 24px;
}

/* -------------------------------------------------------
   Main layout
------------------------------------------------------- */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 40px;
  max-width: 1150px;
  width: 100%;
  margin: 0 auto;
  gap: 28px;
}

/* -------------------------------------------------------
   Mode selector
------------------------------------------------------- */
.mode-bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.controls-label {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  opacity: 0.9;
}

.mode-options {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: 100%;
  gap: 12px;
}

.mode-options label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  padding: 10px 16px;
  border: 1px solid var(--border);
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}

.mode-options input[type="radio"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
}

.mode-options label:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-tint);
}

/* -------------------------------------------------------
   Mode-specific controls — reserves fixed height so switching
   between modes (some of which show nothing here, like Rewrite)
   doesn't jump the layout below.
------------------------------------------------------- */
.mode-extras {
  position: relative;
  min-height: 90px;
  margin-top: -16px;
}

/* -------------------------------------------------------
   Analysis sub-mode row and Level of detail slider — same
   shape (a small label above a control row) so swapping
   between them doesn't change .mode-extras' required height.
------------------------------------------------------- */
#analysis-submode-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* #analysis-submode-row is an ID selector, which otherwise beats the
   plain-class .hidden rule in base.css regardless of stylesheet order —
   this ID+class combo selector out-specifies it to actually hide the row
   on initial load, before index.js's mode-switch logic runs. */
#analysis-submode-row.hidden {
  display: none;
}

.detail-bar label,
#analysis-submode-row label {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.5;
}

.submode-row {
  display: flex;
  gap: 10px;
}

.submode-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  padding: 10px 18px;
  cursor: pointer;
  opacity: 0.6;
  transition: border-color 0.15s, background 0.15s, opacity 0.15s;
}

.submode-btn.active {
  border-color: var(--accent);
  background: var(--accent-tint);
  opacity: 1;
}

.submode-btn:hover:not(.active) {
  opacity: 0.8;
}

/* -------------------------------------------------------
   Level of detail slider
------------------------------------------------------- */
.detail-bar {
  display: none;
  flex-direction: column;
  gap: 8px;
  width: calc(40% - 7.2px);
}

.detail-bar.visible {
  display: flex;
}

.detail-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.detail-anchor {
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.7;
}

#detail-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  min-width: 0;
  height: 8px;
  border-radius: 4px;
  background: var(--border);
  cursor: pointer;
}

#detail-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}

#detail-slider::-moz-range-track {
  height: 8px;
  border-radius: 4px;
  background: var(--border);
}

#detail-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}


/* -------------------------------------------------------
   How to use — collapsible
------------------------------------------------------- */
.how-to-use {
  border: 1px solid var(--border);
}

.how-to-use-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  user-select: none;
  background: var(--surface-tint);
  font-family: var(--font-head);
  font-size: 18px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  opacity: 0.7;
  transition: opacity 0.15s;
  list-style: none;
}

.how-to-use-toggle:hover {
  opacity: 0.8;
}

.how-to-use-toggle::marker,
.how-to-use-toggle::-webkit-details-marker {
  display: none;
}

.how-to-use-toggle .toggle-arrow {
  font-size: 11px;
  transition: transform 0.2s;
  display: inline-block;
}

details.how-to-use[open] .toggle-arrow {
  transform: rotate(90deg);
}

.how-to-use-body {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  font-size: 18px;
  line-height: 1.6;
}

.how-to-use-body p { margin-bottom: 10px; }

.how-to-use-body ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.how-to-use-body ul li::before {
  content: "• ";
  opacity: 0.4;
}

.how-to-use-body ul li {
  opacity: 0.7;
}

/* -------------------------------------------------------
   Editor — stacked panels
------------------------------------------------------- */
.editor {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  flex: 1;
}

.generate-row {
  display: flex;
  justify-content: flex-end;
}

.panel {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-strong);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-tint);
}

.panel-title {
  font-family: var(--font-head);
  font-size: 24px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.5;
}

#copy-btn,
#clear-btn {
  width: 56px;
  height: 56px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s;
}

#copy-btn:hover,
#clear-btn:hover {
  background: var(--surface-tint-strong);
}

textarea {
  flex: 1;
  width: 100%;
  min-height: 480px;
  padding: 20px;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.7;
  color: var(--text);
}

#input-text {
  min-height: 225px;
}

#output-text {
  min-height: 375px;
}

#output-rendered {
  display: none;
  height: 375px;
  padding: 20px;
  overflow-y: auto;
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.7;
  color: var(--text);
}

#output-rendered h1,
#output-rendered h2,
#output-rendered h3 {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 22px 0 8px;
}

#output-rendered h1:first-child,
#output-rendered h2:first-child,
#output-rendered h3:first-child {
  margin-top: 0;
}

#output-rendered p { margin-bottom: 12px; }

#output-rendered ul,
#output-rendered ol {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0 16px;
  padding-left: 1.5em;
}

#output-rendered ul li {
  position: relative;
}

#output-rendered ul li::before {
  content: "—";
  opacity: 0.35;
  position: absolute;
  left: -1.5em;
}

#output-rendered strong { font-weight: 700; }

textarea::placeholder {
  color: var(--text);
  opacity: 0.3;
}

textarea:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* -------------------------------------------------------
   Refine bar
------------------------------------------------------- */
.refine-bar {
  display: none;
  align-items: stretch;
  gap: 12px;
  margin-top: -8px;
}

.refine-bar.visible {
  display: flex;
}

#refine-input {
  flex: 1;
  min-height: unset;
  height: 64px;
  padding: 10px 16px;
  border: 1px solid var(--border-strong);
  font-size: 16px;
  line-height: 1.4;
  resize: none;
}

/* Matches #refine-input's height so the two sit flush in .refine-bar */
/* Flipped from MAAZIFY: light background, dark/accent text — but keeps the
   same fade-not-invert hover behavior via the shared .primary-btn:hover rule. */
#refine-btn {
  height: 64px;
  padding: 0 12px;
  background: var(--bg);
  color: var(--accent);
  border: 2px solid var(--accent);
}


/* -------------------------------------------------------
   Action bar
------------------------------------------------------- */
.action-bar {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Overrides .primary-btn's fixed 240px/26px sizing (tuned for short brand
   labels like MAAZIFY) — these labels are longer and were clipping. */
#download-pdf-btn,
#download-summary-pdf-btn {
  display: none;
  width: auto;
  font-size: 16px;
  padding: 12px 20px;
}

#copy-btn {
  display: none;
}

#status-msg {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  opacity: 0.55;
  font-style: italic;
}

.cost-display {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.cost-display:empty {
  display: none;
  margin: 0;
}

/* -------------------------------------------------------
   Loading animation
------------------------------------------------------- */
.loading-dots {
  display: none;
  gap: 5px;
  align-items: center;
}

.loading-dots span {
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40%           { transform: translateY(-6px); opacity: 1; }
}

/* -------------------------------------------------------
   Login screen
------------------------------------------------------- */
.login-intro {
  text-align: center;
}

.login-intro p {
  margin-top: 18px;
}

#login-screen #login-error {
  display: none;
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
}

#login-screen .login-footnote {
  font-size: 16px;
  opacity: 0.35;
}

/* -------------------------------------------------------
   App info paragraphs
------------------------------------------------------- */
.app-note {
  font-size: 17px;
 margin-top: -50px;
}

/* -------------------------------------------------------
   Intro band — lead statement on the left, capability list
   on the right, so the full page width is doing work.
------------------------------------------------------- */
.intro-band {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 24px 64px;
  align-items: start;
  margin-bottom: 24px;
}

.intro-lead > b {
  display: block;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.35;
}

.intro-lead .app-note {
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 15px;
}

.app-caution {
  margin: 4px 0 16px;
}

.intro-uses {
  border-left: 1px solid var(--border);
  padding-left: 40px;
}

.uses-label {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 12px;
}

.intro-uses ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Support ask — a slim accent-bordered strip */
.support-block {
  margin-bottom: 24px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  padding: 22px 30px;
}

.support-block h1 {
  font-family: var(--font-head);
  font-size: 22px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.support-block p {
  color: var(--text-muted);
}

@media (max-width: 800px) {
  .intro-band {
    grid-template-columns: 1fr;
  }
  .intro-uses {
    border-left: none;
    padding-left: 0;
  }
}

#login-screen {
  display: none;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  text-align: center;
}

#login-screen h1 {
  font-family: var(--font-brand);
  font-size: 52px;
  letter-spacing: 0.04em;
  line-height: 1;
}

#login-screen h1 span {
  color: var(--accent);
}

#login-screen p {
  opacity: 0.55;
  font-size: 18px;
  max-width: 500px;
  text-align: center;
  margin: 0 auto;
}

#login-btn {
  background: transparent;
  color: var(--dark);
  border: 2px solid var(--dark);
  font-family: var(--font-brand);
  font-size: 22px;
  letter-spacing: 0.08em;
  padding: 14px 64px;
  cursor: pointer;
  transition: opacity 0.15s;
  text-decoration: none;
  display: inline-block;
}

#login-btn:hover {
  opacity: 0.8;
}

/* -------------------------------------------------------
   App screen (hidden until auth)
------------------------------------------------------- */
#app-screen {
  display: none;
  flex-direction: column;
  flex: 1;
}
