/* MAIN PANEL */
#mainPanel {
  flex: 1;
  min-width: 0;
  padding: 20px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* CHAT LOG */
#chatLog {
  background: var(--panel);
  border-radius: 10px;
  padding: 15px;
  overflow-y: auto;
  border: 1px solid var(--border);
  margin-bottom: 15px;
  flex: 1;
  height: auto;
  min-height: 0;
}

/* TEXTAREA */
#chatMsg {
  width: 100%;
  height: 80px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 10px;
  font-size: 1rem;
  resize: none;
  outline: none;
}

/* BUTTON */
button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: 0.15s;
}

button:hover {
  background: var(--accent-hover);
}

/* INPUTS */
input {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  margin-bottom: 10px;
  margin-top: 8px;
  outline: none;
}

/* CONFIRM POPUP */
#confirmOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

#confirmBox {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 25px;
  border-radius: 12px;
  width: 320px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* QR CODE */
#qrcode {
  width: 200px;
  height: 200px;
  border-radius: 8px;
  padding: 2px;
  background: white;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease;
  cursor: pointer;
}

#qrcode:hover {
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.25);
}

@media (prefers-color-scheme: dark) {
  #qrcode:hover {
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.25);
  }
}

#qrcode.expanded {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(2.5);
  z-index: 9999;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.4);
}

/* CHAT MESSAGES */
#chatMessages {
  flex: 1;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  min-height: 0;
}

#chatInput {
  flex: 1;
  margin-top: 0px;
  margin-bottom: 0px;
}

/* MESSAGE WRAPPER */
.msg {
  display: flex;
  flex-direction: column;
  max-width: 70%;
}

.msg.me {
  align-self: flex-end;
  text-align: right;
}

.msg.them {
  align-self: flex-start;
  text-align: left;
}

.bubble {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
  max-width: 100%;
}

.msg.me .bubble {
  background: var(--accent);
  color: white;
}

.msg.them .bubble {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text);
}

.time {
  font-size: 10px;
  opacity: 0.6;
  margin-top: 2px;
}

.systemMsg {
  text-align: center;
  font-size: 12px;
  opacity: 0.6;
  margin: 8px 0;
}

.chatImage {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
}

/* INPUT ROW */
#chatInputRow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* UNREAD */
.unread {
  background-color: rgba(255, 255, 255, 0.15) !important;
}

@keyframes unreadBlink {
  0% {
    background-color: rgba(255, 255, 255, 0.15);
  }
  50% {
    background-color: rgba(255, 255, 255, 0.35);
  }
  100% {
    background-color: rgba(255, 255, 255, 0.15);
  }
}

.unread.blink {
  animation: unreadBlink 0.8s ease-in-out 3;
}

/* TOOLBOX */

#chatHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#chatToolbox {
  display: flex;
  gap: 10px;
}

.toolBtn {
  cursor: pointer;
}
