
:root{
  --tecno-blue:#1f2b57;
  --tecno-blue-2:#0057b8;
  --tecno-orange:#f5820b;
  --tecno-bg:#f4f6f8;
  --tecno-white:#ffffff;
  --tecno-text:#253047;
  --tecno-muted:#6b7280;
  --tecno-border:#dbe3ec;
  --tecno-success:#25d366;
  --tecno-shadow:0 18px 50px rgba(24,39,75,.18);
  --tecno-radius:18px;
  --tecno-bottom:92px; /* pensado para convivir con el botón flotante de WhatsApp actual */
  --tecno-right:20px;
}

#tecno-widget,
#tecno-widget *{
  box-sizing:border-box;
}

#tecno-widget{
  position:fixed;
  right:var(--tecno-right);
  bottom:var(--tecno-bottom);
  z-index:99999;
  font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;
  color:var(--tecno-text);
}

.tecno-launcher{
  width:64px;
  height:64px;
  border:0;
  border-radius:50%;
  display:grid;
  place-items:center;
  cursor:pointer;
  background:linear-gradient(135deg,var(--tecno-blue-2),var(--tecno-blue));
  color:#fff;
  box-shadow:0 12px 30px rgba(0,87,184,.32);
  transition:transform .22s ease, box-shadow .22s ease;
  position:relative;
}

.tecno-launcher:hover{
  transform:translateY(-2px);
  box-shadow:0 16px 36px rgba(0,87,184,.38);
}

.tecno-launcher:focus-visible,
.tecno-close:focus-visible,
.tecno-option:focus-visible,
.tecno-send:focus-visible,
.tecno-input:focus-visible{
  outline:3px solid rgba(0,87,184,.25);
  outline-offset:3px;
}

.tecno-launcher-mark{
  width:34px;
  height:34px;
  border:4px solid #fff;
  border-radius:50%;
  position:relative;
}

.tecno-launcher-mark::after{
  content:"";
  position:absolute;
  width:16px;
  height:6px;
  border-radius:99px;
  background:var(--tecno-orange);
  right:-7px;
  top:-3px;
  transform:rotate(-45deg);
}

.tecno-launcher-badge{
  position:absolute;
  right:-1px;
  top:-2px;
  width:18px;
  height:18px;
  border-radius:50%;
  background:var(--tecno-orange);
  border:3px solid #fff;
}

.tecno-panel{
  position:absolute;
  right:0;
  bottom:76px;
  width:min(390px, calc(100vw - 24px));
  max-height:min(680px, calc(100vh - 130px));
  background:var(--tecno-white);
  border:1px solid rgba(31,43,87,.12);
  border-radius:22px;
  box-shadow:var(--tecno-shadow);
  overflow:hidden;
  display:flex;
  flex-direction:column;
  opacity:0;
  visibility:hidden;
  transform:translateY(18px) scale(.97);
  transform-origin:bottom right;
  transition:opacity .22s ease, transform .22s ease, visibility .22s ease;
}

#tecno-widget.tecno-open .tecno-panel{
  opacity:1;
  visibility:visible;
  transform:translateY(0) scale(1);
}

.tecno-header{
  background:linear-gradient(135deg,var(--tecno-blue),#26366c);
  color:#fff;
  padding:16px 16px 14px;
  display:flex;
  align-items:center;
  gap:12px;
}

.tecno-avatar{
  width:46px;
  height:46px;
  border-radius:50%;
  background:#fff;
  display:grid;
  place-items:center;
  flex:0 0 46px;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.2);
}

.tecno-avatar-logo{
  display:block;
  width:30px;
  height:30px;
  object-fit:contain;
}

.tecno-title-wrap{
  min-width:0;
  flex:1;
}

.tecno-title{
  margin:0;
  font-size:1rem;
  font-weight:800;
  letter-spacing:.1px;
}

.tecno-subtitle{
  margin:2px 0 0;
  font-size:.78rem;
  color:rgba(255,255,255,.78);
  display:flex;
  align-items:center;
  gap:6px;
}

.tecno-status-dot{
  width:7px;
  height:7px;
  border-radius:50%;
  background:#6ee7a0;
}

.tecno-close{
  border:0;
  background:rgba(255,255,255,.1);
  color:#fff;
  width:34px;
  height:34px;
  border-radius:10px;
  cursor:pointer;
  font-size:22px;
  line-height:1;
}

