/* BASE */
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #000;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui,
    sans-serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

@supports (-webkit-touch-callout: none) {
  main.chat-scroll {
    overscroll-behavior: none;
    contain: size layout style;
  }
}


/* HEADER FISSO IN ALTO */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 6px;
  background: #000;
  border-bottom: 1px solid #151515;
  z-index: 10;
}

.app-title {
  font-size: 17px;
  font-weight: 600;
}

/* AREA SCROLLABILE: TRA HEADER E BARRA INPUT */
.chat-scroll {
  height: auto;
  min-height: 0;
  position: absolute;
  top: 52px; /* altezza header */
  left: 0;
  right: 0;
    padding: 12px 12px 12px 12px;
  box-sizing: border-box;
  overflow-y: auto;
}

/* CONTENUTO CHAT */
.chat-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* RIGHE MESSAGGI */
.row {
  display: flex;
}

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

.row.bot {
  justify-content: flex-start;
}

/* BOLLE */
.msg {
  max-width: 74%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.35;
  word-wrap: break-word;
}

.msg.bot {
  background: #222;
  color: #fff;
  border-bottom-left-radius: 4px;
}

.msg.user {
  background: #ff9f0a;
  color: #000;
  border-bottom-right-radius: 4px;
}

/* BARRA INPUT FISSA IN BASSO */
.input-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 8px 10px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  background: #000;
  border-top: 1px solid #151515;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 20;
}

.input-bar input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 999px;
  border: none;
  outline: none;
  background: #111;
  color: #fff;
  font-size: 16px;
}

.input-bar input::placeholder {
  color: #666;
}

.input-bar button {
  padding: 10px 18px;
  border-radius: 999px;
  border: none;
  background: #ff9f0a;
  color: #000;
  font-weight: 600;
  font-size: 16px;
}

/* PWA: leggermente più alta per i gesti di sistema */
body.pwa-mode .input-bar {
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
}
