/* App-specific styles — split-panel layout and analysis UI */

/* ── Layout ─────────────────────────────────── */
.app-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: calc(100vh - 61px);
  gap: 0;
}

/* ── Input Panel ────────────────────────────── */
.input-panel {
  padding: 64px 48px 48px;
  border-right: 1px solid var(--parchment-dark);
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-height: calc(100vh - 61px);
  overflow-y: auto;
}

.input-header { padding-top: 16px; }
.input-title {
  font-size: 28px;
  color: var(--green-deep);
  margin-bottom: 10px;
}
.input-sub {
  font-size: 15px;
  color: var(--text-mid);
  line-height: 1.6;
  max-width: 420px;
}

.analyze-form { display: flex; flex-direction: column; gap: 20px; }

.report-textarea {
  width: 100%;
  padding: 20px;
  border: 1.5px solid var(--parchment-dark);
  border-radius: 12px;
  background: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-dark);
  resize: vertical;
  transition: border-color 0.15s ease;
  box-shadow: 0 2px 12px rgba(22,48,43,0.06);
}
.report-textarea:focus {
  outline: none;
  border-color: var(--green-sage);
  box-shadow: 0 0 0 3px rgba(122,158,142,0.15);
}
.report-textarea::placeholder { color: var(--green-light); }

/* ── File Upload Zone ─────────────────────── */
.upload-zone {
  position: relative;
  border: 1.5px dashed var(--parchment-dark);
  border-radius: 12px;
  padding: 20px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  background: var(--white);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--green-sage);
  background: #F8FAF9;
}
.upload-zone.drag-over {
  border-color: var(--green-mid);
  box-shadow: 0 0 0 4px rgba(122,158,142,0.12);
}

.upload-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.upload-icon { color: var(--green-sage); }
.upload-label {
  font-size: 14px;
  color: var(--text-mid);
  line-height: 1.5;
}
.upload-browse {
  color: var(--green-deep);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--green-sage);
}

.file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}
.upload-progress-bar {
  width: 100%;
  max-width: 280px;
  height: 5px;
  background: var(--parchment-dark);
  border-radius: 3px;
  overflow: hidden;
}
.upload-progress-fill {
  height: 100%;
  background: var(--green-sage);
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 3px;
}
.upload-progress-text { font-size: 13px; color: var(--text-light); }

.upload-success {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--agree);
  font-size: 14px;
  font-weight: 600;
}
.upload-error {
  margin-top: 8px;
  padding: 8px 12px;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: 6px;
  color: var(--disagree);
  font-size: 13px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.btn-analyze {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: var(--green-deep);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.btn-analyze:hover { background: var(--green-mid); }
.btn-analyze:active { transform: scale(0.98); }
.btn-analyze:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-loading {
  display: flex;
  align-items: center;
  gap: 8px;
}
.spinner {
  width: 16px;
  height: 16px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.form-note {
  font-size: 12px;
  color: var(--text-light);
}

.error-msg {
  padding: 12px 16px;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: 8px;
  color: var(--disagree);
  font-size: 14px;
}

/* ── Results Panel ──────────────────────────── */
.results-panel {
  padding: 64px 48px 48px;
  background: var(--white);
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-height: calc(100vh - 61px);
  overflow-y: auto;
}

.results-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
  padding: 48px 0;
}
.empty-illustration { margin-bottom: 8px; }
.empty-title {
  font-size: 18px;
  color: var(--green-deep);
  margin-bottom: 4px;
}
.empty-desc {
  font-size: 14px;
  color: var(--text-light);
  max-width: 300px;
  line-height: 1.6;
}

/* ── Loading state ─────────────────────────── */
.results-loading {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 32px 0;
}
.loading-models { display: flex; flex-direction: column; gap: 16px; }
.loading-model {
  display: flex;
  align-items: center;
  gap: 12px;
}
.loading-bar {
  flex: 1;
  height: 6px;
  background: var(--parchment-dark);
  border-radius: 3px;
  overflow: hidden;
}
.loading-fill {
  height: 100%;
  background: var(--green-sage);
  border-radius: 3px;
}
.loading-label {
  font-size: 14px;
  color: var(--text-light);
  text-align: center;
}

/* ── Results content ───────────────────────── */
.agreement-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border-radius: 12px;
  margin-bottom: 8px;
}
.agreement-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
}
.banner-agree { background: #F0FDF4; }
.banner-agree .agreement-icon { background: var(--agree); color: white; }
.banner-neutral { background: #FEFCE8; }
.banner-neutral .agreement-icon { background: var(--neutral); color: white; }
.banner-disagree { background: #FFF1F0; }
.banner-disagree .agreement-icon { background: var(--disagree); color: white; }
.agreement-label { font-size: 15px; font-weight: 600; color: var(--text-dark); }
.agreement-sub { font-size: 13px; color: var(--text-light); margin-top: 2px; }

/* ── Findings ──────────────────────────────── */
.findings-section { display: flex; flex-direction: column; gap: 20px; }

.finding-group { display: flex; flex-direction: column; gap: 8px; }

.finding-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.group-badge {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}
.group-agree { background: var(--agree); color: white; }
.group-disagree { background: var(--disagree); color: white; }
.group-neutral { background: var(--neutral); color: white; }
.group-label { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-light); }

.finding-card {
  background: var(--parchment);
  border: 1px solid var(--parchment-dark);
  border-radius: 10px;
  padding: 16px 18px;
}
.finding-topic {
  font-size: 13px;
  font-weight: 700;
  color: var(--green-deep);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--parchment-dark);
}
.finding-models { display: flex; flex-direction: column; gap: 10px; }

.model-finding-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.model-finding-body { flex: 1; }
.model-verdict-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 3px;
}
.model-finding-summary {
  font-size: 13px;
  color: var(--text-mid);
  line-height: 1.5;
}
.model-flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--disagree);
  background: #FFF1F0;
  padding: 2px 7px;
  border-radius: 4px;
}

.no-findings {
  font-size: 14px;
  color: var(--text-light);
  text-align: center;
  padding: 32px;
}

/* ── Doctor Question ────────────────────────── */
.doctor-section {
  background: var(--parchment);
  border: 1px solid var(--parchment-dark);
  border-radius: 12px;
  padding: 24px;
  margin-top: 8px;
}
.doctor-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}
.ask-icon {
  width: 36px;
  height: 36px;
  background: var(--amber);
  color: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.doctor-title {
  font-size: 17px;
  color: var(--green-deep);
  margin-bottom: 2px;
}
.doctor-sub { font-size: 12px; color: var(--text-light); }
.doctor-prompt-box {
  background: var(--white);
  border: 1px solid var(--parchment-dark);
  border-radius: 8px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.doctor-prompt-text {
  font-size: 14px;
  font-style: italic;
  color: var(--text-mid);
  line-height: 1.6;
  flex: 1;
}
.btn-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--green-deep);
  color: white;
  border: none;
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.btn-copy:hover { background: var(--green-mid); }

/* ── Responsive ─────────────────────────────── */
@media (max-width: 900px) {
  .app-layout { grid-template-columns: 1fr; }
  .input-panel {
    border-right: none;
    border-bottom: 1px solid var(--parchment-dark);
    max-height: none;
    padding: 40px 20px;
  }
  .results-panel {
    max-height: none;
    padding: 40px 20px;
  }
}