/* ══════════════════════════════════
   Avatar Analysis · Upload + Report · 治愈风
══════════════════════════════════ */

/* ── Shared nav bar ── */
.av-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(253,248,242,0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.av-nav-back {
  font-size: 0.83rem; color: var(--ink-muted); background: none;
  padding: 0.25rem 0; border: none; cursor: pointer;
  transition: color 0.18s;
}
.av-nav-back:hover { color: var(--coral); }
.av-nav-title { font-size: 0.82rem; color: var(--ink-muted); }

/* ══ Upload screen ══ */
#avatarUpload { background: var(--cream); }

.av-upload-body {
  flex: 1; overflow-y: auto;
  padding: 1.5rem 1rem 3rem;
  display: flex; flex-direction: column; align-items: center;
}
.av-upload-card {
  width: 100%; max-width: 600px;
  background: var(--warm-white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 1.75rem;
  display: flex; flex-direction: column; gap: 1.5rem;
  box-shadow: var(--shadow-sm);
}

/* Drop zone */
.av-drop-zone {
  border: 2px dashed rgba(44,36,32,0.15);
  border-radius: var(--r-md); padding: 2rem 1rem;
  text-align: center; cursor: pointer;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 0.5rem; background: var(--cream);
  transition: border-color 0.15s, background 0.15s;
  min-height: 180px;
}
.av-drop-zone:hover, .av-drop-zone.over {
  border-color: var(--coral); background: var(--coral-light);
}
.av-drop-zone.has-image { border-style: solid; border-color: var(--sage); }
.av-drop-zone.has-image .av-drop-icon,
.av-drop-zone.has-image .av-drop-label,
.av-drop-zone.has-image .av-drop-hint { display: none; }
.av-drop-icon { font-size: 2.5rem; line-height: 1; }
.av-drop-label { font-size: 0.95rem; color: var(--ink-soft); }
.av-drop-hint { font-size: 0.78rem; color: var(--ink-muted); }
#avPreviewImg {
  max-height: 180px; max-width: 100%;
  border-radius: var(--r-sm); border: 3px solid rgba(255,255,255,0.5);
  box-shadow: 0 2px 12px rgba(44,36,32,0.12);
}

/* Supplementary fields */
.av-ctx-section { display: flex; flex-direction: column; gap: 0.9rem; }
.av-ctx-label { font-size: 0.78rem; font-weight: 500; color: var(--ink-muted); letter-spacing: 0.06em; }
.av-ctx-label span { font-weight: 400; letter-spacing: 0; }

.av-field-row { display: flex; align-items: center; gap: 0.75rem; }
.av-field-row label { width: 90px; flex-shrink: 0; font-size: 0.83rem; color: var(--ink-soft); }
.av-field-row input {
  flex: 1; border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 0.45rem 0.75rem; font-size: 0.85rem; font-family: inherit;
  color: var(--ink); background: var(--warm-white);
}
.av-field-row input:focus { outline: 2px solid var(--coral); border-color: transparent; }

.av-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; }
.av-field { display: flex; flex-direction: column; gap: 0.2rem; }
.av-field label { font-size: 0.75rem; color: var(--ink-muted); }
.av-field select, .av-other {
  border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 0.45rem 0.65rem; font-size: 0.83rem; font-family: inherit;
  color: var(--ink); background: var(--warm-white); width: 100%;
}
.av-field select:focus, .av-other:focus { outline: 2px solid var(--coral); border-color: transparent; }
.av-other { display: none; margin-top: 0.2rem; }

/* Actions */
.av-actions { display: flex; flex-direction: column; gap: 0.75rem; }
.av-loading {
  display: flex; align-items: center; justify-content: center;
  gap: 0.6rem; font-size: 0.85rem; color: var(--ink-muted);
}
.av-spinner {
  width: 16px; height: 16px; flex-shrink: 0;
  border: 2px solid var(--cream-dark); border-top-color: var(--coral);
  border-radius: 50%; animation: avSpin 0.7s linear infinite;
}
@keyframes avSpin { to { transform: rotate(360deg); } }
.av-btn-start {
  padding: 0.85rem; font-size: 0.95rem;
  border-radius: var(--r-pill); width: 100%;
  box-shadow: 0 2px 8px rgba(240,112,85,0.25);
}
.av-btn-start:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; box-shadow: none; }

