/* ====================================================================
   HAON_LEADS_TRAINING_V1 / HAON_TRAINING_REDESIGN_V1
   Botão Treinamento + chooser + tela cheia + janela flutuante única
   (cookbook em iframe isolado). Palantir-light premium, tema-aware,
   reduced-motion safe. training.js cria o DOM.
   Paleta de marca: #2D3BFF (azul elétrico) · #7B5CFF (violeta) · #00D4FF (ciano)
   ==================================================================== */
:root {
  --trn-blue: #2D3BFF;
  --trn-violet: #7B5CFF;
  --trn-cyan: #00D4FF;
  --trn-ink: #141B2E;       /* texto principal (alto contraste em superfície clara) */
  --trn-ink-soft: #51607A;  /* texto secundário (>=4.5:1 em #fff) */
  --trn-line: rgba(20, 40, 90, .12);
  --trn-surface: #ffffff;
  --trn-grad: linear-gradient(135deg, #2D3BFF 0%, #7B5CFF 55%, #00D4FF 140%);
  --trn-shadow-lg: 0 24px 70px rgba(20, 30, 80, .30), 0 4px 14px rgba(20, 30, 80, .14);
  --trn-ease: cubic-bezier(.22, .61, .36, 1);            /* suave, premium */
  --trn-spring: cubic-bezier(.18, .89, .32, 1.20);       /* leve overshoot dopaminérgico */
}

/* ---- ícones de linha (currentColor) ---- */
.trn-ic {
  width: 1.05em; height: 1.05em; flex: 0 0 auto; display: inline-block;
  vertical-align: -.16em; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ---- botão na topbar ---- */
#appContainer #trainingBtn { position: relative; display: inline-flex; align-items: center; gap: .42em; }
#appContainer #trainingBtn .trn-ic { width: 1.1em; height: 1.1em; }
#appContainer #trainingBtn::after {
  content: ""; position: absolute; right: 6px; top: 6px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--trn-grad); box-shadow: 0 0 8px rgba(0, 212, 255, .6);
}

.trn-logo {
  width: 42px; height: 42px; flex: 0 0 auto; border-radius: 13px;
  display: grid; place-items: center; font-weight: 800; font-size: 21px; color: #fff;
  font-family: 'Outfit', system-ui, sans-serif; letter-spacing: -.02em;
  background: var(--trn-grad);
  box-shadow: 0 8px 22px rgba(45, 59, 255, .34), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.trn-logo.sm { width: 28px; height: 28px; font-size: 15px; border-radius: 9px; }

/* ====================================================================
   CHOOSER (modal de escolha)
   ==================================================================== */
.trn-chooser-backdrop {
  position: fixed; inset: 0; z-index: 9600; display: grid; place-items: center; padding: 20px;
  background: rgba(10, 16, 34, .52); backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px);
  animation: trnBackIn .18s var(--trn-ease) both;
}
.trn-chooser {
  position: relative; width: min(468px, 100%); background: var(--trn-surface); color: var(--trn-ink);
  border-radius: 24px; padding: 26px; border: 1px solid var(--trn-line);
  box-shadow: var(--trn-shadow-lg);
  animation: trnPopIn .24s var(--trn-spring) both;
}
.trn-x {
  position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; display: grid; place-items: center;
  border: 0; background: transparent; color: var(--trn-ink-soft); cursor: pointer; border-radius: 10px;
  transition: background .14s, color .14s, transform .14s var(--trn-ease);
}
.trn-x .trn-ic { width: 18px; height: 18px; }
.trn-x:hover { color: var(--trn-ink); background: rgba(20, 40, 90, .06); transform: rotate(90deg); }
.trn-chooser-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.trn-chooser-tt b { display: block; font-size: 19px; letter-spacing: -.02em; font-family: 'Outfit', system-ui, sans-serif; }
.trn-chooser-tt span { font-size: 13px; color: var(--trn-ink-soft); }

