:root{
  --bg:#0b0c10;
  --card:#111218;
  --line:#222;
  --txt:#e8e8e8;
  --muted: rgba(255,255,255,.68);
  --accent:#2a2cff;
  --accent2:#3a3cff;
  --danger:#ff3b30;

  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

*{ box-sizing:border-box; }
html, body{ height:100%; }
body{
  margin:0;
  background:var(--bg);
  color:var(--txt);
}

.noScroll{ overflow:hidden; }

.hidden{ display:none !important; }

/* ---------- App layout (mobile-first) ---------- */
.app{
  height:100vh;
  display:flex;
}

/* Chat ocupa toda la pantalla */
.chatFull{
  flex:1;
  height:100vh;
  display:flex;
  flex-direction:column;
  background:var(--bg);
}

/* Header fijo */
.chatHeader{
  position:sticky;
  top:0;
  z-index:10;

  display:flex;
  align-items:center;
  gap:10px;

  padding:12px 12px;
  background:rgba(11,12,16,.92);
  backdrop-filter: blur(10px);

  border-bottom:1px solid var(--line);
}

.chatHeaderCenter{
  flex:1;
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:2px;
}

.chatTitle{
  font-weight:700;
  font-size:15px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.chatSub{
  display:flex;
  gap:10px;
  font-size:12px;
  color:var(--muted);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* Mensajes: scrollable */
.messagesFull{
  flex:1;
  overflow:auto;
  padding:14px 12px 18px;

  display:flex;
  flex-direction:column;
  gap:10px;
}

/* Burbuja */
.bubble{
  max-width: 82%;
  border:1px solid #2a2a2a;
  border-radius:16px;
  padding:10px 12px;
  background:#0b0c10;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}

.bubble.me{
  margin-left:auto;
  border-color: var(--accent2);
}

.meta{
  font-size:12px;
  color:var(--muted);
  margin-bottom:6px;

  display:flex;
  gap:8px;
  align-items:center;
}

.meta img{
  width:18px;
  height:18px;
  border-radius:999px;
}

.bubble img.msgImg{
  max-width:100%;
  display:block;
  border-radius:12px;
  border:1px solid var(--line);
}

/* Composer fijo */
.composerFull{
  position:sticky;
  bottom:0;
  z-index:10;

  display:flex;
  gap:10px;
  align-items:center;

  padding:10px 10px;
  background:rgba(11,12,16,.92);
  backdrop-filter: blur(10px);

  border-top:1px solid var(--line);
}

.msgInput{
  flex:1;
  min-width:0;
  background:#0b0c10;
  color:var(--txt);
  border:1px solid #2a2a2a;
  border-radius:14px;
  padding:12px 12px;
  outline:none;
}

.msgInput:focus{
  border-color: rgba(42,44,255,.6);
}

.fileBtn{
  width:42px;
  height:42px;
  display:grid;
  place-items:center;

  background:transparent;
  border:1px solid #2a2a2a;
  border-radius:14px;
  cursor:pointer;
  user-select:none;
}

.sendBtn{
  padding:12px 14px;
  border-radius:14px;
  border:0;
  background:var(--accent);
  color:white;
  font-weight:700;
  cursor:pointer;
}

.sendBtn:disabled{
  opacity:.55;
  cursor:not-allowed;
}

/* Buttons */
.iconBtn{
  width:42px;
  height:42px;
  border-radius:14px;
  border:1px solid #2a2a2a;
  background:transparent;
  color:var(--txt);
  cursor:pointer;
}

.primaryBtn{
  padding:10px 12px;
  border-radius:14px;
  border:0;
  background:var(--accent);
  color:white;
  font-weight:700;
  cursor:pointer;
}

.ghostBtn{
  padding:10px 12px;
  border-radius:14px;
  border:1px solid #2a2a2a;
  background:transparent;
  color:var(--txt);
  cursor:pointer;
}

.w100{ width:100%; }

/* ---------- Sheet / Drawer ---------- */
.sheet{
  position:fixed;
  inset:0;
  z-index:50;
  display:flex;
  align-items:flex-end; /* desde abajo en mobile */
  justify-content:center;
}

.sheetBackdrop{
  position:absolute;
  inset:0;
  background: rgba(0,0,0,.55);
}

.sheetCard{
  position:relative;
  width:100%;
  max-width:520px;

  background:var(--card);
  border:1px solid var(--line);
  border-radius:18px 18px 0 0;

  box-shadow: 0 -18px 60px rgba(0,0,0,.45);

  padding:12px;
}

.sheetTop{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding-bottom:10px;
  border-bottom:1px solid var(--line);
}

.sheetTitle{
  font-weight:800;
  font-size:16px;
}

.sheetBody{
  padding-top:12px;
  display:flex;
  flex-direction:column;
  gap:12px;
}

.sheetBlock{
  border:1px solid var(--line);
  border-radius:16px;
  padding:12px;
  background:#0b0c10;
}

.label{
  font-size:12px;
  color:var(--muted);
  margin-bottom:8px;
}

.row{
  display:flex;
  gap:10px;
  align-items:center;
}

.sheetBlock input{
  flex:1;
  min-width:0;
  background:#0b0c10;
  color:var(--txt);
  border:1px solid #2a2a2a;
  border-radius:14px;
  padding:12px 12px;
}

.hint{
  margin:10px 0 0;
  font-size:13px;
  color:var(--muted);
  line-height:1.35;
}

.userBoxSheet{
  display:flex;
  gap:10px;
  align-items:center;

  border:1px solid var(--line);
  border-radius:16px;
  padding:10px;
  background:#0b0c10;
}

.userBoxSheet img{
  width:34px;
  height:34px;
  border-radius:999px;
}

.userText{ display:flex; flex-direction:column; gap:2px; }
.userName{ font-weight:700; }
.muted{ font-size:12px; color:var(--muted); }

/* ---------- Desktop enhancement ---------- */
@media (min-width: 900px){
  /* en desktop, el sheet aparece como panel lateral */
  .sheet{
    position:static;
    inset:auto;
    z-index:auto;

    display:flex !important;
    align-items:stretch;
    justify-content:flex-start;

    width:360px;
    border-left:1px solid var(--line);
    background:transparent;
  }

  .sheetBackdrop{ display:none; }

  .sheetCard{
    width:360px;
    max-width:none;
    border-radius:0;
    height:100vh;
    box-shadow:none;
  }

  /* el botón hamburguesa no hace falta en desktop */
  #btnOpenChats{ display:none; }
  /* el sheet nunca hidden en desktop si querés, pero lo dejamos como está:
     si está hidden por JS, igual se oculta. Si querés que siempre esté, te digo cómo. */
}
