@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600&display=swap');

:root {
  --primary-color: #0078d7;
  --secondary-color: #005fa3;
  --bg-overlay: rgba(255, 255, 255, 0.7);
  --chat-bg: rgba(255, 255, 255, 0.85);
  --user-msg-bg: #dce8ff;
  --ai-msg-bg: #ffffff;
  --text-color: #222;
  --muted-text: #666;
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
  --glass-border: 1px solid rgba(255, 255, 255, 0.18);
}

body {
  font-family: 'Outfit', sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  background-attachment: fixed;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  color: var(--text-color);
}

/* If a background image exists, we can use it with an overlay */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('assets/background_chatia.png') no-repeat center center fixed;
  background-size: cover;
  z-index: -1;
  opacity: 0.6;
}

.wrap {
  width: 95%;
  max-width: 900px;
  height: 95vh;
  display: flex;
  flex-direction: column;
  padding: 2.5vh 0;
}

header {
  background: var(--bg-overlay);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 15px 25px;
  box-shadow: var(--glass-shadow);
  border: var(--glass-border);
  border-radius: 20px;
  margin-bottom: 20px;
  animation: fadeInDown 0.8s ease-out;
}

header h1 {
  font-size: 1.8em;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 15px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.version-badge {
  font-size: 0.45em;
  background: rgba(0, 0, 0, 0.1);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 400;
  margin-left: 8px;
}

#server {
  font-size: 0.95em;
  color: var(--muted-text);
  margin-top: 8px;
  line-height: 1.4;
}

#chat {
  flex: 1;
  background: var(--chat-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 24px;
  box-shadow: var(--glass-shadow);
  border: var(--glass-border);
  padding: 25px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.1) transparent;
}

#chat::-webkit-scrollbar {
  width: 6px;
}

#chat::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}

.msg {
  max-width: 80%;
  padding: 14px 18px;
  border-radius: 20px;
  font-size: 1.05em;
  line-height: 1.5;
  position: relative;
  animation: messageSlide 0.4s ease-out;
}

.user {
  background: var(--primary-color);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 15px rgba(0, 120, 215, 0.2);
}

.ai {
  background: var(--ai-msg-bg);
  color: var(--text-color);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.03);
}

.typing-indicator {
  font-style: italic;
  font-size: 0.9em;
  color: var(--muted-text);
  padding: 10px;
  display: none;
}

#inputBox {
  display: flex;
  margin-top: 20px;
  gap: 12px;
  background: var(--bg-overlay);
  backdrop-filter: blur(12px);
  border-radius: 20px;
  padding: 10px;
  box-shadow: var(--glass-shadow);
  border: var(--glass-border);
}

#texto {
  flex: 1;
  padding: 12px 20px;
  border-radius: 15px;
  border: none;
  font-size: 1.05em;
  background: transparent;
  outline: none;
  font-family: inherit;
}

button {
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 15px;
  padding: 10px 25px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  justify-content: center;
}

button:hover {
  background: var(--secondary-color);
  transform: scale(1.05);
}

button:active {
  transform: scale(0.95);
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes messageSlide {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 600px) {
  .wrap {
    width: 100%;
    height: 100vh;
    padding: 0;
  }

  header,
  #chat,
  #inputBox {
    border-radius: 0;
    margin-bottom: 0;
  }

  .msg {
    max-width: 90%;
  }
}