/* ===== PaperPilot — Academic Paper Analyzer ===== */

/* Design Tokens */
:root {
  --bg: #07070c;
  --bg2: #0e0e18;
  --bg3: #161625;
  --bg4: #1e1e30;
  --accent: #6c63ff;
  --accent2: #5a52e0;
  --accent-glow: rgba(108, 99, 255, .25);
  --cyan: #00d4ff;
  --cyan-glow: rgba(0, 212, 255, .15);
  --green: #10b981;
  --green-glow: rgba(16, 185, 129, .15);
  --yellow: #f59e0b;
  --yellow-glow: rgba(245, 158, 11, .15);
  --red: #ef4444;
  --red-glow: rgba(239, 68, 68, .15);
  --text: #eaeaf2;
  --text2: #9a9ab5;
  --text3: #5e5e78;
  --glass: rgba(255, 255, 255, .035);
  --glass2: rgba(255, 255, 255, .055);
  --glass-border: rgba(255, 255, 255, .07);
  --glass-border2: rgba(255, 255, 255, .12);
  --radius: 20px;
  --radius-sm: 12px;
  --font: 'Inter', system-ui, sans-serif;
  --font-display: 'Space Grotesk', system-ui, sans-serif;
}

/* Reset */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Ambient Glows */
.glow-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}
.glow-orb.purple {
  width: 500px;
  height: 500px;
  background: rgba(108, 99, 255, .04);
  top: -15%;
  right: -10%;
  animation: drift 25s ease-in-out infinite;
}
.glow-orb.cyan {
  width: 400px;
  height: 400px;
  background: rgba(0, 212, 255, .03);
  bottom: 5%;
  left: -10%;
  animation: drift 30s ease-in-out infinite reverse;
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(30px, -20px); }
  66% { transform: translate(-20px, 15px); }
}

/* Screens */
.screen { display: none; position: relative; z-index: 1; }
.screen.active { display: block; animation: fadeIn .5s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Glass */
.glass {
  background: linear-gradient(180deg, rgba(255,255,255,.04) 0%, rgba(255,255,255,.02) 100%);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border: 1px solid var(--glass-border2);
  border-radius: var(--radius);
  box-shadow: 0 12px 48px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.04) inset, 0 1px 0 rgba(255,255,255,.06) inset;
}

/* ===== HEADER ===== */
.header {
  text-align: center;
  padding: 60px 20px 20px;
}
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(108, 99, 255, .1);
  border: 1px solid rgba(108, 99, 255, .2);
  border-radius: 100px;
  padding: 6px 16px;
  margin-bottom: 20px;
}
.header h1 {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.1;
}
.header h1 .accent {
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.subtitle {
  font-size: 1.25rem;
  color: var(--text2);
  margin-top: 12px;
}
.subtext {
  font-size: .9rem;
  color: var(--text3);
  max-width: 560px;
  margin: 12px auto 0;
  line-height: 1.6;
}

/* ===== UPLOAD CARD ===== */
.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 20px;
}
.upload-card {
  padding: 32px;
}

/* Drop Zone */
.drop-zone {
  border: 2px dashed var(--glass-border2);
  border-radius: var(--radius-sm);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all .3s cubic-bezier(.22,1,.36,1);
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(108, 99, 255, .05);
}
.drop-zone.dragover {
  transform: scale(1.01);
}
.drop-icon {
  color: var(--text3);
  margin-bottom: 12px;
  transition: color .3s;
}
.drop-zone:hover .drop-icon { color: var(--accent); }
.drop-text {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.drop-subtext {
  font-size: .85rem;
  color: var(--text3);
}

/* File Info */
.file-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-top: 16px;
}
.file-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: .9rem;
  font-weight: 500;
}
.file-badge svg { color: var(--accent); flex-shrink: 0; }
#fileSize { color: var(--text3); font-size: .8rem; }
.btn-remove {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0 4px;
  transition: color .2s;
}
.btn-remove:hover { color: var(--red); }

