/* Chat container */
#chat-box {
  background: rgba(var(--accent-rgb, 255, 255, 255), 0.05);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(var(--accent-rgb, 255, 255, 255), 0.1);
  border-radius: 16px;
  padding: 15px;
  height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.25);
}

/* Individual message wrapper */
.chat-message {
  display: flex;
  animation: fadeIn 0.4s ease forwards;
  transition: transform 0.2s ease, opacity 0.3s ease;
  width: 100%;
}

/* Glass message bubble */
.message-bubble {
  background: rgba(var(--accent-rgb, 255, 255, 255), 0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(var(--accent-rgb, 255, 255, 255), 0.2);
  border-radius: 10px;
  padding: 10px 14px;
  max-width: 75%;
  color: var(--text, #fff);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
} 

/* Header inside each bubble: username + time */
.message-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.8rem;
  margin-bottom: 5px;
}

.message-header strong {
  font-weight: 600;
  color: var(--text, #fff);
}

.message-time {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-left: 10px;
}

/* Text content */
.message-text {
  font-size: 0.95rem;
  line-height: 1.3;
  word-wrap: break-word;
}

/* Fade-in animation */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Scrollbar styling */
#chat-box::-webkit-scrollbar {
  width: 6px;
}
#chat-box::-webkit-scrollbar-thumb {
  background: rgba(var(--accent-rgb, 255, 255, 255), 0.25);
  border-radius: 3px;
}
#chat-box::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--accent-rgb, 255, 255, 255), 0.45);
}

/* Chat input area */
.chat-input-area {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.chat-input-area input,
.chat-input-area textarea {
  flex: 1;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  padding: 10px;
  background: rgba(255,255,255,0.05);
  color: var(--text, #fff);
  resize: none;
}

.chat-input-area textarea {
  min-height: 40px;
}

.chat-input-area button {
  padding: 10px 20px;
  border-radius: 12px;
  border: none;
  background: var(--accent-1, #64d2ff);
  color: #041627;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.chat-input-area button:hover {
  transform: scale(1.05);
}

h1 {
  text-align: center;
  margin-bottom: 20px; /* optional spacing below the title */
  color: var(--text, #fff); /* ensures it adapts to your theme text color */
  font-size: 2rem; /* adjust size as needed */
}

/* ==============================
   Message image handling
   ============================== */
.message-text img {
  max-width: 200px;        /* limit how wide the image can be */
  max-height: 200px;       /* limit how tall the image can be */
  border-radius: 8px;      /* rounded corners for a clean look */
  object-fit: cover;       /* crop large images neatly */
  margin-top: 6px;
  display: block;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

/* Hover effect for clarity */
.message-text img:hover {
  transform: scale(1.05);
  box-shadow: 0 0 12px rgba(var(--accent-rgb, 255, 255, 255), 0.4);
}

/* Optional: Make image layout responsive on small screens */
@media (max-width: 600px) {
  .message-text img {
    max-width: 150px;
    max-height: 150px;
  }
}

/* ==============================
   Image Preview Overlay
   ============================== */
.image-preview-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 15, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  cursor: zoom-out;
  animation: fadeInOverlay 0.25s ease forwards;
}

.image-preview-overlay img {
  max-width: 85%;
  max-height: 85%;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(var(--accent-rgb, 255, 255, 255), 0.4);
  transform: scale(0.95);
  animation: popIn 0.25s ease forwards;
}


@keyframes popIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Animations */
@keyframes fadeInOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}
