header { justify-content: space-between; }

#user-info { display: none; }

#user-info {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 16px;
  color: var(--text);
}

#user-email {
  opacity: 0.6;
}

.secondary-btn {
  background: none;
  border: 1px solid var(--dark);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.secondary-btn:hover:not(:disabled) {
  background: var(--dark);
  color: var(--bg);
}

.secondary-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#sign-out-btn {
  padding: 5px 12px;
}

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

/* -------------------------------------------------------
   Mode selector
------------------------------------------------------- */
.mode-bar {
  display: flex;
  align-items: center;
  gap: 32px;
}

.mode-options {
  display: flex;
  gap: 4px;
}

.mode-options label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 6px 14px;
  border: 1px solid var(--border);
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}

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

.mode-options label:has(input:checked) {
  border-color: var(--orange);
  background: rgba(255, 97, 35, 0.06);
}

/* -------------------------------------------------------
   Analysis sub-mode row
------------------------------------------------------- */
#analysis-submode-row {
  display: flex;
  gap: 8px;
  margin-top: -16px;
}

.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.08em;
  text-transform: uppercase;
  padding: 10px 18px;
  cursor: pointer;
  opacity: 0.5;
  transition: border-color 0.15s, background 0.15s, opacity 0.15s;
}

.submode-btn.active {
  border-color: var(--orange);
  background: rgba(255, 97, 35, 0.06);
  opacity: 1;
}

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

/* -------------------------------------------------------
   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: rgba(0,0,0,0.02);
  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 — side by side panels
------------------------------------------------------- */
.editor {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  flex: 1;
}

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

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.02);
}

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

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);
}

#output-rendered {
  display: none;
  height: 480px;
  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: 48px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  font-size: 16px;
  line-height: 1.4;
  resize: none;
}

#refine-btn {
  padding: 12px 28px;
  white-space: nowrap;
}

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

#maazify-btn {
  background: var(--orange);
  color: white;
  border: none;
  font-family: var(--font-brand);
  font-size: 22px;
  letter-spacing: 0.08em;
  padding: 14px 48px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

#maazify-btn:hover:not(:disabled) {
  opacity: 0.88;
  color: black;
}

#maazify-btn:active:not(:disabled) {
  transform: scale(0.98);
}

#maazify-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#download-pdf-btn,
#download-summary-pdf-btn {
  display: none;
}

#copy-btn {
  display: none;
}

#clear-btn {
  color: var(--text-muted);
  border-color: var(--border);
}

#clear-btn:hover:not(:disabled) {
  color: var(--bg);
  border-color: var(--dark);
}

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

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

.loading-dots span {
  width: 7px;
  height: 7px;
  background: var(--orange);
  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(--orange);
  font-size: 15px;
  font-weight: 600;
}

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

/* -------------------------------------------------------
   App info paragraphs
------------------------------------------------------- */
.app-intro {
  color: var(--text-muted);
  margin-top: -8px;
}

.app-note {
  font-size: 17px;
 margin-top: -50px;
}

#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(--orange);
}

#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;
}
