* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: Inter, system-ui, sans-serif;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: #f3f0ff;
}

/* Topbar */
#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: #6a1b9a;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  font-size: 0.95rem;
  z-index: 2000;
}

#topbar button {
  background: transparent;
  border: 1px solid white;
  color: white;
  border-radius: 0.5rem;
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border 0.2s;
}

#topbar button:hover {
  background: rgba(255,255,255,0.2);
}

/* Chat box */
#chat-box {
  position: fixed;
  top: 40px;
  left: 0;
  right: 0;
  bottom: 90px;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.message {
  max-width: 75%;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.user {
  align-self: flex-end;
  background: #7b3ff3;
  color: #fff;
}

.ai {
  align-self: flex-start;
  background: #f5e1ff;
  color: #2d004d;
}

/* Chat form */
#chat-form {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  background: #fff;
  border-top: 2px solid #7b3ff3;
  z-index: 1000;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  min-height: 70px;
}

#user-input {
  flex: 1;
  padding: 1rem;
  border: 1px solid #bfb0ff;
  border-radius: 1rem;
  outline: none;
  font-size: 1rem;
  text-align: left;
}

/* Przyciski formularza – spójne ze stylem topbaru */
#chat-form button {
  background: transparent;
  border: 1px solid #7b3ff3;
  color: #7b3ff3;
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border 0.2s;
}

#chat-form button:hover {
  background: rgba(123,63,243,0.1);
}

/* Dodatkowe dostosowanie body, żeby topbar nie nachodził na chat */
body {
  padding-top: 40px;
}

@media(max-width:600px){
  .message {
    max-width: 90%;
    font-size: 1rem;
  }
  #user-input {
    padding: 1.2rem;
    font-size: 1rem;
  }
  #chat-form button {
    padding: 1.2rem;
    font-size: 1rem;
  }
}