/* Toggle */
.toggle-row {
  display: flex;
  background: var(--bg3);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-top: 20px;
}
.toggle-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text3);
  font-family: var(--font);
  font-size: .85rem;
  font-weight: 600;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .2s;
}
.toggle-btn.active {
  background: var(--bg4);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

/* Text Input */
.text-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: .9rem;
  padding: 16px;
  margin-top: 16px;
  resize: vertical;
  outline: none;
  transition: border-color .2s;
}
.text-input:focus { border-color: var(--accent); }

/* Options Row */
.options-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
}
.option-group label {
  display: block;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
}
.option-group select, .journal-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font);
  font-size: .85rem;
  padding: 10px 12px;
  outline: none;
  transition: border-color .2s;
  appearance: none;
}
.option-group select:focus, .journal-input:focus { border-color: var(--accent); }
.option-group select {
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 5l3 3 3-3' stroke='%239a9ab5' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* Analyze Button */
.btn-analyze {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  padding: 16px;
  margin-top: 24px;
  cursor: pointer;
  transition: all .3s cubic-bezier(.22,1,.36,1);
  box-shadow: 0 4px 24px var(--accent-glow);
}
.btn-analyze:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px var(--accent-glow);
}
.btn-analyze:disabled {
  opacity: .5;
  cursor: not-allowed;
  background: rgba(255, 255, 255, .06);
  box-shadow: none;
  filter: grayscale(1) brightness(.7);
  border: 1px solid rgba(255, 255, 255, .08);
}

.privacy-note {
  text-align: center;
  font-size: .75rem;
  color: var(--text3);
  margin-top: 16px;
}

/* ===== LOADING SCREEN ===== */
.loading-container {
  max-width: 500px;
  margin: 0 auto;
  padding: 120px 20px 60px;
  text-align: center;
}
.loading-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 40px;
}
.loading-phases {
  text-align: left;
  margin-bottom: 32px;
}
.phase {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  color: var(--text3);
  font-size: .9rem;
  transition: color .3s;
}
.phase.active { color: var(--text); }
.phase.done { color: var(--green); }
.phase-indicator {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.phase-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text3);
  transition: all .3s;
}
.phase.active .phase-dot {
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
  animation: pulse 1.5s ease-in-out infinite;
}
.phase.done .phase-dot {
  background: var(--green);
  width: 24px;
  height: 24px;
  border-radius: 50%;
}
.phase.done .phase-dot::after {
  content: '\2713';
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: .7; }
}

.loading-bar {
  height: 4px;
  background: rgba(255, 255, 255, .08);
  border-radius: 2px;
  overflow: hidden;
}
.loading-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  border-radius: 2px;
  width: 0%;
  transition: width .5s ease;
}
.loading-estimate {
  font-size: .8rem;
  color: var(--text3);
  margin-top: 12px;
}

/* Error Card */
.error-card {
  text-align: center;
  padding: 48px 32px;
}
.error-icon {
  color: var(--red);
  margin-bottom: 16px;
}
.error-card h3 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 12px;
}
.error-card p {
  color: var(--text2);
  font-size: .9rem;
  line-height: 1.5;
  max-width: 400px;
  margin: 0 auto 24px;
}
.error-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.btn-retry, .btn-back {
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  border: none;
}
.btn-retry {
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff;
  box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-retry:hover { transform: translateY(-1px); }
.btn-back {
  background: var(--glass2);
  border: 1px solid var(--glass-border2);
  color: var(--text);
}
.btn-back:hover { border-color: var(--accent); }

/* ===== REPORT SCREEN ===== */
.report-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Report Header */
.report-header { padding: 32px; }
.report-header-top {
  display: flex;
  align-items: center;
  gap: 28px;
}
.score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 32px var(--accent-glow);
}
.score-number {
  font-family: var(--font-display);
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1;
}
.score-label {
  font-size: .75rem;
  color: var(--text3);
}
.report-meta { flex: 1; }
.report-meta h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
}
.recommendation-badge {
  display: inline-block;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 6px 14px;
  border-radius: 100px;
  margin-top: 8px;
}
.recommendation-badge.accept { background: rgba(16,185,129,.15); color: var(--green); border: 1px solid rgba(16,185,129,.3); }
.recommendation-badge.minor { background: var(--yellow-glow); color: var(--yellow); border: 1px solid rgba(245,158,11,.3); }
.recommendation-badge.major { background: rgba(249,115,22,.15); color: #f97316; border: 1px solid rgba(249,115,22,.3); }
.recommendation-badge.reject { background: var(--red-glow); color: var(--red); border: 1px solid rgba(239,68,68,.3); }
.report-subtitle {
  font-size: .85rem;
  color: var(--text3);
  margin-top: 8px;
}

/* Radar Section */
.radar-section {
  padding: 28px;
  text-align: center;
}
.radar-section h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 20px;
  text-align: left;
}
.radar-section canvas {
  max-width: 100%;
  height: auto;
}

