/* Telegram-like chat styles for .chat / .message */

.chat {
  background-color: #e6ebee; /* classic Telegram light bg */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400' viewBox='0 0 400 400'%3E%3Cdefs%3E%3Cstyle%3E.a%7Bfill:none;stroke:%23000;stroke-width:1.2;opacity:0.06%7D.b%7Bfill:none;stroke:%23000;stroke-width:1;opacity:0.05%7D%3C/style%3E%3C/defs%3E%3Cg transform='translate(50,40) rotate(-10)'%3E%3Ccircle class='a' cx='0' cy='0' r='18'/%3E%3Ccircle class='a' cx='-6' cy='-5' r='3'/%3E%3Ccircle class='a' cx='6' cy='-5' r='3'/%3E%3Cpath class='a' d='M-9 5 Q0 14 9 5'/%3E%3C/g%3E%3Cg transform='translate(300,60) rotate(20) scale(0.8)'%3E%3Cpath class='b' d='M0-14 l4 10 10 0 -8 6 3 10 -9-7 -9 7 3-10 -8-6 10 0z'/%3E%3C/g%3E%3Cg transform='translate(180,180) rotate(15)'%3E%3Cpath class='a' d='M0-10 C0-16 10-20 15-12 C20-20 30-16 30-10 C30 5 15 18 15 18 C15 18 0 5 0-10'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 400px 400px;
  background-attachment: local;
  padding: 12px 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14.5px;
  line-height: 1.4;
  color: #000;
}

.message {
  background: #ffffff !important;
  color: #000 !important;
  border-radius: 12px 12px 12px 4px !important;
  padding: 8px 12px 8px 12px !important;
  margin: 4px 12px 4px 8px !important;
  max-width: 75% !important;
  width: fit-content;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08) !important;
  position: relative;
  align-self: flex-start;
  font-weight: 400;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.message::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: -6px;
  width: 0;
  height: 0;
  border: 6px solid transparent;
  border-right-color: #ffffff;
  border-bottom-color: #ffffff;
  border-bottom-width: 0;
  border-left-width: 0;
}

.message.self {
  background: #eeffde !important; /* Telegram outgoing green */
  color: #000 !important;
  border-radius: 12px 12px 4px 12px !important;
  margin: 4px 8px 4px auto !important;
  align-self: flex-end;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06) !important;
}

.message.self::before {
  left: auto;
  right: -6px;
  border-right-color: transparent;
  border-left-color: #eeffde;
  border-bottom-color: #eeffde;
  border-bottom-width: 0;
  border-right-width: 0;
}

/* Timestamp / username styling (since they are inside the message text) */
.message font:first-of-type,
.message > font:first-child {
  display: block;
  font-size: 11.5px;
  color: #707579;
  margin-bottom: 2px;
  font-weight: 500;
}

/* Night theme overrides (already partially present) */
body.telegram-night-theme .chat {
  background-color: #0e1621 !important;
  background-image: none;
}

body.telegram-night-theme .message {
  background: #182533 !important;
  color: #fff !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3) !important;
}

body.telegram-night-theme .message::before {
  border-right-color: #182533;
  border-bottom-color: #182533;
}

body.telegram-night-theme .message.self {
  background: #2b5278 !important;
  color: #fff !important;
}

body.telegram-night-theme .message.self::before {
  border-left-color: #2b5278;
  border-bottom-color: #2b5278;
}

/* Answer buttons more Telegram-like */
.answerbtns {
  padding: 8px 12px;
  margin-top: 12px;
  gap: 8px;
  justify-content: flex-start;
}

.answerbtns a {
  background: #ffffff;
  border: 1px solid #e0e0e0 !important;
  border-radius: 18px;
  padding: 6px 14px !important;
  font-weight: 500 !important;
  font-size: 13.5px;
  color: #3390ec;
  text-decoration: none;
  transition: background 0.15s;
}

.answerbtns a:hover {
  background: #f0f2f5;
}

body.telegram-night-theme .answerbtns a {
  background: #2b5278 !important;
  border-color: #2b5278 !important;
  color: #fff !important;
}
