/* IA do Observatório de Hospedagens RJ.
   Mesmo layout e funções da IA do Portal do Associado (dock fixo à direita no
   desktop, bolha flutuante no mobile, painel de tópicos, cota diária e botões
   de rota), pintada com os tokens do Observatório. */

:root{
  --ia-w:384px;
  --ia-w-min:56px;
  --ia-bg:#f8fafd;
  --ia-line:#e3e9f3;
  --ia-teal:#0f766e;
  --ia-teal-soft:#e6f6f4;
}

/* ---------------------------------------------------------------- dock shell */
.ia-dock{
  position:fixed;top:0;right:0;bottom:0;z-index:930;
  width:var(--ia-w);display:flex;flex-direction:column;overflow:hidden;
  background:var(--ia-bg);border-left:1px solid var(--ia-line);
  box-shadow:-14px 0 45px rgba(0,43,100,.07);
  transition:width .25s ease;
}
body.ia-dock-collapsed .ia-dock{width:var(--ia-w-min)}
@media (min-width:1200px){
  body.ia-dock-on .content{margin-right:var(--ia-w);transition:margin-right .25s ease}
  body.ia-dock-on.ia-dock-collapsed .content{margin-right:var(--ia-w-min)}
}
@media (max-width:1199px){ .ia-dock{display:none} }