/* Issues & Strengths */
.issues-section, .strengths-section { padding: 24px 28px; }
.issues-section h3, .strengths-section h3, .summary-section h3, .metrics-section h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.issue-item, .strength-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--glass-border);
}
.issue-item:last-child, .strength-item:last-child { border-bottom: none; }
.issue-severity {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 6px;
}
.issue-severity.critical { background: var(--red); box-shadow: 0 0 8px var(--red-glow); }
.issue-severity.important { background: var(--yellow); box-shadow: 0 0 8px var(--yellow-glow); }
.issue-severity.minor { background: var(--green); box-shadow: 0 0 8px var(--green-glow); }
.strength-icon {
  flex-shrink: 0;
  color: var(--green);
  font-size: 1rem;
  margin-top: 2px;
}
.issue-text, .strength-text {
  font-size: .9rem;
  color: var(--text2);
  line-height: 1.5;
}

/* Dimension Sections */
.dimension-section {
  border-radius: var(--radius);
  border: 1px solid var(--glass-border);
  background: var(--glass);
  overflow: hidden;
  transition: border-color .2s;
}
.dimension-section:hover { border-color: var(--glass-border2); }

.dimension-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  cursor: pointer;
  user-select: none;
}
.dimension-score-bar {
  width: 60px;
  height: 6px;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}
.dimension-score-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .5s ease;
}
.dimension-name {
  flex: 1;
  font-weight: 600;
  font-size: .95rem;
}
.dimension-score-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  width: 40px;
  text-align: right;
}
.dimension-chevron {
  color: var(--text3);
  transition: transform .3s;
  flex-shrink: 0;
}
.dimension-section.open .dimension-chevron { transform: rotate(180deg); }

.dimension-body {
  display: none;
  padding: 0 24px 24px;
}
.dimension-section.open .dimension-body { display: block; }

.dimension-subsection {
  margin-top: 16px;
}
.dimension-subsection h4 {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text3);
  margin-bottom: 10px;
}
.finding-item, .suggestion-item {
  font-size: .85rem;
  color: var(--text2);
  line-height: 1.6;
  padding: 6px 0 6px 16px;
  border-left: 2px solid var(--glass-border);
  margin-bottom: 8px;
}
.suggestion-item { border-left-color: var(--accent); }

/* Summary */
.summary-section { padding: 24px 28px; }
#executiveSummary {
  font-size: .95rem;
  color: var(--text2);
  line-height: 1.7;
}