/* ══ Report screen ══ */
#avatarReport { background: var(--cream); }

.av-rpt-main { flex: 1; overflow-y: auto; padding: 1.5rem 1rem 3rem; }

/* PDF action bar */
.av-pdf-bar {
  max-width: 720px; margin: 0 auto 1.25rem;
  background: var(--warm-white); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 0.9rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
}
.av-pdf-bar-text { font-size: 0.85rem; color: var(--ink-soft); }
.av-pdf-bar-text strong { color: var(--coral); }
.av-pdf-bar-actions { display: flex; gap: 0.6rem; align-items: center; }
.av-pdf-loading {
  align-items: center; gap: 0.4rem;
  font-size: 0.8rem; color: var(--ink-muted);
}
.btn-rpt {
  padding: 0.6rem 1.25rem; border-radius: var(--r-pill);
  font-size: 0.85rem; font-weight: 500; cursor: pointer;
  transition: all 0.2s; font-family: inherit; border: none;
}
.btn-rpt-primary {
  background: var(--coral); color: var(--white);
  box-shadow: 0 2px 8px rgba(240,112,85,0.25);
}
.btn-rpt-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(240,112,85,0.35);
}
.btn-rpt-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-rpt-outline {
  background: var(--warm-white); border: 1.5px solid var(--border);
  color: var(--ink-soft);
}
.btn-rpt-outline:hover { border-color: var(--coral); color: var(--coral); }

/* Report card container */
#avReportCard {
  max-width: 720px; margin: 0 auto;
  background: var(--warm-white); border-radius: var(--r-lg);
  overflow: hidden; box-shadow: var(--shadow-lg);
}

