
/* ============================================================
   LENDORA AIA — CAMADA DE PRODUÇÃO DA INTERFACE
   Estados, fontes, áudio superior, configurações e responsivo.
   ============================================================ */

:root {
  --lendora-accent: #3a83f6;
  --lendora-surface: #202020;
  --lendora-surface-2: #2b2b2b;
  --lendora-border: rgba(255,255,255,.10);
}

/* Fonte / citações */
.lendora-sources { margin-top: 14px; }
.lendora-sources-toggle {
  appearance:none; border:0; background:transparent; color:#a7a7a7;
  display:inline-flex; align-items:center; gap:7px; padding:5px 0;
  font-size:12px; font-weight:600; cursor:pointer;
}
.lendora-sources-toggle:hover { color:#eee; }
.lendora-sources-toggle .sources-chevron { transition:transform .16s ease; }
.lendora-sources.open .sources-chevron { transform:rotate(180deg); }
.lendora-sources-list { display:none; margin-top:8px; gap:7px; flex-direction:column; }
.lendora-sources.open .lendora-sources-list { display:flex; }
.lendora-source-card {
  display:flex; align-items:center; gap:9px; min-width:0; padding:9px 10px;
  border:1px solid var(--lendora-border); border-radius:10px; background:rgba(255,255,255,.025);
  color:#ddd; text-decoration:none;
}
.lendora-source-card:hover { background:rgba(255,255,255,.06); }
.lendora-source-favicon { width:22px; height:22px; border-radius:5px; object-fit:contain; background:#fff; flex:0 0 22px; }
.lendora-source-main { min-width:0; flex:1; }
.lendora-source-title { display:block; font-size:12px; font-weight:650; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.lendora-source-domain { display:block; font-size:10px; color:#888; margin-top:2px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.lendora-source-check { font-size:10px; color:#8ed1a5; }

/* Áudio superior: referência visual do player móvel */
.lendora-audio-topbar {
  position:fixed; z-index:1000; top:70px; left:50%; transform:translateX(-50%);
  width:min(680px, calc(100vw - 24px)); min-height:66px; box-sizing:border-box;
  display:flex; align-items:center; gap:12px; padding:9px 12px;
  border:1px solid rgba(0,0,0,.10); border-radius:17px;
  background:rgba(255,255,255,.97); color:#202020;
  box-shadow:0 12px 34px rgba(0,0,0,.20); backdrop-filter:blur(14px);
}
.lendora-audio-topbar[hidden] { display:none; }
.lendora-audio-topbar .audio-play {
  width:42px; height:42px; border:0; border-radius:50%; display:grid; place-items:center;
  background:#050505; color:#fff; cursor:pointer; flex:0 0 42px;
}
.lendora-audio-topbar .audio-time { width:45px; font:600 14px/1 ui-monospace,monospace; font-variant-numeric:tabular-nums; }
.lendora-audio-wave { flex:1; min-width:80px; height:40px; display:flex; align-items:center; gap:3px; overflow:hidden; }
.lendora-audio-wave span { width:3px; min-width:3px; border-radius:999px; background:#999; transform-origin:center; animation:lendoraAudioWave 1s ease-in-out infinite; }
.lendora-audio-wave span:nth-child(3n){animation-delay:-.32s}.lendora-audio-wave span:nth-child(4n){animation-delay:-.58s}.lendora-audio-wave span:nth-child(5n){animation-delay:-.14s}
.lendora-audio-topbar.paused .lendora-audio-wave span { animation-play-state:paused; transform:scaleY(.45); opacity:.45; }
.lendora-audio-close { width:38px;height:38px;border:0;background:transparent;border-radius:50%;font-size:30px;line-height:1;cursor:pointer;color:#111; }
.lendora-audio-close:hover { background:rgba(0,0,0,.07); }
@keyframes lendoraAudioWave { 0%,100%{transform:scaleY(.35);opacity:.55} 50%{transform:scaleY(1.45);opacity:1} }

/* Configurações */
.lendora-settings-backdrop { position:fixed; inset:0; z-index:1100; background:rgba(0,0,0,.46); backdrop-filter:blur(2px); }
.lendora-settings {
  position:fixed; z-index:1101; top:50%; left:50%; transform:translate(-50%,-50%);
  width:min(900px, calc(100vw - 28px)); height:min(680px, calc(100vh - 32px));
  display:flex; overflow:hidden; border:1px solid var(--lendora-border); border-radius:18px;
  background:#202020; color:#eee; box-shadow:0 24px 80px rgba(0,0,0,.55);
}
.lendora-settings-nav { width:210px; padding:16px 10px; border-right:1px solid var(--lendora-border); background:#1b1b1b; }
.lendora-settings-title { padding:8px 12px 16px; font-size:18px; font-weight:700; }
.lendora-settings-tab { width:100%; border:0; background:transparent; color:#aaa; border-radius:9px; padding:10px 12px; text-align:left; cursor:pointer; }
.lendora-settings-tab:hover,.lendora-settings-tab.active { background:#303030; color:#fff; }
.lendora-settings-content { flex:1; min-width:0; overflow:auto; padding:26px; }
.lendora-settings-head { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:24px; }
.lendora-settings-head h2 { margin:0; font-size:22px; }
.lendora-settings-close { width:36px;height:36px;border:0;border-radius:9px;background:transparent;color:#aaa;font-size:25px;cursor:pointer; }
.lendora-settings-close:hover { background:#303030;color:#fff; }
.lendora-setting-row { display:flex; align-items:center; justify-content:space-between; gap:20px; padding:15px 0; border-bottom:1px solid rgba(255,255,255,.07); }
.lendora-setting-row:last-child { border-bottom:0; }
.lendora-setting-row strong { display:block;font-size:14px; }.lendora-setting-row small{display:block;color:#888;margin-top:4px;line-height:1.4;}
.lendora-setting-row select,.lendora-setting-row input[type="text"] { background:#2b2b2b;color:#eee;border:1px solid var(--lendora-border);border-radius:8px;padding:8px 10px; }
.lendora-switch { width:44px;height:24px;border-radius:999px;border:0;background:#555;position:relative;cursor:pointer;flex:0 0 44px; }
.lendora-switch::after { content:""; position:absolute;top:3px;left:3px;width:18px;height:18px;border-radius:50%;background:#eee;transition:.16s; }
.lendora-switch.on { background:var(--lendora-accent); }.lendora-switch.on::after{left:23px;}
.lendora-setting-button { border:1px solid var(--lendora-border);background:#2b2b2b;color:#eee;border-radius:8px;padding:8px 11px;cursor:pointer; }
.lendora-setting-button:hover { background:#383838; }
.lendora-danger { color:#ff9b9b; }
.lendora-storage-meter { height:8px;background:#353535;border-radius:99px;overflow:hidden;margin-top:8px; }.lendora-storage-meter span{display:block;height:100%;background:var(--lendora-accent);width:0;}

/* Estado de geração */
.composer-row.is-processing { box-shadow:0 0 0 1px rgba(58,131,246,.22),0 8px 28px rgba(58,131,246,.06); }
.send-button.is-sending { background:#3b3b3b !important; color:#eee !important; }
.send-button.is-sending::after { content:""; width:15px;height:15px;border:2px solid rgba(255,255,255,.35);border-top-color:#fff;border-radius:50%;animation:lendoraSpin .75s linear infinite; }
.send-button.is-sending svg { display:none; }
@keyframes lendoraSpin{to{transform:rotate(360deg)}}

/* Seleção / destaque */
.message-text ::selection { background:rgba(58,131,246,.32); color:inherit; }

/* Imagens de resposta */
.lendora-imagens-resposta { grid-template-columns:repeat(auto-fit,minmax(180px,1fr)) !important; }
.lendora-imagem-card { border:1px solid rgba(255,255,255,.09); }
.lendora-imagem-card img { height:170px !important; }

@media (max-width:700px){
  .lendora-settings { width:calc(100vw - 16px);height:calc(100vh - 16px);border-radius:15px; }
  .lendora-settings-nav { width:130px; }
  .lendora-settings-content { padding:20px 16px; }
  .lendora-settings-title { font-size:15px; }
  .lendora-settings-tab { font-size:12px; }
  .lendora-audio-topbar { top:68px; }
}
@media (prefers-reduced-motion:reduce){.lendora-audio-wave span,.send-button.is-sending::after{animation:none}}

/* Fontes: comportamento de referência — resumo fechado, lista verificável ao abrir. */
.lendora-sources {
  margin-top: 14px;
  max-width: 760px;
}
.lendora-sources-toggle {
  min-height: 32px;
  border-radius: 8px;
  padding: 5px 8px;
}
.lendora-sources-toggle:hover { background: rgba(255,255,255,.055); }
.lendora-source-card {
  min-height: 48px;
  transition: background .12s ease, border-color .12s ease, transform .12s ease;
}
.lendora-source-card:hover {
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.16);
}
.lendora-source-title { color:#e6e6e6; }
.lendora-source-domain { color:#8d8d8d; }