/* Metrics Grid */
.metrics-section { padding: 24px 28px; }
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.metric-card {
  background: var(--bg3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 20px;
  transition: border-color .2s;
}
.metric-card:hover { border-color: var(--glass-border2); }
.metric-card.metric-good { border-left: 3px solid var(--green); }
.metric-card.metric-warning { border-left: 3px solid var(--yellow); }
.metric-card.metric-bad { border-left: 3px solid var(--red); }
.metric-label {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text3);
  margin-bottom: 6px;
}
.metric-value {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
}
.metric-good .metric-value { color: var(--green); }
.metric-warning .metric-value { color: var(--yellow); }
.metric-bad .metric-value { color: var(--red); }
.metric-context {
  font-size: .75rem;
  color: var(--text3);
  margin-top: 4px;
}
.metric-explanation {
  font-size: .75rem;
  color: var(--text2);
  line-height: 1.5;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--glass-border);
}
.metric-tip {
  font-size: .75rem;
  color: var(--yellow);
  line-height: 1.5;
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--yellow-glow);
  border-radius: 6px;
  border: 1px solid rgba(245, 158, 11, .15);
}
.metric-examples {
  font-size: .72rem;
  color: var(--text2);
  line-height: 1.5;
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--glass);
  border-radius: 6px;
  border: 1px solid var(--glass-border);
}
.metric-examples code {
  color: var(--cyan);
  font-size: .72rem;
  background: var(--glass2);
  padding: 1px 4px;
  border-radius: 3px;
}
.metric-section-breakdown {
  font-size: .72rem;
  color: var(--text2);
  line-height: 1.6;
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--glass);
  border-radius: 6px;
}
.metric-section-breakdown .section-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 3px 0;
}
.metric-section-breakdown .section-bar-label {
  min-width: 80px;
  text-transform: capitalize;
}
.metric-section-breakdown .section-bar-fill {
  height: 6px;
  border-radius: 3px;
  background: var(--accent);
  opacity: .7;
}
.metric-section-breakdown .section-bar-value {
  color: var(--text3);
  min-width: 40px;
  text-align: right;
}

/* Metrics Analysis */
.metrics-analysis-header {
  margin-top: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--glass-border);
}
.metrics-analysis-header h4 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
}
.metrics-analysis-intro {
  font-size: .8rem;
  color: var(--text3);
  margin-top: 4px;
}

.analysis-block {
  margin-top: 16px;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--glass-border2);
  background: var(--bg3);
}
.analysis-block.analysis-good { border-left-color: var(--green); }
.analysis-block.analysis-warning { border-left-color: var(--yellow); }
.analysis-block.analysis-bad { border-left-color: var(--red); }

.analysis-block-header {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.analysis-block.open .analysis-block-header { margin-bottom: 10px; }
.analysis-chevron {
  margin-left: auto;
  transition: transform .3s ease;
  opacity: .5;
  flex-shrink: 0;
}
.analysis-block.open .analysis-chevron { transform: rotate(180deg); }
.analysis-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .4s ease;
}
.analysis-block.open .analysis-body { max-height: 5000px; }

/* Example sentences */
.example-sentences { margin: 12px 0; }
.example-sentence {
  font-style: italic;
  border-left: 2px solid var(--cyan);
  padding: 8px 12px;
  margin: 6px 0;
  background: var(--glass);
  border-radius: 0 8px 8px 0;
  font-size: .82rem;
  line-height: 1.5;
  color: var(--text2);
}
.example-sentence mark { background: rgba(0,212,255,.15); color: var(--cyan); font-style: normal; font-weight: 600; }
.example-meta { display: inline-block; background: var(--glass2); padding: 2px 8px; border-radius: 4px; font-size: .72rem; font-style: normal; margin-right: 8px; color: var(--text3); }
.example-hint { font-size: .8rem; color: var(--text3); margin-top: 6px; }

/* Action Boxes — actionable recommendations in analysis blocks */
.action-box {
  margin-top: 12px;
  padding: 14px 18px;
  border-radius: 10px;
  font-size: .82rem;
  line-height: 1.6;
}
.action-box p { margin-bottom: 6px; }
.action-box p:last-child { margin-bottom: 0; }
.action-box strong { color: inherit; }
.action-red {
  background: rgba(239,68,68,.06);
  border: 1px solid rgba(239,68,68,.2);
  color: var(--text2);
}
.action-red > p:first-child strong { color: var(--red); }
.action-yellow {
  background: rgba(245,158,11,.06);
  border: 1px solid rgba(245,158,11,.2);
  color: var(--text2);
}
.action-yellow > p:first-child strong { color: var(--yellow); }
.rewrite-list {
  list-style: none;
  padding: 0;
  margin: 8px 0;
}
.rewrite-list li {
  padding: 6px 0;
  border-bottom: 1px solid var(--glass-border);
  font-size: .82rem;
}
.rewrite-list li:last-child { border-bottom: none; }
.rewrite-before {
  color: var(--text3);
  text-decoration: line-through;
  text-decoration-color: rgba(239,68,68,.4);
}
.rewrite-after {
  color: var(--green);
}
.rewrite-after strong { color: var(--cyan); }

