/* ── ESSAY HELPER PAGE-SPECIFIC CSS ──────────────────────── */

/* ── LAYOUT ──────────────────────────────────────────────── */
#appBody {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 28px 32px 32px;
  gap: 0;
}

#pageHeader {
  display: flex;
  align-items: baseline;
  margin-bottom: 20px;
}
#pageHeader h1 {
  font-size: 24px;
  font-weight: 800;
  color: #1a1a1a;
}

#mainLayout {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  min-height: 0;
}

/* ── PANEL OVERRIDE ──────────────────────────────────────── */
/* Essay helper panels need flex-direction: column */
.panel {
  display: flex;
  flex-direction: column;
}

.panel-header {
  flex-shrink: 0;
}

/* ── LEFT PANEL ──────────────────────────────────────────── */
#leftContent {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 16px;
  overflow-y: auto;
  min-height: 0;
}

.field-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #888;
  margin-bottom: 6px;
}

#promptInput {
  width: 100%;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  color: #1a1a1a;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  resize: none;
  line-height: 1.5;
  transition: border-color 0.15s;
  height: 72px;
}
#promptInput:focus { outline: none; border-color: var(--primary); }
#promptInput::placeholder { color: #bbb; }

/* ── ESSAY INPUT AREA ────────────────────────────────────── */
#essaySection {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#essayInputArea {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

#essayInput {
  flex: 1;
  width: 100%;
  padding: 12px;
  font-size: 13px;
  font-family: inherit;
  color: #1a1a1a;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px 8px 0 0;
  resize: none;
  line-height: 1.6;
  min-height: 180px;
  transition: border-color 0.15s;
}
#essayInput:focus { outline: none; border-color: var(--primary); }
#essayInput::placeholder { color: #bbb; }

#essayToolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f0f0f0;
  border: 1px solid #e0e0e0;
  border-top: none;
  border-radius: 0 0 8px 8px;
}

#wordCount {
  font-size: 11px;
  color: #aaa;
  margin-left: auto;
}

.toolbar-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #555;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}
.toolbar-btn:hover { background: #f5f5f5; border-color: #bbb; }

/* ── DROP ZONE ───────────────────────────────────────────── */
#dropZone {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px;
  border: 2px dashed #d0d0d0;
  border-radius: 8px;
  background: #fafafa;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
}
#dropZone.active-drop { border-color: var(--primary); background: var(--neutral); }
#dropZone .drop-icon { font-size: 28px; }
#dropZone .drop-text { font-size: 13px; font-weight: 600; color: #555; }
#dropZone .drop-sub { font-size: 11px; color: #aaa; }

/* ── SUBMIT ──────────────────────────────────────────────── */
#submitRow {
  flex-shrink: 0;
  padding: 16px 20px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  gap: 12px;
}

#submitBtn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
#submitBtn:hover { background: var(--primary-dark); }
#submitBtn:disabled { opacity: 0.5; cursor: not-allowed; }

#clearBtn {
  font-size: 12px;
  font-weight: 600;
  color: #aaa;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
#clearBtn:hover { color: #555; }

#submitStatus {
  font-size: 12px;
  color: #aaa;
  margin-left: auto;
}

/* ── RIGHT PANEL ─────────────────────────────────────────── */
#reviewContent {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

/* Empty state */
#emptyReview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 1;
  gap: 12px;
  color: #bbb;
  padding: 40px 20px;
}
#emptyReview .empty-icon { display: flex; justify-content: center; color: #ccc; margin-bottom: 8px; }
#emptyReview .empty-icon svg { width: 40px; height: 40px; stroke-width: 1.25; }
#emptyReview .empty-text { font-size: 13px; line-height: 1.5; }

/* Score card */
#scoreCard {
  display: none;
  background: var(--primary);
  border-radius: 10px;
  padding: 18px 20px;
  color: #fff;
  flex-shrink: 0;
}
#scoreCard .score-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,0.6);
  margin-bottom: 4px;
}
#scoreCard .score-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
#scoreCard .score-num {
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
}
#scoreCard .score-denom {
  font-size: 16px;
  color: rgba(255,255,255,0.55);
}
#scoreCard .score-summary {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  margin-top: 8px;
  line-height: 1.5;
}

/* Category scores */
#categoryScores {
  display: none;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}
.cat-score {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.cat-score-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.cat-score-name {
  font-size: 12px;
  font-weight: 600;
  color: #333;
}
.cat-score-val {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
}
.cat-bar-bg {
  height: 5px;
  background: #f0f0f0;
  border-radius: 3px;
  overflow: hidden;
}
.cat-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--primary);
  transition: width 0.6s ease;
}

/* Feedback sections */
#feedbackSections {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.feedback-section { flex-shrink: 0; }

.feedback-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #888;
  margin-bottom: 8px;
}

.feedback-item {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  background: #f9f9f9;
  border-radius: 8px;
  border-left: 3px solid #e0e0e0;
  margin-bottom: 6px;
  font-size: 12px;
  line-height: 1.5;
  color: #444;
}
.feedback-item:last-child { margin-bottom: 0; }
.feedback-item.strength { border-left-color: var(--primary); background: var(--neutral); }
.feedback-item.improvement { border-left-color: var(--tertiary); background: #fffbf0; }
.feedback-item.critical { border-left-color: #e03e3e; background: #fff5f5; }

/* Loading state */
#loadingState {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex: 1;
  padding: 40px 20px;
  text-align: center;
}
#loadingState .loading-text {
  font-size: 13px;
  color: #888;
}

/* ── FILE INPUT (hidden) ─────────────────────────────────── */
#fileInput { display: none; }

/* ── API KEY ROW ─────────────────────────────────────────── */
#apiKeyRow {
  padding: 10px 20px;
  border-top: 1px solid #f0f0f0;
  background: #fafafa;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
#apiKeyRow .api-key-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #999;
  white-space: nowrap;
  flex-shrink: 0;
}
#apiKeyInput {
  flex: 1;
  padding: 5px 8px;
  font-size: 12px;
  font-family: monospace;
  color: #333;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  min-width: 0;
}
#apiKeyInput:focus { outline: none; border-color: var(--primary); }
#apiKeySaveBtn {
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: var(--secondary);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
}
#apiKeySaveBtn:hover { opacity: 0.85; }
#apiKeyStatus {
  font-size: 11px;
  color: #22a060;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── SPINNER OVERRIDE ────────────────────────────────────── */
/* Essay helper uses 28px spinner with no margin */
.spinner {
  width: 28px;
  height: 28px;
  border-width: 3px;
  border-top-color: var(--primary);
  margin: 0;
}
