/* V65 - Chat IA de roteiros */
.roteiro-ai-section{background:linear-gradient(180deg,#f8fafc 0%,#eef6ff 100%)}
.roteiro-ai-layout{display:grid;grid-template-columns:minmax(280px,.75fr) minmax(360px,1.25fr);gap:24px;align-items:stretch}
.roteiro-ai-intro,.roteiro-chat-card{border:1px solid #dbe5ef;border-radius:28px;background:#fff;box-shadow:0 18px 42px rgba(15,23,42,.08)}
.roteiro-ai-intro{padding:30px}
.roteiro-ai-intro h2{margin:8px 0 10px;font-size:38px;line-height:1.04;letter-spacing:-.04em;color:#0f172a}
.roteiro-ai-intro p{color:#475569;line-height:1.65}
.roteiro-ai-city{margin-top:20px;padding:16px;border-radius:18px;background:#f8fafc;border:1px solid #dbe5ef}
.roteiro-ai-city small{display:block;color:#64748b;font-weight:900;text-transform:uppercase;font-size:12px;margin-bottom:4px}
.roteiro-ai-city strong{color:#0f172a;font-size:20px}
.roteiro-chat-card{overflow:hidden;display:grid;grid-template-rows:auto minmax(430px,1fr) auto}
.roteiro-chat-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:18px 20px;border-bottom:1px solid #e2e8f0;background:linear-gradient(180deg,#fff 0%,#f8fbff 100%)}
.roteiro-chat-head strong{display:block;color:#0f172a;font-size:20px;font-weight:950}
.roteiro-chat-head span{display:block;color:#64748b;font-size:13px}
.roteiro-chat-head button{border:1px solid #dbe5ef;background:#fff;color:#0f172a;border-radius:12px;padding:10px 12px;font-weight:900;cursor:pointer}
.roteiro-chat-messages{padding:18px;overflow:auto;background:#f8fafc}
.roteiro-msg{max-width:86%;margin:0 0 12px;padding:13px 15px;border-radius:18px;line-height:1.5;font-weight:700}
.roteiro-msg.bot{background:#fff;border:1px solid #dbe5ef;color:#0f172a;border-bottom-left-radius:6px}
.roteiro-msg.user{background:var(--primary,#0f766e);color:#fff;margin-left:auto;border-bottom-right-radius:6px}
.roteiro-msg.error{background:#fee2e2!important;color:#991b1b!important;border-color:#fecaca!important}
.roteiro-chat-input{display:grid;grid-template-columns:1fr auto;gap:10px;padding:16px;border-top:1px solid #e2e8f0;background:#fff}
.roteiro-chat-input input{min-height:50px;border:1px solid #dbe5ef;border-radius:15px;padding:0 14px;font:inherit;color:#0f172a;outline:none}
.roteiro-chat-input input:focus{border-color:var(--primary,#0f766e);box-shadow:0 0 0 4px rgba(15,118,110,.10)}
.roteiro-chat-input button,.roteiro-pdf-btn{border:0;border-radius:15px;background:var(--primary,#0f766e);color:#fff;font-weight:950;padding:0 18px;text-decoration:none;display:inline-flex;align-items:center;justify-content:center;min-height:50px;cursor:pointer}
.roteiro-result{margin-top:10px;max-height:360px;overflow:auto;border:1px solid #e2e8f0;border-radius:14px;background:#f8fafc;padding:12px;font-weight:600;color:#334155}
.roteiro-pdf-btn{margin-top:12px}
@media(max-width:900px){.roteiro-ai-layout{grid-template-columns:1fr}.roteiro-ai-intro{padding:22px}.roteiro-ai-intro h2{font-size:31px}.roteiro-chat-card{grid-template-rows:auto minmax(420px,1fr) auto}.roteiro-msg{max-width:94%}}
@media(max-width:520px){.roteiro-chat-input{grid-template-columns:1fr}.roteiro-chat-input button{width:100%}}


/* V66 - Chat IA em modal flutuante */
html.roteiro-ai-open{
  overflow:hidden!important;
}

.roteiro-ai-float{
  position:fixed;
  right:18px;
  bottom:148px;
  z-index:5200;
  display:flex;
  align-items:center;
  gap:8px;
  min-height:48px;
  padding:9px 14px 9px 10px;
  border:0;
  border-radius:999px;
  color:#fff;
  background:linear-gradient(135deg,var(--primary,#0f766e),#0f4c81);
  box-shadow:0 18px 38px rgba(15,23,42,.24);
  cursor:pointer;
  font-family:inherit;
  font-weight:950;
}

.roteiro-ai-float span{
  width:32px;
  height:32px;
  display:grid;
  place-items:center;
  border-radius:999px;
  background:rgba(255,255,255,.18);
}

.roteiro-ai-float strong{
  font-size:13px;
  white-space:nowrap;
}

.roteiro-ai-modal[hidden]{
  display:none!important;
}

.roteiro-ai-modal{
  position:fixed;
  inset:0;
  z-index:999998;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
}

.roteiro-ai-backdrop{
  position:absolute;
  inset:0;
  background:rgba(15,23,42,.54);
  backdrop-filter:blur(7px);
}

.roteiro-ai-dialog{
  position:relative;
  width:min(860px,100%);
  height:min(760px,calc(100vh - 36px));
  display:grid;
  grid-template-rows:auto minmax(0,1fr);
  border-radius:28px;
  background:#fff;
  border:1px solid rgba(219,229,239,.95);
  box-shadow:0 28px 90px rgba(0,0,0,.34);
  overflow:hidden;
  animation:roteiroModalUp .18s ease both;
}

@keyframes roteiroModalUp{
  from{opacity:0;transform:translateY(18px) scale(.98)}
  to{opacity:1;transform:translateY(0) scale(1)}
}

.roteiro-ai-modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:18px 20px;
  background:linear-gradient(135deg,var(--primary,#0f766e),#0f4c81);
  color:#fff;
}

.roteiro-ai-modal-head strong{
  display:block;
  font-size:23px;
  line-height:1.1;
  font-weight:950;
}

.roteiro-ai-modal-head small{
  display:block;
  margin-top:3px;
  color:rgba(255,255,255,.82);
  font-weight:800;
}

.roteiro-ai-kicker{
  display:inline-flex;
  width:max-content;
  padding:5px 9px;
  border-radius:999px;
  background:rgba(255,255,255,.16);
  border:1px solid rgba(255,255,255,.22);
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.08em;
  font-weight:950;
  margin-bottom:7px;
}

.roteiro-ai-close{
  width:44px;
  height:44px;
  border:0;
  border-radius:16px;
  background:rgba(255,255,255,.14);
  color:#fff;
  font-size:30px;
  line-height:1;
  cursor:pointer;
}

.roteiro-chat-card-modal{
  border:0!important;
  border-radius:0!important;
  box-shadow:none!important;
  height:100%;
  display:grid!important;
  grid-template-rows:auto minmax(0,1fr) auto!important;
}

.roteiro-chat-card-modal .roteiro-chat-messages{
  min-height:0;
}

@media(max-width:760px){
  .roteiro-ai-float{
    right:14px;
    bottom:142px;
    min-height:46px;
    padding-right:12px;
  }

  .roteiro-ai-float strong{
    display:none;
  }

  .roteiro-ai-modal{
    padding:8px;
    align-items:flex-end;
  }

  .roteiro-ai-dialog{
    width:100%;
    height:min(86vh,760px);
    border-radius:24px 24px 16px 16px;
  }

  .roteiro-ai-modal-head{
    padding:15px;
  }

  .roteiro-ai-modal-head strong{
    font-size:20px;
  }

  .roteiro-chat-card-modal .roteiro-chat-head{
    padding:12px 14px;
  }

  .roteiro-chat-card-modal .roteiro-chat-messages{
    padding:12px;
  }

  .roteiro-chat-input{
    padding:12px;
  }
}


/* V68 - Roteiro IA dentro do painel do usuário */
.roteiro-user-panel{
  display:grid;
  gap:18px;
}

.roteiro-user-head{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(220px,320px);
  gap:16px;
  align-items:stretch;
  border:1px solid #dbe5ef;
  border-radius:24px;
  background:#fff;
  padding:22px;
  box-shadow:0 14px 34px rgba(15,23,42,.06);
}

.roteiro-user-head h2{
  margin:8px 0 8px;
  color:#0f172a;
  font-size:30px;
  letter-spacing:-.03em;
}

.roteiro-user-head p{
  margin:0;
  color:#475569;
  line-height:1.6;
}

.roteiro-chat-card-user{
  min-height:620px;
  border-radius:24px!important;
  overflow:hidden;
}


@media(max-width:900px){
  .roteiro-user-head{
    grid-template-columns:1fr;
    padding:18px;
  }

  .roteiro-chat-card-user{
    min-height:560px;
  }
}


/* V70 - melhorias do roteiro IA */
.roteiro-chat-card-user{
  box-shadow:0 18px 48px rgba(15,23,42,.10)!important;
}
.roteiro-result{
  background:#ffffff!important;
  border:1px solid #dbe5ef!important;
  max-height:430px!important;
  line-height:1.62!important;
}
.roteiro-pdf-btn{
  gap:8px;
}
.roteiro-pdf-btn::before{
  content:"🖨️";
}


/* V73 - barra GERANDO PDF */
.roteiro-loading{
  position:relative;
  width:100%;
  height:12px;
  overflow:hidden;
  border-radius:999px;
  background:#e2e8f0;
  margin:10px 0 6px;
}
.roteiro-loading span{
  position:absolute;
  inset:0 auto 0 0;
  width:45%;
  border-radius:999px;
  background:linear-gradient(90deg,var(--primary,#0f766e),#0f4c81);
  animation:roteiroLoadingMove 1.05s ease-in-out infinite;
}
@keyframes roteiroLoadingMove{
  0%{left:-45%}
  100%{left:100%}
}
.roteiro-msg.bot small{
  display:block;
  color:#64748b;
  margin-top:4px;
  font-weight:700;
}


/* V74 - mensagem de PDF gerado com sucesso */
.roteiro-success-title{
  display:flex;
  align-items:center;
  gap:8px;
  color:#166534;
  font-weight:950;
}
.roteiro-success-title::before{
  content:"✓";
  width:24px;
  height:24px;
  display:inline-grid;
  place-items:center;
  border-radius:999px;
  background:#dcfce7;
  color:#166534;
}
.roteiro-generating-msg{
  border-color:#cfe8f7!important;
  background:#f8fbff!important;
}


/* V76 - lista de roteiros IA e exclusão */
.roteiro-ai-route-item{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  border:1px solid #dbe5ef;
  border-radius:16px;
  padding:14px;
  background:#fff;
  margin-bottom:10px;
}
.roteiro-ai-route-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.btn.danger{
  background:#fee2e2!important;
  color:#991b1b!important;
  border:1px solid #fecaca!important;
}
@media(max-width:760px){
  .roteiro-ai-route-item{display:grid}
  .roteiro-ai-route-actions{justify-content:stretch}
  .roteiro-ai-route-actions .btn{width:100%}
}