/* Citation Mismatch Examples */
.mismatch-section {
  margin-top: 12px;
}
.mismatch-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 8px 0;
}
.mismatch-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: .82rem;
  line-height: 1.5;
}
.mismatch-icon {
  flex-shrink: 0;
  font-weight: 700;
  width: 18px;
  text-align: center;
}
.mismatch-text {
  color: var(--text2);
  word-break: break-word;
}
.mismatch-missing {
  background: rgba(239,68,68,.06);
  border: 1px solid rgba(239,68,68,.15);
}
.mismatch-missing .mismatch-icon { color: var(--red); }
.mismatch-orphan {
  background: rgba(245,158,11,.06);
  border: 1px solid rgba(245,158,11,.15);
}
.mismatch-orphan .mismatch-icon { color: var(--yellow); }
.mismatch-hint {
  font-size: .78rem;
  color: var(--text3);
  margin-top: 6px;
  font-style: italic;
}

/* Priority Dashboard */
.priority-dashboard {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 16px;
}
.priority-dashboard h5 { margin: 0 0 12px; font-size: .9rem; color: var(--text); }
.priority-items { display: flex; flex-direction: column; gap: 8px; }
.priority-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .2s;
  font-size: .85rem;
}
.priority-item:hover { background: var(--glass2); }
.priority-critical { border-left: 3px solid #ef4444; }
.priority-important { border-left: 3px solid #f59e0b; }
.priority-minor { border-left: 3px solid #10b981; }
.priority-icon { font-size: .7rem; }
.priority-text { color: var(--text2); }

/* Benchmark Bars */
.benchmark-bars { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.benchmark-row { display: grid; grid-template-columns: 100px 1fr 60px 120px; gap: 8px; align-items: center; }
.bm-label { font-size: .82rem; font-weight: 500; color: var(--text2); }
.bm-bar-bg { position: relative; height: 8px; background: var(--glass2); border-radius: 4px; overflow: visible; }
.bm-bar-fill { height: 100%; border-radius: 4px; transition: width .5s ease; }
.bm-bar-fill.bm-good { background: var(--green); }
.bm-bar-fill.bm-warn { background: var(--yellow); }
.bm-bar-fill.bm-bad { background: var(--red); }
.bm-marker { position: absolute; top: -4px; width: 2px; height: 16px; background: var(--cyan); border-radius: 1px; }
.bm-value { font-size: .8rem; color: var(--text); font-weight: 600; text-align: right; }
.bm-benchmark { font-size: .72rem; color: var(--text3); }
.benchmark-legend { font-size: .75rem; color: var(--text3); margin-top: 4px; }
.bm-your { color: var(--green); }
.bm-target { color: var(--cyan); font-weight: 700; }

/* Section Readability Table */
.section-readability-table table,
.statcheck-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
  margin: 10px 0;
}
.section-readability-table th,
.statcheck-table th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--glass-border);
  color: var(--text3);
  font-weight: 500;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.section-readability-table td,
.statcheck-table td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  color: var(--text2);
}
.statcheck-table .sc-ok td:last-child { color: var(--green); }
.statcheck-table .sc-error td:last-child { color: var(--red); font-weight: 600; }
.statcheck-table .sc-error { background: rgba(239,68,68,.06); }

/* Checklist Grid (legacy) */
.checklist-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 12px 0; }
.checklist-col h6 { margin: 0 0 8px; font-size: .8rem; color: var(--text3); }
.cl-item { padding: 5px 8px; font-size: .82rem; border-radius: 6px; margin-bottom: 4px; display: flex; align-items: flex-start; gap: 6px; }
.cl-icon { font-size: .75rem; flex-shrink: 0; margin-top: 2px; }
.cl-ok { color: var(--green); background: rgba(16,185,129,.06); }
.cl-miss { color: var(--red); background: rgba(239,68,68,.06); }
.cl-hint { display: block; font-size: .72rem; color: var(--text3); margin-top: 2px; }