.ia-rail{display:none;flex-direction:column;align-items:center;gap:14px;padding:14px 0;height:100%}
body.ia-dock-collapsed .ia-rail{display:flex}
body.ia-dock-collapsed .ia-panel{display:none}
.ia-rail-btn{
  width:40px;height:40px;display:grid;place-items:center;border:0;border-radius:12px;
  background:var(--accent);color:#fff;box-shadow:0 10px 28px rgba(37,99,235,.28);
}
.ia-rail-btn:hover{background:#1d4ed8}
.ia-rail-label{
  flex:1;writing-mode:vertical-rl;font-size:11px;font-weight:800;letter-spacing:.24em;
  text-transform:uppercase;color:var(--muted2);
}

/* ------------------------------------------------------------ bolha (mobile) */
.ia-bubble{
  position:fixed;right:16px;bottom:calc(var(--nav-h) + 22px + var(--safe-b));z-index:940;
  width:56px;height:56px;border:0;border-radius:50%;display:grid;place-items:center;
  background:var(--accent);color:#fff;box-shadow:0 16px 45px rgba(0,43,100,.34);
  transition:transform .18s ease,background .18s ease;
}
.ia-bubble:hover{transform:translateY(-3px);background:#1d4ed8}
.ia-bubble .ia-bubble-tag{
  position:absolute;top:-6px;right:-6px;padding:2px 6px;border-radius:999px;
  border:2px solid #fff;background:var(--ia-teal);color:#fff;
  font-size:8px;font-weight:800;letter-spacing:.06em;text-transform:uppercase;
}
@media (min-width:1200px){ .ia-bubble{display:none} }

/* ---------------------------------------------------------- painel flutuante */
.ia-float{
  position:fixed;right:16px;bottom:calc(var(--nav-h) + 22px + var(--safe-b));z-index:945;
  width:min(384px,calc(100vw - 32px));height:min(544px,calc(100dvh - 150px));
  display:flex;flex-direction:column;overflow:hidden;
  background:var(--ia-bg);border:1px solid var(--ia-line);border-radius:26px;
  box-shadow:0 28px 90px rgba(0,43,100,.28);
}
@media (min-width:1200px){ .ia-float{display:none} }

/* --------------------------------------------------------------- tela cheia */
.ia-full{
  position:fixed;inset:0;z-index:980;display:flex;align-items:center;justify-content:center;
  padding:0;background:rgba(7,17,33,.5);backdrop-filter:blur(3px);
}
.ia-full .ia-panel{
  width:min(900px,100vw);height:min(860px,100dvh);
  background:var(--ia-bg);border:1px solid var(--ia-line);border-radius:0;
  display:flex;flex-direction:column;overflow:hidden;
}
@media (min-width:768px){ .ia-full{padding:24px} .ia-full .ia-panel{border-radius:24px} }

/* -------------------------------------------------------------------- painel */
.ia-panel{display:flex;flex-direction:column;min-height:0;flex:1}
.ia-head{
  display:flex;align-items:center;justify-content:space-between;gap:8px;flex:0 0 auto;
  padding:10px 12px;background:rgba(255,255,255,.92);border-bottom:1px solid var(--ia-line);
}
.ia-head-id{display:flex;align-items:center;gap:10px;min-width:0}
.ia-head-id img{width:38px;height:38px;border-radius:12px;object-fit:contain;background:#fff;padding:4px;border:1px solid var(--ia-line)}
.ia-title-row{display:flex;align-items:center;gap:6px}
.ia-title{margin:0;font-family:Sora,Inter,sans-serif;font-size:14px;font-weight:800;color:#0b1a30;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ia-badge{padding:2px 6px;border-radius:999px;background:var(--ia-teal-soft);color:var(--ia-teal);font-size:8px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}
.ia-sub{margin:1px 0 0;font-size:11px;font-weight:500;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ia-head-actions{display:flex;align-items:center;gap:2px}
.ia-icon-btn{
  width:34px;height:34px;display:grid;place-items:center;border:0;border-radius:10px;
  background:transparent;color:var(--muted);
}
.ia-icon-btn:hover{background:var(--accent-soft);color:var(--accent)}
.ia-icon-btn svg{width:16px;height:16px;stroke:currentColor;stroke-width:2;fill:none;stroke-linecap:round;stroke-linejoin:round}

.ia-body{flex:1;min-height:0;display:flex;flex-direction:column}
.ia-msgs{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:16px;display:flex;flex-direction:column;gap:14px}

.ia-empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:6px}
.ia-empty-mark{width:56px;height:56px;display:grid;place-items:center;border-radius:50%;background:#fff;color:var(--accent);box-shadow:0 10px 30px rgba(16,38,73,.12),0 0 0 8px rgba(37,99,235,.08)}
.ia-empty-mark svg{width:24px;height:24px;stroke:currentColor;stroke-width:2;fill:none;stroke-linecap:round;stroke-linejoin:round}
.ia-empty h3{margin:14px 0 0;font-family:Sora,Inter,sans-serif;font-size:17px;font-weight:800;color:#0b1a30}
.ia-empty p{margin:4px 0 0;max-width:19rem;font-size:12px;line-height:1.5;color:var(--muted)}
.ia-chips{margin-top:14px;display:flex;flex-wrap:wrap;justify-content:center;gap:8px}
.ia-chip{
  padding:6px 12px;border-radius:999px;border:1px solid #bcd0f7;background:#fff;
  color:var(--accent);font-size:11px;font-weight:700;box-shadow:var(--shadow);
}
.ia-chip:hover{background:var(--accent-soft)}
.ia-chip.strong{border-color:#9dbcf5;background:var(--accent-soft);font-weight:800}

.ia-msg{display:flex;gap:8px;align-items:flex-start}
.ia-msg.user{justify-content:flex-end}
.ia-avatar{width:28px;height:28px;flex:0 0 auto;display:grid;place-items:center;border-radius:10px;background:#fff;border:1px solid #d9e6fb;color:var(--accent)}
.ia-avatar svg{width:14px;height:14px;stroke:currentColor;stroke-width:2;fill:none;stroke-linecap:round;stroke-linejoin:round}
.ia-bubble-msg{max-width:86%;padding:9px 12px;border-radius:16px;font-size:12.5px;line-height:1.55}
.ia-msg.user .ia-bubble-msg{max-width:82%;background:var(--accent);color:#fff;border-bottom-right-radius:6px;font-weight:500;white-space:pre-wrap}
.ia-msg.bot .ia-bubble-msg{background:#fff;border:1px solid #eef2f8;color:#26364f;border-top-left-radius:6px;box-shadow:var(--shadow)}
.ia-msg.bot.error .ia-bubble-msg{background:#fdeef1;border-color:#f4c6d1;color:#8f1d38}
.ia-bubble-msg p{margin:0 0 8px}
.ia-bubble-msg p:last-child{margin-bottom:0}
.ia-bubble-msg ul{margin:0 0 8px;padding-left:18px}
.ia-bubble-msg li{margin:0 0 4px}
.ia-bubble-msg strong{font-weight:700;color:#13233a}
.ia-routes{margin-top:9px;padding-top:8px;border-top:1px solid #eef2f8;display:flex;flex-wrap:wrap;gap:6px}
.ia-route{
  padding:4px 10px;border-radius:999px;border:1px solid #bcd0f7;background:var(--accent-soft);
  color:#1d4ed8;font-size:10px;font-weight:800;
}
.ia-route:hover{background:#dbe7fd}

.ia-foot{flex:0 0 auto;padding:12px;background:rgba(255,255,255,.92);border-top:1px solid var(--ia-line)}
.ia-composer{border:1px solid var(--line-strong);border-radius:16px;background:#fff;padding:8px;box-shadow:0 10px 35px rgba(15,45,85,.10)}
.ia-composer textarea{
  width:100%;border:0;resize:none;outline:none;background:transparent;
  padding:2px 6px;font-size:12.5px;line-height:1.5;color:var(--text);
}
.ia-composer textarea::placeholder{color:var(--muted2)}
.ia-composer-row{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:4px}
.ia-safe{display:inline-flex;align-items:center;gap:4px;font-size:9.5px;font-weight:600;color:var(--muted2)}
.ia-safe svg{width:12px;height:12px;stroke:var(--ia-teal);stroke-width:2;fill:none;stroke-linecap:round;stroke-linejoin:round}
.ia-send{width:32px;height:32px;display:grid;place-items:center;border:0;border-radius:11px;background:var(--accent);color:#fff}
.ia-send:hover{background:#1d4ed8}
.ia-send:disabled{opacity:.4;cursor:not-allowed}
.ia-send svg{width:16px;height:16px;stroke:currentColor;stroke-width:2.6;fill:none;stroke-linecap:round;stroke-linejoin:round}
.ia-error{margin:6px 2px 0;font-size:10.5px;font-weight:700;color:var(--danger)}
.ia-quota{margin-top:7px;display:flex;align-items:center;justify-content:center;gap:6px;font-size:9.5px;color:var(--muted)}
.ia-quota b{color:var(--ia-teal);font-weight:800}

/* ------------------------------------------------------------ painel tópicos */
.ia-topics{
  position:fixed;inset:0;z-index:990;display:flex;align-items:flex-end;justify-content:center;
  background:rgba(7,17,33,.42);backdrop-filter:blur(3px);
}
@media (min-width:640px){ .ia-topics{align-items:center;padding:16px} }
.ia-topics-card{
  display:flex;flex-direction:column;width:100%;max-width:760px;max-height:88dvh;overflow:hidden;
  background:var(--ia-bg);border:1px solid var(--ia-line);border-radius:24px 24px 0 0;
  box-shadow:var(--shadow-lg);
}
@media (min-width:640px){ .ia-topics-card{border-radius:24px} }
.ia-topics-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:18px 20px;background:#fff;border-bottom:1px solid var(--ia-line)}
.ia-topics-head .eyebrow{margin:0;display:flex;align-items:center;gap:6px;font-size:10px;font-weight:800;letter-spacing:.16em;text-transform:uppercase;color:#1d4ed8}
.ia-topics-head .eyebrow svg{width:14px;height:14px;stroke:currentColor;stroke-width:2;fill:none}
.ia-topics-head h2{margin:6px 0 0;font-family:Sora,Inter,sans-serif;font-size:19px;font-weight:800;color:#0b1a30}
.ia-topics-head p{margin:4px 0 0;font-size:12px;color:var(--muted)}
.ia-topics-body{min-height:0;overflow-y:auto;padding:16px 20px 22px}
.ia-topics-grid{display:grid;gap:8px}
@media (min-width:640px){ .ia-topics-grid{grid-template-columns:1fr 1fr} }
.ia-topic{
  display:flex;align-items:center;gap:12px;min-height:62px;padding:12px;text-align:left;
  border:1px solid #d9e6fb;border-radius:16px;background:#fff;box-shadow:var(--shadow);
}
.ia-topic:hover{border-color:#9dbcf5;background:var(--accent-soft)}
.ia-topic-mark{width:38px;height:38px;flex:0 0 auto;display:grid;place-items:center;border-radius:12px;background:var(--navy);color:#fff}
.ia-topic-mark svg{width:18px;height:18px;stroke:currentColor;stroke-width:2;fill:none;stroke-linecap:round;stroke-linejoin:round}
.ia-topic span.label{font-size:13px;font-weight:800;color:#26364f}
.ia-topics-sec{margin-top:20px;display:flex;align-items:flex-end;justify-content:space-between;gap:12px}
.ia-topics-sec .eyebrow{margin:0;font-size:10px;font-weight:800;letter-spacing:.16em;text-transform:uppercase;color:#1d4ed8}
.ia-topics-sec h3{margin:4px 0 0;font-family:Sora,Inter,sans-serif;font-size:15px;font-weight:800;color:#13233a}
.ia-topics-count{padding:4px 10px;border-radius:999px;background:var(--accent-soft);color:#1d4ed8;font-size:10px;font-weight:800}
.ia-topics-search{margin-top:12px;display:flex;align-items:center;gap:8px;padding:9px 12px;border:1px solid var(--line-strong);border-radius:12px;background:#fff}
.ia-topics-search svg{width:15px;height:15px;stroke:var(--muted2);stroke-width:2;fill:none}
.ia-topics-search input{flex:1;min-width:0;border:0;outline:none;background:transparent;font-size:13px;color:var(--text)}
.ia-topics-list{margin-top:12px;display:grid;gap:8px}
@media (min-width:640px){ .ia-topics-list{grid-template-columns:1fr 1fr} }
.ia-topics-item{
  display:flex;align-items:center;gap:10px;min-height:46px;padding:8px 12px;text-align:left;
  border:1px solid var(--line);border-radius:12px;background:#fff;
}
.ia-topics-item:hover{border-color:#9dbcf5;background:var(--accent-soft)}
.ia-topics-item .n{width:26px;height:26px;flex:0 0 auto;display:grid;place-items:center;border-radius:9px;background:#eef2f8;color:var(--navy);font-size:10px;font-weight:800}
.ia-topics-item .t{font-size:12px;font-weight:700;line-height:1.35;color:#3d4d66}

@media print{ .ia-dock,.ia-float,.ia-bubble,.ia-topics,.ia-full{display:none!important} body.ia-dock-on .content{margin-right:0!important} }
