/* ============================================================
   visualizador.css — Visualizador de Tensões e Círculo de Mohr
   Attractive Engenharia — paleta herdada do site (style.css)
   ============================================================ */

:root {
  --bg:          #0a0a0a;
  --bg-2:        #111111;
  --bg-3:        #1c1c1c;
  --surface:     #242424;
  --border:      #2a2a2a;
  --border-light:#3a3a3a;
  --text:        #f5f5f0;
  --text-muted:  #8a8a8a;
  --text-dim:    #5a5a5a;

  /* paleta semântica de tensões (consistente entre 3D e Mohr) */
  --tracao:      #4a90e2;  /* tração / positivo */
  --compr:       #ff8c00;  /* compressão / negativo */
  --cisalha:     #27ae60;  /* cisalhamento */
  --principal:   #f5d76e;  /* tensões principais / Mohr */
  --eixo:        #e24b4a;  /* eixos de referência */

  --nav-h: 82px;
  --panel-w: 320px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

@font-face {
  font-family: 'Zag';
  src: local('Zag'), url('../fonts/Zag Regular.otf') format('opentype');
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: 'Zag';
  src: local('Zag'), url('../fonts/Zag Bold.otf') format('opentype');
  font-weight: 700; font-display: swap;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Zag', 'Inter', 'Helvetica Neue', Arial, sans-serif;
  overflow: hidden;
}

.mono { font-family: 'IBM Plex Mono', 'Courier New', monospace; }

/* ── Topbar / seletor ──────────────────────────────────── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--nav-h);
  display: flex; align-items: center; gap: 1.5rem;
  padding: 0 1.25rem;
  background: rgba(10,10,10,0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  z-index: 100;
}
.topbar__brand {
  display: flex; align-items: center; gap: 0.6rem;
}
.topbar__logo-img {
  height: 52px; width: auto; display: block;
  filter: invert(1); mix-blend-mode: screen;
}
@media (max-width: 760px) { .topbar__logo-img { height: 38px; } }

.switch {
  display: flex; gap: 2px; padding: 3px;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 8px;
}
.switch__btn {
  border: none; background: transparent; color: var(--text-muted);
  font: inherit; font-size: 0.8rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 0.45rem 1rem; border-radius: 6px; cursor: pointer;
  transition: all 0.2s var(--ease);
}
.switch__btn.is-active { background: var(--text); color: var(--bg); }

.topbar__actions { margin-left: auto; display: flex; gap: 0.5rem; }
.btn {
  border: 1px solid var(--border-light); background: transparent;
  color: var(--text); font: inherit; font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 0.5rem 0.9rem; border-radius: 6px; cursor: pointer;
  transition: all 0.2s var(--ease);
}
.btn:hover { border-color: var(--text-muted); background: rgba(255,255,255,0.04); }
.btn--solid { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn--back { text-decoration: none; display: inline-flex; align-items: center; }
.btn--block { display: block; width: 100%; margin-top: 0.55rem; padding: 0.55rem; text-align: center; }

/* ── Layout ────────────────────────────────────────────── */
.stage {
  position: fixed; inset: var(--nav-h) 0 0 0;
  display: grid; grid-template-columns: var(--panel-w) 1fr var(--panel-w);
}
@media (max-width: 1100px) { .stage { grid-template-columns: var(--panel-w) 1fr; } }
@media (max-width: 760px)  { .stage { grid-template-columns: 1fr; } }

/* ── Painéis ───────────────────────────────────────────── */
.panel {
  background: var(--bg-2); border-right: 1px solid var(--border);
  overflow-y: auto; padding: 1.1rem 1rem 3rem;
}
.panel--right { border-right: none; border-left: 1px solid var(--border); }
@media (max-width: 1100px) { .panel--right { display: none; } }

.panel h3 {
  font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-muted); margin: 0.5rem 0 0.85rem;
}
.panel h3:not(:first-child) { margin-top: 1.6rem; }

.field { margin-bottom: 0.7rem; }
.field label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 0.72rem; color: var(--text-muted); margin-bottom: 0.3rem;
}
.field label b { color: var(--tracao); font-weight: 700; }
.field input[type=number] {
  width: 100%; padding: 0.5rem 0.6rem;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 5px; color: var(--text); font: inherit; font-size: 0.85rem;
}
.field input[type=number]:focus { outline: none; border-color: var(--tracao); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.5rem; }

.field--angle input[type=range] { width: 100%; accent-color: var(--principal); }

select.preset {
  width: 100%; padding: 0.5rem 0.6rem; background: var(--bg-3);
  border: 1px solid var(--border); border-radius: 5px;
  color: var(--text); font: inherit; font-size: 0.82rem;
}