/* Checklist Detailed (new) */
.checklist-explainer { font-size: .85rem; color: var(--text3); margin: 4px 0 12px; }
.checklist-items-detailed { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.cl-item-detailed { padding: 10px 14px; border-radius: 8px; border-left: 3px solid var(--glass-border); }
.cl-miss-detailed { border-left-color: var(--red); background: rgba(239,68,68,.04); }
.cl-item-header { display: flex; align-items: center; gap: 8px; font-size: .88rem; }
.cl-icon-lg { font-size: .9rem; flex-shrink: 0; color: var(--red); }
.cl-item-desc { font-size: .82rem; color: var(--text3); margin-top: 6px; padding-left: 24px; line-height: 1.5; }
.checklist-found-summary { font-size: .85rem; color: var(--green); margin: 16px 0 6px; }
.checklist-found-list { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.cl-item-found { font-size: .8rem; color: var(--text2); display: flex; align-items: center; gap: 4px; }
.cl-icon-sm { color: var(--green); font-size: .75rem; }

/* Citation Verification */
.citation-verify-section { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--glass-border); }
.btn-verify {
  background: var(--glass2);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: .82rem;
  transition: background .2s;
}
.btn-verify:hover { background: rgba(0,212,255,.1); }
.btn-verify:disabled { opacity: .5; cursor: wait; }
.citation-verify-results { margin-top: 12px; }
.cv-row { display: flex; align-items: center; gap: 8px; padding: 4px 8px; font-size: .8rem; border-radius: 4px; margin-bottom: 3px; }
.cv-found { color: var(--green); }
.cv-missing { color: var(--yellow); }
.cv-icon { flex-shrink: 0; }
.cv-title { flex: 1; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-citations { font-size: .72rem; color: var(--text3); flex-shrink: 0; }
.cv-summary { font-size: .82rem; color: var(--text3); margin-top: 8px; }

@media (max-width: 600px) {
  .benchmark-row { grid-template-columns: 80px 1fr 50px; }
  .bm-benchmark { display: none; }
  .checklist-grid { grid-template-columns: 1fr; }
}

.analysis-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.analysis-good .analysis-icon { background: rgba(16,185,129,.15); color: var(--green); }
.analysis-warning .analysis-icon { background: var(--yellow-glow); color: var(--yellow); }
.analysis-bad .analysis-icon { background: var(--red-glow); color: var(--red); }

.analysis-title {
  font-weight: 700;
  font-size: .9rem;
  flex: 1;
}
.analysis-reason-badge {
  font-size: .72rem;
  font-weight: 500;
  line-height: 1.3;
  padding: 3px 10px;
  border-radius: 6px;
  max-width: 60%;
  text-align: right;
}
.analysis-good .analysis-reason-badge { background: rgba(16,185,129,.08); color: var(--green); }
.analysis-warning .analysis-reason-badge { background: var(--yellow-glow); color: var(--yellow); }
.analysis-bad .analysis-reason-badge { background: var(--red-glow); color: var(--red); }
.analysis-content {
  font-size: .85rem;
  color: var(--text2);
  line-height: 1.7;
}
.analysis-content p { margin-bottom: 8px; }
.analysis-content p:last-child { margin-bottom: 0; }
.analysis-content strong { color: var(--text); }
.analysis-content code {
  color: var(--cyan);
  background: var(--glass2);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: .8rem;
}

.analysis-examples {
  padding: 8px 12px;
  background: var(--glass);
  border-radius: 8px;
  border: 1px solid var(--glass-border);
}

/* Section Proportions */
.analysis-proportions {
  margin-top: 8px;
}
.proportion-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: .8rem;
}
.proportion-row.proportion-warn { color: var(--yellow); }
.proportion-label {
  min-width: 90px;
  text-transform: capitalize;
  color: var(--text2);
}
.proportion-bar-bg {
  flex: 1;
  height: 6px;
  background: var(--glass);
  border-radius: 3px;
  overflow: hidden;
}
.proportion-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  opacity: .7;
}
.proportion-pct {
  min-width: 36px;
  text-align: right;
  font-weight: 600;
  font-family: var(--font-display);
}
.proportion-ideal {
  font-size: .7rem;
  color: var(--text3);
  min-width: 90px;
}