.tecno-body{
  background:linear-gradient(180deg,#f8fafc 0%,#f3f6f9 100%);
  padding:16px;
  overflow-y:auto;
  overscroll-behavior:contain;
  flex:1;
  min-height:290px;
}

.tecno-message-row{
  display:flex;
  gap:9px;
  margin-bottom:12px;
  align-items:flex-end;
}

.tecno-message-row.user{
  justify-content:flex-end;
}

.tecno-mini-avatar{
  width:28px;
  height:28px;
  border-radius:50%;
  background:var(--tecno-blue);
  color:#fff;
  display:grid;
  place-items:center;
  font-size:11px;
  font-weight:800;
  flex:0 0 28px;
}

.tecno-bubble{
  max-width:82%;
  padding:11px 13px;
  border-radius:15px 15px 15px 4px;
  background:#fff;
  border:1px solid #e3e8ef;
  box-shadow:0 3px 10px rgba(31,43,87,.05);
  font-size:.91rem;
  line-height:1.45;
}

.tecno-message-row.user .tecno-bubble{
  background:var(--tecno-blue-2);
  color:#fff;
  border-color:var(--tecno-blue-2);
  border-radius:15px 15px 4px 15px;
}

.tecno-note{
  display:block;
  margin-top:7px;
  color:var(--tecno-muted);
  font-size:.75rem;
}

.tecno-options{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:9px;
  margin:14px 0 6px 37px;
}

.tecno-option{
  border:1px solid #dbe4ee;
  background:#fff;
  color:var(--tecno-blue);
  border-radius:12px;
  padding:11px 10px;
  text-align:left;
  font-size:.82rem;
  font-weight:700;
  cursor:pointer;
  transition:border-color .18s ease, transform .18s ease, background .18s ease;
}

.tecno-option:hover{
  border-color:#9bbce1;
  background:#f7fbff;
  transform:translateY(-1px);
}

.tecno-option[data-action="presupuesto"]{
  border-color:rgba(245,130,11,.35);
  background:#fffaf3;
}

.tecno-option[data-action="consulta"]{
  grid-column:1 / -1;
  text-align:center;
}

.tecno-footer{
  padding:12px;
  border-top:1px solid var(--tecno-border);
  background:#fff;
}

.tecno-form{
  display:flex;
  align-items:flex-end;
  gap:8px;
}

.tecno-input{
  flex:1;
  min-width:0;
  max-height:100px;
  resize:none;
  border:1px solid #d7dee7;
  background:#f8fafc;
  border-radius:14px;
  padding:11px 12px;
  font:inherit;
  font-size:.9rem;
  line-height:1.35;
  color:var(--tecno-text);
  transition:border-color .18s ease, box-shadow .18s ease;
}

.tecno-input:focus{
  border-color:#8ab5e2;
  box-shadow:0 0 0 3px rgba(0,87,184,.08);
  background:#fff;
}

.tecno-send{
  width:44px;
  height:44px;
  flex:0 0 44px;
  border:0;
  border-radius:12px;
  cursor:pointer;
  background:var(--tecno-blue-2);
  color:#fff;
  display:grid;
  place-items:center;
  transition:transform .18s ease, opacity .18s ease;
}

.tecno-send:hover{
  transform:translateY(-1px);
}

.tecno-send svg{
  width:19px;
  height:19px;
}

.tecno-footer-note{
  margin:7px 2px 0;
  text-align:center;
  font-size:.68rem;
  color:#8a94a5;
}

.tecno-hidden{
  display:none !important;
}

@media (max-width:600px){
  :root{
    --tecno-right:10px;
    --tecno-bottom:82px;
  }

  .tecno-launcher{
    width:58px;
    height:58px;
  }

  .tecno-panel{
    position:fixed;
    left:8px;
    right:8px;
    bottom:78px;
    width:auto;
    max-height:calc(100dvh - 96px);
    border-radius:18px;
  }

  .tecno-options{
    grid-template-columns:1fr;
    margin-left:37px;
  }

  .tecno-option[data-action="consulta"]{
    grid-column:auto;
  }

  .tecno-body{
    min-height:260px;
  }
}

@media (prefers-reduced-motion:reduce){
  .tecno-panel,
  .tecno-launcher,
  .tecno-option,
  .tecno-send{
    transition:none !important;
  }
}


/* FASE 1 DEFINITIVA: ocultar botón flotante mientras el chat está abierto */
#tecno-widget.tecno-open .tecno-launcher{
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  transform:scale(.92);
}


/* Ajustes adicionales para tablet y pantallas intermedias */
@media (min-width:601px) and (max-width:1024px){
  .tecno-panel{
    width:min(410px, calc(100vw - 32px));
    max-height:min(720px, calc(100vh - 120px));
  }
}

@media (max-height:650px) and (min-width:601px){
  .tecno-panel{
    max-height:calc(100vh - 100px);
  }
}


/* FASE 2: estados de conexión con IA */
.tecno-typing .tecno-bubble{
  color:#6b7280;
  font-style:italic;
}

.tecno-input:disabled{
  opacity:.7;
  cursor:wait;
}

.tecno-send:disabled{
  opacity:.55;
  cursor:wait;
  transform:none;
}