/* Report header */
.rpt-header {
  background: linear-gradient(135deg, #2C2420 0%, #3d342e 55%, #4a3f38 100%);
  padding: 2rem 1.75rem 1.5rem;
  color: var(--white); position: relative; overflow: hidden;
}
.rpt-header::before {
  content: ''; position: absolute; right: -40px; top: -40px;
  width: 200px; height: 200px; border-radius: 50%;
  background: rgba(240,112,85,0.08);
}
.rpt-header-inner {
  display: grid; grid-template-columns: auto 1fr;
  gap: 1.5rem; align-items: flex-start; position: relative; z-index: 1;
}
.rpt-avatar {
  width: 88px; height: 88px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; color: rgba(255,255,255,0.4);
  flex-shrink: 0; overflow: hidden;
}
.rpt-avatar img { width: 100%; height: 100%; object-fit: cover; }
.rpt-meta-label {
  font-size: 0.63rem; font-weight: 500; letter-spacing: 0.2em;
  text-transform: uppercase; color: rgba(255,255,255,0.4); margin-bottom: 0.3rem;
}
.rpt-meta-title {
  font-family: var(--font-serif);
  font-size: 1.5rem; font-weight: 600; line-height: 1.2;
  color: var(--white); margin-bottom: 0.1rem;
}
.rpt-meta-subtitle { font-size: 0.78rem; color: rgba(255,255,255,0.5); margin-bottom: 0.9rem; }
.rpt-meta-table { display: grid; grid-template-columns: auto 1fr; gap: 0.1rem 0.75rem; font-size: 0.74rem; }
.rpt-meta-key { color: rgba(255,255,255,0.35); }
.rpt-meta-val { color: rgba(255,255,255,0.75); }
.rpt-id {
  font-size: 0.65rem; color: rgba(255,255,255,0.22);
  font-family: monospace; margin-top: 1rem; position: relative; z-index: 1;
}

/* Report sections */
.rpt-section { padding: 1.5rem 1.75rem; border-bottom: 1px solid var(--border); }
.rpt-section:last-of-type { border-bottom: none; }
.rpt-section-head { display: flex; align-items: center; gap: 0.55rem; margin-bottom: 1rem; }
.rpt-section-num {
  width: 20px; height: 20px; border-radius: 50%; background: var(--coral);
  color: var(--white); font-size: 0.62rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.rpt-section-title {
  font-size: 0.7rem; font-weight: 500; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--ink-muted);
}
.rpt-text { font-size: 0.9rem; color: var(--ink-soft); line-height: 1.9; }
.rpt-text p + p { margin-top: 0.85rem; }

/* Big Five cards */
.dim-cards { display: flex; flex-direction: column; gap: 0.75rem; }
.dim-card { border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.dim-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.75rem; padding: 0.7rem 1rem;
  background: var(--cream); border-bottom: 1px solid var(--border);
}
.dim-name-wrap { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.dim-name { font-weight: 500; font-size: 0.9rem; color: var(--ink); }
.dim-desc { font-size: 0.73rem; color: var(--ink-muted); }
.dim-level {
  font-size: 0.68rem; font-weight: 600; padding: 0.15rem 0.55rem;
  border-radius: var(--r-pill); white-space: nowrap; flex-shrink: 0;
}
.level-high { background: var(--sage-light); color: #3a8c5c; }
.level-mid  { background: var(--amber-light); color: #a0760a; }
.level-low  { background: var(--sky-light); color: #2c6faa; }
.level-na   { background: var(--cream); color: var(--ink-muted); border: 1px solid var(--border); }
.dim-basis { padding: 0.6rem 1rem; font-size: 0.82rem; color: var(--ink-soft); line-height: 1.7; }

/* Keywords */
.keywords-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.65rem;
}
.keyword-card {
  padding: 0.85rem 1rem; background: var(--cream);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  transition: transform 0.15s;
}
.keyword-card:hover { transform: translateY(-1px); }
.keyword-word {
  font-family: var(--font-serif); font-size: 1.05rem;
  font-weight: 600; color: var(--coral); margin-bottom: 0.25rem;
}
.keyword-desc { font-size: 0.76rem; color: var(--ink-muted); line-height: 1.5; }

/* Portrait */
.portrait-box {
  position: relative; padding: 1.25rem 1.4rem;
  background: var(--cream); border-radius: var(--r-sm);
  border: 1px solid var(--border);
}
.portrait-mark {
  font-family: var(--font-serif); font-size: 4rem;
  line-height: 0.5; color: rgba(240,112,85,0.2);
  position: absolute; top: 1rem; left: 1rem;
}
.portrait-text {
  font-size: 0.9rem; color: var(--ink-soft); line-height: 1.95; position: relative; z-index: 1;
}
.portrait-text p + p { margin-top: 0.8rem; }

/* Footer */
.rpt-footer {
  background: var(--cream); border-top: 1px solid var(--border);
  padding: 1.25rem 1.75rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.rpt-footer-left { flex: 1; }
.rpt-disclaimer { font-size: 0.73rem; color: var(--ink-muted); line-height: 1.65; margin-bottom: 0.3rem; }
.rpt-branding { font-size: 0.68rem; color: var(--ink-muted); opacity: 0.6; }
.rpt-seal {
  width: 68px; height: 68px; border-radius: 50%;
  border: 2px dashed rgba(240,112,85,0.3);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; flex-shrink: 0; gap: 0.1rem;
}
.rpt-seal-main { font-size: 0.58rem; font-weight: 500; color: var(--coral); line-height: 1.4; }
.rpt-seal-sub  { font-size: 0.48rem; color: var(--ink-muted); letter-spacing: 0.08em; }

/* Responsive */
@media (max-width: 560px) {
  .rpt-header-inner { grid-template-columns: 1fr; }
  .rpt-avatar { width: 68px; height: 68px; }
  .rpt-section { padding: 1.25rem; }
  .keywords-grid { grid-template-columns: 1fr 1fr; }
  .av-field-grid { grid-template-columns: 1fr; }
}

@media print {
  .av-header, .av-pdf-bar { display: none !important; }
  .av-rpt-main { padding: 0; }
  #avReportCard { box-shadow: none; border-radius: 0; max-width: 100%; }
}