.trn-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.trn-card {
  display: flex; flex-direction: column; gap: 6px; text-align: left; cursor: pointer;
  padding: 18px 16px; border-radius: 18px; border: 1.5px solid var(--trn-line); background: #f7f9ff;
  color: var(--trn-ink); position: relative; overflow: hidden;
  transition: transform .16s var(--trn-spring), border-color .16s, box-shadow .22s, background .16s;
}
.trn-card::before {
  content: ""; position: absolute; inset: 0; opacity: 0; background: var(--trn-grad);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; padding: 1.5px; border-radius: 18px;
  transition: opacity .18s;
}
.trn-card:hover { transform: translateY(-3px); background: #fff; box-shadow: 0 16px 34px rgba(45, 59, 255, .16); }
.trn-card:hover::before { opacity: 1; }
.trn-card:active { transform: translateY(-1px) scale(.99); }
.trn-card-ic { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: var(--trn-blue); background: rgba(45, 59, 255, .09); margin-bottom: 2px; }
.trn-card-ic .trn-ic { width: 21px; height: 21px; }
.trn-card b { font-size: 15px; letter-spacing: -.01em; }
.trn-card span { font-size: 12px; color: var(--trn-ink-soft); line-height: 1.4; }

.trn-cfg { margin-top: 18px; font-size: 13px; border-top: 1px solid var(--trn-line); padding-top: 4px; }
.trn-cfg summary { cursor: pointer; font-weight: 700; color: var(--trn-ink); padding: 10px 0; display: flex; align-items: center; gap: .45em; list-style: none; }
.trn-cfg summary::-webkit-details-marker { display: none; }
.trn-sum-ic { display: inline-grid; place-items: center; color: var(--trn-violet); }
.trn-sum-ic .trn-ic { width: 17px; height: 17px; }
.trn-cfg label { display: flex; flex-direction: column; gap: 5px; font-size: 11px; font-weight: 700; color: var(--trn-ink-soft); margin-top: 12px; text-transform: uppercase; letter-spacing: .04em; }
.trn-cfg input[type="text"], .trn-cfg input:not([type]) {
  padding: 11px 12px; border-radius: 11px; border: 1.5px solid var(--trn-line); font-size: 16px; /* >=16px: sem zoom iOS */
  font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--trn-ink); background: #f7f9ff;
  transition: border-color .14s, background .14s, box-shadow .14s;
}
.trn-cfg input:focus { outline: none; border-color: var(--trn-blue); background: #fff; box-shadow: 0 0 0 3px rgba(45, 59, 255, .14); }

/* ---- seletor de voz neural (Aurora / Téo / Mel) ---- */
.trn-voice-label { margin-top: 16px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--trn-ink-soft); }
.trn-voices { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; align-items: center; }
.trn-voice {
  padding: 9px 15px; border-radius: 999px; border: 1.5px solid var(--trn-line); background: #f4f6ff; color: var(--trn-ink);
  font-weight: 700; font-size: 13px; cursor: pointer; min-height: 38px;
  transition: background .14s, border-color .14s, box-shadow .18s, color .14s, transform .14s var(--trn-spring);
}
.trn-voice:hover { border-color: var(--trn-blue); transform: translateY(-1px); }
.trn-voice:active { transform: scale(.96); }
.trn-voice.on { background: var(--trn-grad); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(45, 59, 255, .32); }
.trn-voice-test {
  display: inline-flex; align-items: center; gap: .35em; padding: 9px 15px; border-radius: 999px; min-height: 38px;
  border: 1.5px solid rgba(45, 59, 255, .28); background: rgba(45, 59, 255, .07); color: var(--trn-blue);
  font-weight: 700; font-size: 13px; cursor: pointer; margin-left: auto;
  transition: background .14s, transform .14s var(--trn-spring);
}
.trn-voice-test .trn-ic { width: 14px; height: 14px; }
.trn-voice-test:hover { background: rgba(45, 59, 255, .14); }
.trn-voice-test:active { transform: scale(.96); }

/* ====================================================================
   TELA CHEIA
   ==================================================================== */
