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

:root {
  --bg:       #0f0e17;
  --surface:  #1e1c2e;
  --surface2: #252340;
  --border:   rgba(255,255,255,0.08);
  --text:     #fffffe;
  --muted:    #a7a9be;
  --accent:   #ff8906;
}

html, body {
  min-height: 100vh;
  font-family: 'Lato', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

/* ===== BG DECO ===== */
.bg-decoration { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.bg-decoration .circle { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.13; }
.c1 { width: 600px; height: 600px; background: #8338ec; top: -200px; left: -200px; }
.c2 { width: 500px; height: 500px; background: #3a86ff; bottom: -150px; right: -100px; }
.c3 { width: 350px; height: 350px; background: #ff006e; top: 40%; left: 45%; }

/* ===== CONTAINER ===== */
.app-container { position: relative; z-index: 1; max-width: 1380px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

/* ===== HEADER (mobile - acima do layout) ===== */
.app-header {
  text-align: center;
  margin-bottom: 1.8rem;
}

/* ===== HEADER (desktop - dentro do painel) ===== */
.panel-header {
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--border);
}

/* Estilos compartilhados do título */
.app-header h1,
.panel-header h1 {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.app-header h1    { font-size: clamp(2.4rem, 6vw, 3.4rem); }
.panel-header h1  { font-size: 1.9rem; }

.app-header h1 span,
.panel-header h1 span { color: var(--accent); font-style: italic; }

.subtitle {
  margin-top: 0.45rem;
  color: var(--muted);
  font-weight: 300;
  letter-spacing: 0.03em;
}
.app-header .subtitle  { font-size: 1rem; }
.panel-header .subtitle { font-size: 0.82rem; line-height: 1.45; }

/* Visibilidade responsiva */
.mobile-only  { display: none; }
.desktop-only { display: block; }

/* ===== MAIN LAYOUT ===== */
.main-layout { display: flex; gap: 2rem; align-items: flex-start; }

/* ===== PAINEL LATERAL ===== */
.controls-panel {
  flex: 0 0 272px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.5rem 1.3rem;
  display: flex; flex-direction: column; gap: 1.15rem;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
  position: sticky; top: 1.5rem;
}

/* Nome */
.name-section label { display: block; font-size: 0.71rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.45rem; }
.name-section input {
  width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 0.6rem 0.85rem; color: var(--text);
  font-family: 'Lato', sans-serif; font-size: 0.93rem; outline: none; transition: border-color 0.2s;
}
.name-section input:focus { border-color: var(--accent); }
.name-section input::placeholder { color: rgba(167,169,190,0.45); }

/* Lista seções */
.sections-list { display: flex; flex-direction: column; gap: 0.45rem; }
.section-group { border-radius: 13px; overflow: hidden; border: 1px solid var(--border); }
.section-group-header { padding: 0.48rem 0.85rem; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.13em; text-transform: uppercase; display: flex; align-items: center; gap: 0.45rem; }
.section-group-header .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.section-item { display: flex; align-items: center; gap: 0.6rem; padding: 0.42rem 0.85rem; background: var(--surface2); border-top: 1px solid var(--border); cursor: pointer; transition: background 0.15s; }
.section-item:hover { background: rgba(255,255,255,0.05); }
.section-item.active { background: rgba(255,255,255,0.08); }
.section-item .s-color { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.section-item .s-name { flex: 1; font-size: 0.77rem; color: var(--muted); line-height: 1.25; }
.section-item.active .s-name { color: var(--text); }

/* Score stepper */
.score-stepper { display: flex; align-items: center; gap: 3px; }
.score-stepper button { background: rgba(255,255,255,0.07); border: none; color: var(--text); width: 21px; height: 21px; border-radius: 5px; font-size: 0.82rem; cursor: pointer; transition: background 0.15s; line-height: 1; }
.score-stepper button:hover { background: rgba(255,255,255,0.16); }
.score-stepper .score-val { font-size: 0.77rem; font-weight: 700; min-width: 17px; text-align: center; }

/* Botões ação */
.actions { display: flex; gap: 0.6rem; }
.btn-reset, .btn-save {
  flex: 1; padding: 0.65rem 0.4rem; border-radius: 11px; border: none;
  font-family: 'Lato', sans-serif; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em;
  cursor: pointer; transition: all 0.2s;
}
.btn-reset { background: var(--surface2); color: var(--muted); border: 1px solid var(--border); }
.btn-reset:hover { color: var(--text); border-color: rgba(255,255,255,0.2); }
.btn-save { background: var(--accent); color: #0f0e17; box-shadow: 0 4px 18px rgba(255,137,6,0.3); }
.btn-save:hover { transform: translateY(-2px); box-shadow: 0 7px 24px rgba(255,137,6,0.5); }
.btn-save:active { transform: translateY(0); }

/* Botão analisar */
.btn-analyze {
  width: 100%; padding: 0.72rem 1rem;
  background: linear-gradient(135deg, #1f3a6e, #2d5b9e);
  border: 1px solid rgba(108, 163, 255, 0.3);
  border-radius: 13px; color: #d5e8ff;
  font-family: 'Lato', sans-serif; font-size: 0.84rem; font-weight: 700;
  letter-spacing: 0.04em; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  transition: all 0.25s;
  box-shadow: 0 4px 20px rgba(45,91,158,0.3);
}
.btn-analyze:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(45,91,158,0.5); background: linear-gradient(135deg, #2a4a80, #4070b8); }
.btn-analyze:active { transform: translateY(0); }
.analyze-icon { font-size: 1.1rem; }

/* Dica */
.legend-hint { border-top: 1px solid var(--border); padding-top: 0.9rem; }
.legend-hint p { font-size: 0.72rem; color: var(--muted); line-height: 1.5; font-style: italic; }

/* ===== CANVAS AREA ===== */
.canvas-area { flex: 1; display: flex; flex-direction: column; gap: 2rem; min-width: 0; }
.canvas-wrapper { display: flex; justify-content: center; align-items: center; position: relative; }
#wheelCanvas {
  max-width: 100%; cursor: pointer;
  filter: drop-shadow(0 0 40px rgba(0,0,0,0.5));
  transition: filter 0.3s;
}
#wheelCanvas:hover { filter: drop-shadow(0 0 55px rgba(0,0,0,0.7)); }

/* Tooltip */
.canvas-tooltip {
  position: absolute; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 0.45rem 0.85rem; font-size: 0.8rem; color: var(--text);
  pointer-events: none; opacity: 0; transition: opacity 0.18s; white-space: nowrap;
  z-index: 10; backdrop-filter: blur(8px); box-shadow: 0 4px 18px rgba(0,0,0,0.4);
}
.canvas-tooltip.visible { opacity: 1; }

/* ===== ANÁLISE ===== */
.analysis-box {
  background: var(--surface);
  border: 1px solid rgba(108,163,255,0.2);
  border-radius: 20px;
  padding: 1.8rem 2rem 2rem;
  box-shadow: 0 8px 48px rgba(0,0,0,0.45), 0 0 60px rgba(45,91,158,0.1);
  animation: slideUp 0.35s ease;
}
@keyframes slideUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }

.analysis-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.6rem; padding-bottom: 1rem;
  border-bottom: 1px solid rgba(108,163,255,0.15);
}
.analysis-badge {
  background: linear-gradient(135deg, #1f3a6e, #2d5b9e);
  color: #d5e8ff; font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.35rem 0.9rem; border-radius: 20px;
  border: 1px solid rgba(108,163,255,0.25);
}
.close-analysis {
  background: none; border: none; color: var(--muted);
  font-size: 1rem; cursor: pointer; padding: 0.3rem 0.6rem;
  border-radius: 8px; transition: all 0.2s;
}
.close-analysis:hover { background: rgba(255,255,255,0.07); color: var(--text); }

/* Conteúdo da análise */
.analysis-content { line-height: 1.72; }

.analysis-score-overview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.7rem;
  margin-bottom: 1.8rem;
}
.score-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  display: flex; flex-direction: column; gap: 0.3rem;
}
.score-card-name { font-size: 0.72rem; color: var(--muted); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.score-card-val {
  font-size: 1.6rem; font-weight: 900; line-height: 1;
}
.score-card-bar {
  height: 4px; border-radius: 2px; background: rgba(255,255,255,0.08);
  margin-top: 2px; overflow: hidden;
}
.score-card-bar-fill { height: 100%; border-radius: 2px; transition: width 0.5s ease; }

.analysis-section { margin-bottom: 1.6rem; }
.analysis-section:last-child { margin-bottom: 0; }
.ai-section-title {
  font-size: 0.98rem; font-weight: 900; color: #90b8ff;
  margin-bottom: 0.7rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.ai-section-title .icon { font-size: 1.1rem; }

.analysis-content p { color: rgba(255,255,254,0.82); font-size: 0.91rem; margin-bottom: 0.6rem; }
.analysis-content ul { padding-left: 1.3rem; margin-bottom: 0.7rem; }
.analysis-content li { color: rgba(255,255,254,0.82); font-size: 0.89rem; margin-bottom: 0.45rem; }
.analysis-content strong { color: #b8d4ff; font-weight: 700; }

.highlight-box {
  background: rgba(45,91,158,0.12);
  border: 1px solid rgba(108,163,255,0.18);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  margin: 1rem 0;
  font-size: 0.91rem;
  color: rgba(255,255,254,0.88);
  line-height: 1.65;
}
.highlight-box.warning {
  background: rgba(255,180,0,0.08);
  border-color: rgba(255,180,0,0.2);
}
.highlight-box.success {
  background: rgba(80,200,120,0.08);
  border-color: rgba(80,200,120,0.2);
}

.tag-list { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.6rem 0; }
.tag {
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  border-radius: 20px; padding: 0.2rem 0.7rem;
  font-size: 0.75rem; color: var(--muted); font-weight: 700;
}
.tag.positive { background: rgba(80,200,120,0.1); border-color: rgba(80,200,120,0.25); color: #90d4a8; }
.tag.attention { background: rgba(255,160,60,0.1); border-color: rgba(255,160,60,0.25); color: #ffc080; }

.analysis-divider { border: none; border-top: 1px solid var(--border); margin: 1.4rem 0; }

.message-final {
  background: linear-gradient(135deg, rgba(45,91,158,0.15), rgba(45,91,158,0.05));
  border: 1px solid rgba(108,163,255,0.2);
  border-radius: 14px; padding: 1.2rem 1.4rem;
  font-size: 0.94rem; color: #c8dcff;
  line-height: 1.7; font-style: italic;
  margin-top: 0.5rem;
}

/* Alerta de preenchimento insuficiente */
.ai-error {
  color: #ffb880; font-size: 0.9rem; padding: 0.9rem 1.1rem;
  background: rgba(255,140,0,0.08); border-radius: 10px;
  border: 1px solid rgba(255,140,0,0.2);
}

/* ===== RESPONSIVO ===== */
@media (max-width: 920px) {
  .mobile-only  { display: block; }
  .desktop-only { display: none; }
  .main-layout { flex-direction: column; align-items: center; }
  .controls-panel { flex: none; width: 100%; max-width: 540px; position: static; }
  .canvas-area { width: 100%; }
  .analysis-score-overview { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
