:root{
  --bg:#0b0f14;
  --panel:#0f1620;
  --panel2:#121c28;
  --text:#e8eef6;
  --muted:#9fb1c6;
  --accent:#6aa6ff;
  --stroke:rgba(255,255,255,0.12);
  --stroke2:rgba(255,255,255,0.08);
  --input-bg:rgba(0,0,0,0.25);
  --input-bg2:rgba(255,255,255,0.04);
  --danger:#ff6a6a;

  color-scheme: dark;
}

*{ box-sizing:border-box; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: var(--bg);
  color: var(--text);
}

a{ color: var(--accent); text-decoration:none; }
 a:hover{ text-decoration:underline; }

/* Global form controls (dark theme, high contrast) */
input, select, textarea{
  font: inherit;
  color: var(--text);
}
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea{
  background: var(--input-bg);
  border:1px solid var(--stroke);
  border-radius:12px;
  padding:10px 12px;
  outline:none;
}
input::placeholder, textarea::placeholder{
  color: rgba(159,177,198,0.75);
}
select{
  appearance:none;
  background-image: linear-gradient(45deg, transparent 50%, rgba(232,238,246,0.75) 50%),
                    linear-gradient(135deg, rgba(232,238,246,0.75) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(1em + 2px), calc(100% - 13px) calc(1em + 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}
select option{
  background: #0f1620;
  color: var(--text);
}
input:focus, select:focus, textarea:focus{
  border-color: rgba(106,166,255,0.55);
  box-shadow: 0 0 0 3px rgba(106,166,255,0.15);
}

button, .btn{
  border-radius:12px;
  border:1px solid rgba(255,255,255,0.14);
  background: var(--accent);
  color:#061b0f;
  font-weight:800;
  padding:10px 12px;
  cursor:pointer;
}
button:hover, .btn:hover{
  filter: brightness(1.05);
}
button:disabled{
  opacity:0.55;
  cursor:not-allowed;
}

/* Fix file inputs on dark backgrounds */
input[type="file"]{
  color: var(--muted);
}

/* Utility */
.mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }


.topbar{
  height:56px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 16px;
  border-bottom:1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.15);
}
.brand{ font-weight:700; }
.topbar-actions{ display:flex; gap:14px; }
.link{ color: var(--muted); }

.layout{
  display:flex;
  height: calc(100vh - 56px);
}

.sidebar{
  width: 340px;
  border-right:1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.02);
  display:flex;
  flex-direction:column;
}
.sidebar-header{
  padding:12px;
  display:flex;
  justify-content:space-between;
  align-items:center;
}
.chatlist{ overflow:auto; padding:8px; }
.chatitem{
  padding:10px;
  border-radius:10px;
  cursor:pointer;
  margin-bottom:8px;
  background: rgba(255,255,255,0.03);
  border:1px solid rgba(255,255,255,0.06);
}
.chatitem:hover{ border-color: rgba(255,255,255,0.16); }
.chatitem.active{ outline:2px solid rgba(34,197,94,0.4); }
.chatitem .row{
  display:flex; justify-content:space-between; gap:8px;
}
.small{ font-size:12px; }
.muted{ color: var(--muted); }
.btn-small{
  background: rgba(255,255,255,0.06);
  border:1px solid rgba(255,255,255,0.14);
  color: var(--text);
  border-radius:10px;
  padding:6px 10px;
  cursor:pointer;
}
.btn-small:disabled{ opacity:0.5; cursor:not-allowed; }

.main{
  flex:1;
  display:flex;
  flex-direction:column;
}
.chat-header{
  padding:12px 14px;
  border-bottom:1px solid rgba(255,255,255,0.08);
  display:flex;
  justify-content:space-between;
  align-items:center;
}
.chat-title{ font-weight:700; }