.trn-full {
  position: fixed; inset: 0; z-index: 9500; display: flex; flex-direction: column;
  background: #0c1024;
  opacity: 0; transform: scale(.985);
  transition: opacity .22s var(--trn-ease), transform .26s var(--trn-ease);
}
.trn-full.trn-in { opacity: 1; transform: none; }
.trn-full-head {
  display: flex; align-items: center; gap: 11px; padding: 11px 16px;
  background: linear-gradient(180deg, #121838, #0c1024); border-bottom: 1px solid rgba(120, 150, 255, .18); color: #eef2ff;
}
.trn-full-head b { font-size: 14.5px; letter-spacing: -.01em; font-family: 'Outfit', system-ui, sans-serif; }
.trn-full-actions { margin-left: auto; display: flex; gap: 9px; }
.trn-full-actions button {
  display: inline-flex; align-items: center; gap: .4em; border: 1px solid rgba(150, 175, 255, .26);
  background: rgba(255, 255, 255, .06); color: #e4ebff; border-radius: 11px; padding: 9px 14px; min-height: 40px;
  font-size: 13px; font-weight: 700; cursor: pointer; transition: background .14s, border-color .14s, transform .14s var(--trn-spring);
}
.trn-full-actions button .trn-ic { width: 16px; height: 16px; }
.trn-full-actions button:hover { background: rgba(120, 160, 255, .2); border-color: rgba(150, 175, 255, .5); }
.trn-full-actions button:active { transform: scale(.96); }
body.trn-full-open { overflow: hidden; }

/* ====================================================================
   JANELA FLUTUANTE (overlay único)
   ==================================================================== */
.trn-overlay {
  position: fixed; z-index: 9000; display: flex; flex-direction: column; overflow: hidden;
  min-width: 300px; min-height: 220px; border-radius: 18px; background: var(--trn-surface);
  border: 1px solid var(--trn-line);
  box-shadow: var(--trn-shadow-lg);
  opacity: 0; transform: translateY(10px) scale(.96); transform-origin: bottom right;
  transition: opacity .2s var(--trn-ease), transform .26s var(--trn-spring);
}
.trn-overlay.trn-in { opacity: 1; transform: none; }
.trn-ov-head {
  display: flex; align-items: center; gap: 9px; padding: 10px 12px; cursor: grab; user-select: none;
  background: linear-gradient(180deg, #121838, #0c1024); color: #eef2ff; flex: 0 0 auto;
  border-bottom: 1px solid rgba(120, 150, 255, .14);
}
.trn-ov-head:active { cursor: grabbing; }
.trn-ov-grip { display: inline-grid; place-items: center; opacity: .55; color: #aab8ff; }
.trn-ov-grip .trn-ic { width: 17px; height: 17px; }
.trn-ov-head b { font-size: 13px; font-weight: 700; letter-spacing: -.01em; font-family: 'Outfit', system-ui, sans-serif; }
.trn-ov-btns { margin-left: auto; display: flex; gap: 5px; }
.trn-ov-btns button {
  width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 9px;
  background: rgba(255, 255, 255, .08); color: #dce6ff; cursor: pointer;
  transition: background .14s, color .14s, transform .12s var(--trn-spring);
}
.trn-ov-btns button .trn-ic { width: 16px; height: 16px; }
.trn-ov-btns button:hover { background: rgba(120, 160, 255, .26); }
.trn-ov-btns button:active { transform: scale(.88); }
.trn-ov-btns button[data-act="close"]:hover { background: rgba(255, 90, 110, .85); color: #fff; }
.trn-frame { flex: 1 1 auto; width: 100%; border: 0; display: block; background: #f7f9ff; }
.trn-ov-resize {
  position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 52%, rgba(45, 59, 255, .5) 52%); border-bottom-right-radius: 18px;
}
.trn-overlay.trn-min { height: auto !important; min-height: 0; box-shadow: 0 12px 30px rgba(20, 30, 80, .28); }
.trn-overlay.trn-min .trn-frame, .trn-overlay.trn-min .trn-ov-resize { display: none; }
/* enquanto arrasta/redimensiona: trava o iframe pra ele não roubar o ponteiro */
.trn-overlay.trn-dragging { transition: none; }
.trn-overlay.trn-dragging .trn-frame { pointer-events: none; }

/* ====================================================================
   TEMA ESCURO
   ==================================================================== */
[data-theme="dark"] .trn-chooser, [data-theme="stone-dark"] .trn-chooser { background: #161b26; color: #eaf0fb; border-color: rgba(140, 165, 215, .18); }
[data-theme="dark"] .trn-chooser-tt span, [data-theme="stone-dark"] .trn-chooser-tt span,
[data-theme="dark"] .trn-card span, [data-theme="stone-dark"] .trn-card span { color: #a6b6d6; }
[data-theme="dark"] .trn-card, [data-theme="stone-dark"] .trn-card { background: rgba(255, 255, 255, .04); border-color: rgba(150, 175, 215, .16); color: #eaf0fb; }
[data-theme="dark"] .trn-card:hover, [data-theme="stone-dark"] .trn-card:hover { background: rgba(255, 255, 255, .07); }
[data-theme="dark"] .trn-card-ic, [data-theme="stone-dark"] .trn-card-ic { background: rgba(123, 92, 255, .18); color: #b7a6ff; }
[data-theme="dark"] .trn-cfg, [data-theme="stone-dark"] .trn-cfg { border-color: rgba(150, 175, 215, .16); }
[data-theme="dark"] .trn-cfg summary, [data-theme="stone-dark"] .trn-cfg summary { color: #eaf0fb; }
[data-theme="dark"] .trn-overlay, [data-theme="stone-dark"] .trn-overlay { background: #11151e; border-color: rgba(140, 165, 215, .2); }
[data-theme="dark"] .trn-frame, [data-theme="stone-dark"] .trn-frame { background: #11151e; }
[data-theme="dark"] .trn-voice, [data-theme="stone-dark"] .trn-voice { background: rgba(255, 255, 255, .05); color: #d3def2; border-color: rgba(150, 175, 215, .2); }
[data-theme="dark"] .trn-cfg input:not([type]), [data-theme="dark"] .trn-cfg input[type="text"],
[data-theme="stone-dark"] .trn-cfg input:not([type]), [data-theme="stone-dark"] .trn-cfg input[type="text"] { background: rgba(255, 255, 255, .05); color: #eaf0fb; border-color: rgba(150, 175, 215, .2); }

/* ====================================================================
   ANIMAÇÕES + RESPONSIVO + REDUCED MOTION
   ==================================================================== */
@keyframes trnBackIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes trnPopIn { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }

@media (max-width: 520px) {
  .trn-cards { grid-template-columns: 1fr; }
  .trn-chooser { padding: 22px; border-radius: 20px; }
  .trn-full-actions button span { display: none; }   /* só ícone no celular */
}

@media (prefers-reduced-motion: reduce) {
  .trn-chooser-backdrop, .trn-chooser, .trn-full, .trn-overlay,
  .trn-card, .trn-voice, .trn-x, .trn-ov-btns button, .trn-full-actions button { animation: none !important; transition: none !important; }
  .trn-full, .trn-overlay { opacity: 1; transform: none; }
}
/* ===== HAON_LEADS_TRAINING_V1_END ===== */