/* ── Resultados ────────────────────────────────────────── */
.res { display: flex; flex-direction: column; gap: 0.35rem; }
.res__row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0.4rem 0.55rem; background: var(--bg-3);
  border: 1px solid var(--border); border-radius: 5px;
  font-size: 0.8rem;
}
.res__row .k { color: var(--text-muted); }
.res__row .v { font-weight: 700; }
.res__row .v.unit { font-size: 0.68rem; color: var(--text-dim); font-weight: 400; margin-left: 0.25rem; }
.res__row--hi .v { color: var(--principal); }
.res__row--t .v { color: var(--tracao); }
.res__row--c .v { color: var(--compr); }
.res__row--s .v { color: var(--cisalha); }

/* ── Viewport ──────────────────────────────────────────── */
.view { position: relative; background: var(--bg); overflow: hidden; }
#view3d, #viewMohr { position: relative; width: 100%; height: 100%; }
#canvas3d { display: block; width: 100%; height: 100%; position: relative; z-index: 1; }
.view--mohr { display: none; }
.view--mohr.is-active { display: block; }
.view--3d.is-hidden { display: none; }

#mohrSvg { width: 100%; height: 100%; display: block; position: relative; z-index: 1; background: transparent; cursor: crosshair; touch-action: none; }

/* ── Watermark logo (suave) ───────────────────────────── */
.watermark {
  position: absolute; inset: 0; z-index: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; user-select: none; opacity: 0.04;
}
.watermark svg { height: 66%; width: auto; color: var(--text); }

/* ── Leitura do cursor no Mohr ─────────────────────────── */
.mohr-cursor {
  position: absolute; bottom: 14px; left: 14px; z-index: 5;
  padding: 0.45rem 0.7rem; background: var(--bg-3);
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 0.74rem; color: var(--text); pointer-events: none;
}
.mohr-cursor .pin { color: var(--principal); font-weight: 700; }

.hint {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  font-size: 0.68rem; color: var(--text-dim); letter-spacing: 0.04em;
  background: rgba(10,10,10,0.6); padding: 5px 14px; border-radius: 14px;
  border: 1px solid var(--border); white-space: nowrap; pointer-events: none;
}

.mohr-toggle {
  position: absolute; top: 14px; left: 14px; display: flex; gap: 2px;
  padding: 3px; background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 7px; z-index: 5;
}
.mohr-toggle button {
  border: none; background: transparent; color: var(--text-muted);
  font: inherit; font-size: 0.72rem; font-weight: 700; padding: 0.35rem 0.8rem;
  border-radius: 5px; cursor: pointer; text-transform: uppercase; letter-spacing: 0.05em;
}
.mohr-toggle button.is-active { background: var(--text); color: var(--bg); }

.mohr-plane {
  position: absolute; top: 14px; right: 14px; z-index: 5;
  display: flex; flex-direction: column; gap: 0.35rem;
  padding: 0.6rem 0.75rem; min-width: 190px;
  background: var(--bg-3); border: 1px solid var(--border); border-radius: 7px;
}
.mohr-plane label {
  display: flex; justify-content: space-between; font-size: 0.7rem;
  color: var(--text-muted); letter-spacing: 0.04em;
}
.mohr-plane label b { color: var(--eixo); font-weight: 700; }
.mohr-plane input[type=range] { width: 100%; accent-color: var(--eixo); }
.mohr-plane .mono { font-size: 0.72rem; color: var(--text); }
.mohr-plane__num { display: flex; align-items: center; gap: 0.3rem; margin-top: 0.1rem; }
.mohr-plane__num input[type=number] {
  width: 64px; padding: 0.3rem 0.4rem; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 4px;
  color: var(--text); font: inherit; font-size: 0.78rem; text-align: right;
}
.mohr-plane__num input[type=number]:focus { outline: none; border-color: var(--eixo); }
.mohr-plane__num .deg { color: var(--text-muted); font-size: 0.78rem; }
.mohr-plane__num .magnet { margin-left: auto; font-size: 0.64rem; color: var(--principal); font-weight: 700; letter-spacing: 0.03em; }

/* ── Legenda ───────────────────────────────────────────── */
.legend { display: flex; flex-direction: column; gap: 0.45rem; margin-top: 0.4rem; }
.legend__item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.72rem; color: var(--text-muted); cursor: pointer; user-select: none; }
.legend__item input[type=checkbox] { accent-color: var(--tracao); width: 14px; height: 14px; flex-shrink: 0; cursor: pointer; margin: 0; }
.legend__item:hover { color: var(--text); }
.legend__sw { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }

.note { font-size: 0.66rem; color: var(--text-dim); line-height: 1.5; margin-top: 0.6rem; }

/* ── Direitos autorais ─────────────────────────────────── */
.copyright {
  margin-top: 1.4rem; padding-top: 0.9rem;
  border-top: 1px solid var(--border);
  font-size: 1.1rem; color: var(--text-dim); line-height: 1.7;
}
.copyright b { color: var(--text-muted); font-weight: 700; font-size: 1.2rem; display: block; margin-bottom: 0.25rem; }

/* tensões transformadas / plano */
.res__row--plane .v { color: var(--eixo); }

::-webkit-scrollbar { width: 7px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