/* Actions */
.report-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 12px;
}
.btn-export, .btn-new {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  border: 1px solid var(--glass-border2);
  background: var(--glass2);
  color: var(--text);
}
.btn-export:hover, .btn-new:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

/* Footer */
.footer {
  text-align: center;
  padding: 40px 20px;
  font-size: .8rem;
  color: var(--text3);
}
.footer a {
  color: var(--accent);
  text-decoration: none;
}
.footer a:hover { text-decoration: underline; }

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  .options-row { grid-template-columns: 1fr; }
  .report-header-top { flex-direction: column; text-align: center; }
  .score-circle { width: 100px; height: 100px; }
  .score-number { font-size: 2.2rem; }
  .report-container { padding: 20px 12px 40px; }
  .upload-card { padding: 20px; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
}

/* ===== PRINT CSS ===== */
@media print {
  :root {
    --text: #111;
    --text2: #333;
    --text3: #666;
  }
  body { background: #fff; color: #111; }
  .glow-orb, .footer, .report-actions, #screen-upload, #screen-loading { display: none !important; }
  .glass {
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .screen { display: block !important; }
  #screen-report { display: block !important; }
  .score-circle { border-color: #333; box-shadow: none; background: #fff; }
  .score-number, .dimension-score-num { color: #111; }
  .dimension-name, .report-meta h2 { color: #111; }
  .finding-item, .suggestion-item, .issue-text, .strength-text, #executiveSummary { color: #333; }
  .metric-card { background: #f5f5f5; border-color: #ddd; break-inside: avoid; }
  .metric-card.metric-good { border-left-color: #10b981; }
  .metric-card.metric-warning { border-left-color: #f59e0b; }
  .metric-card.metric-bad { border-left-color: #ef4444; }
  .metric-explanation { color: #555; border-top-color: #ddd; }
  .metric-tip { background: #fff8e1; border-color: #f5d060; color: #8a6d00; }
  .metric-examples { background: #f0f0f0; border-color: #ddd; color: #333; }
  .metric-examples code { background: #e0e0e0; color: #0066cc; }
  .metric-section-breakdown { background: #f0f0f0; color: #333; }
  .metric-section-breakdown .section-bar-fill { background: #666; }
  .analysis-block { background: #f8f8f8; border-color: #ccc; break-inside: avoid; }
  .analysis-block.analysis-good { border-left-color: #10b981; }
  .analysis-block.analysis-warning { border-left-color: #f59e0b; }
  .analysis-block.analysis-bad { border-left-color: #ef4444; }
  .analysis-content { color: #333; }
  .analysis-content code { background: #e8e8e8; color: #0066cc; }
  .analysis-examples { background: #f0f0f0; border-color: #ddd; }
  .proportion-bar-fill { background: #666; }
  .metric-label { color: #666; }
  .metric-value { color: #111; }
  .recommendation-badge { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .issue-severity { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .dimension-score-fill { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .dimension-body { display: block !important; }
  .dimension-section { break-inside: avoid; }
  .analysis-body { max-height: none !important; overflow: visible !important; }
  .analysis-chevron { display: none; }
  .priority-dashboard { border-color: #ddd; background: #f8f8f8; }
  .priority-item { border-left-color: #999; }
  .btn-verify { display: none; }
  .example-sentence { border-left-color: #999; background: #f5f5f5; }
  .bm-bar-fill { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .section-readability-table th, .statcheck-table th { border-bottom-color: #ccc; }
  .section-readability-table td, .statcheck-table td { border-bottom-color: #eee; color: #333; }
  .report-container { max-width: 100%; }
  canvas { max-width: 400px; margin: 0 auto; }
}