.messages{
  flex:1;
  overflow:auto;
  padding:14px;
  display:flex;
  flex-direction:column;
  gap:10px;
}
.bubble{
  max-width: 72%;
  padding:10px 12px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  white-space: pre-wrap;
}
.bubble.out{ align-self:flex-end; background: rgba(148,163,184,0.10); border-color: rgba(148,163,184,0.20); }
.bubble.in{ align-self:flex-start; background: rgba(34,197,94,0.10); border-color: rgba(34,197,94,0.22); }
.bubble.human{ align-self:flex-end; background: rgba(59,130,246,0.12); border-color: rgba(59,130,246,0.22); }

.composer{
  display:flex;
  gap:10px;
  padding:12px;
  border-top:1px solid rgba(255,255,255,0.08);
  align-items:flex-end;
}
.composer input[type="text"]{
  flex:1;
  border-radius:12px;
  border:1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.25);
  color: var(--text);
  padding:10px 12px;
  outline:none;
}

/* En Web Demo: archivo + enviar en columna (para evitar clicks falsos) */
.composer-actions{
  display:flex;
  flex-direction:column;
  gap:12px;
  align-items:flex-start;
}
/* Acerca el bloque de botones al campo de texto sin cambiar el ancho del input */
.composer-actions{ transform: translateX(-50px); }
@media (max-width: 720px){
  /* Mantener el 'acercamiento' también en móvil */
  .composer-actions{ transform: translateX(-10px); }
}
.composer-actions input[type="file"],
.composer-actions button{
  width:220px;
  max-width:100%;
}

/* Web demo: custom file picker so "Elegir archivo" and "Enviar" align */
#fileInput{ display:none; }

.file-picker{
  display:flex;
  align-items:center;
  gap:12px;
}

.file-btn{
  border-radius:12px;
  border:1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.08);
  color:var(--text);
  font-weight:700;
  padding:10px 14px;
  width:220px;
  cursor:pointer;
}

.file-name{
  color:var(--muted);
  font-size:12px;
  max-width:160px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.composer button:not(.file-btn){
  border-radius:12px;
  border:1px solid rgba(255,255,255,0.14);
  background: var(--accent);
  color:#06210f;
  font-weight:700;
  padding:10px 14px;
  cursor:pointer;
}
.composer button:not(.file-btn):disabled{ opacity:0.5; cursor:not-allowed; }

.footer-note{ padding:0 12px 12px; }

.login-body{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:100vh;
}
.login-card{
  width:360px;
  padding:18px;
  border-radius:14px;
  background: rgba(255,255,255,0.03);
  border:1px solid rgba(255,255,255,0.10);
}
.login-card input{
  width:100%;
  margin-top:10px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.25);
  color: var(--text);
}
.login-card button{
  width:100%;
  margin-top:10px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,0.14);
  background: var(--accent);
  color:#fff;
  font-weight:700;
  cursor:pointer;
}
.error{
  background: rgba(239,68,68,0.15);
  border:1px solid rgba(239,68,68,0.25);
  padding:8px 10px;
  border-radius:12px;
  margin-top:10px;
}

.webdemo-body{ margin:0; }
.webdemo-wrap{
  display:flex;
  justify-content:center;
  padding:18px;
}
.webdemo-card{
  width:min(900px, 98vw);
  height: calc(100vh - 56px - 36px);
  border-radius:14px;
  background: rgba(255,255,255,0.03);
  border:1px solid rgba(255,255,255,0.10);
  display:flex;
  flex-direction:column;
}
.composer input[type="file"]{
  width:220px;
  color: var(--muted);
}
.quick-replies{
  padding:0 12px 12px;
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.qr{
  padding:8px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  cursor:pointer;
}
.qr:hover{
  border-color: rgba(34,197,94,0.35);
}

.bubble-media{ margin-top:8px; }
.bubble-image,
.bubble-video{
  display:block;
  max-width:min(100%, 360px);
  max-height:320px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,0.12);
  background:rgba(0,0,0,0.22);
}
.bubble-link{
  display:inline-flex;
  align-items:center;
  gap:8px;
  color:var(--text);
  text-decoration:none;
  border:1px solid rgba(255,255,255,0.12);
  background:rgba(255,255,255,0.04);
  border-radius:10px;
  padding:8px 10px;
}
.bubble-link:hover{ background:rgba(255,255,255,0.08); text-decoration:none; }
