body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #020617;
  color: white;
  height: 100vh;
  display: flex;
}

/* SIDEBAR */

#sidebar {
  width: 280px;
  background: #020617;
  border-right: 1px solid #1e293b;
  display: flex;
  flex-direction: column;
}

#logo {
  padding: 16px;
  font-size: 20px;
  font-weight: bold;
  border-bottom: 1px solid #1e293b;
}

.search-box {
  padding: 10px;
}

.search-user {
  padding: 8px;
  cursor: pointer;
  border-radius: 6px;
}

.search-user:hover {
  background: #0f172a;
}

/* MAIN */

#main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* MESSAGE */

.message-wrapper {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.message-wrapper.mine {
  flex-direction: row-reverse;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.message {
  background: #0f172a;
  padding: 10px 14px;
  border-radius: 14px;
  max-width: 420px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.03);
}

.message-wrapper.mine .message {
  background: #2563eb;
}

.message-name {
  font-size: 12px;
  opacity: 0.7;
  margin-bottom: 4px;
}

.message-image {
  max-width: 260px;
  border-radius: 12px;
  margin-top: 6px;
}

/* ================= AUDIO MESSAGE ================= */

.voice-message {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #e5e7eb;
  color: black;
  padding: 8px 12px;
  border-radius: 20px;
  min-width: 220px;
}

.message-wrapper.mine .voice-message {
  background: #dbeafe;
}

.voice-message audio {
  width: 220px;
  height: 32px;
  outline: none;
  background: transparent;
}

/* ================= MESSAGE BAR ================= */

#messageBar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid #1e293b;
  background: #020617;
}

/* INPUT */

textarea {
  flex: 1;
  resize: none;
  padding: 12px;
  border-radius: 12px;
  border: none;
  background: #020617;
  color: white;
  min-height: 44px;
  max-height: 140px;
  outline: none;
  font-size: 14px;
}

/* ================= BUTTONS ================= */

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(180deg,#0f172a,#020617);
  box-shadow:
    inset 0 0 0 1px #1e293b,
    0 2px 6px rgba(0,0,0,0.4);
  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;

  transition: 0.15s;
}

.icon-btn:hover {
  background: linear-gradient(180deg,#1e293b,#020617);
  transform: translateY(-1px);
}

.icon-btn:active {
  transform: scale(0.95);
}

.icon-btn img {
  width: 18px;
  height: 18px;
  pointer-events: none;
}

/* SEND BUTTON */

.send-btn {
  background: linear-gradient(180deg,#2563eb,#1d4ed8);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.08),
    0 2px 8px rgba(37,99,235,0.4);
}

.send-btn:hover {
  background: linear-gradient(180deg,#3b82f6,#2563eb);
}


/* ================= IMAGE PREVIEW ================= */

.preview-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #0f172a;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid #1e293b;
  margin-bottom: 6px;
}

.preview-box img {
  max-height: 50px;
  max-width: 80px;
  object-fit: cover;
  border-radius: 8px;
}

.preview-box span {
  cursor: pointer;
  color: #ff4d4d;
  font-size: 18px;
}


/* ================= RECORDING INDICATOR ================= */

.recording-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ef4444;
  font-size: 14px;
}

.record-dot {
  width: 10px;
  height: 10px;
  background: #ef4444;
  border-radius: 50%;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.3; }
  100% { opacity: 1; }
}
.msg-image {
  max-width: 260px;
  max-height: 260px;
  border-radius: 10px;
  margin-top: 6px;
  object-fit: cover;
}
.recording {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #0f172a;
  padding: 8px 14px;
  border-radius: 12px;
  color: #ff4d4d;
  font-weight: bold;
}

.rec-dot {
  width: 10px;
  height: 10px;
  background: red;
  border-radius: 50%;
  animation: blink 1s infinite;
}

@keyframes blink {
  0% { opacity: 1; }
  50% { opacity: 0.2; }
  100% { opacity: 1; }
}
/* ================= RECORDING OVERLAY ================= */

#recordingUI {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  z-index: 999;
}

.record-panel {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 14px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

.rec-left {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ef4444;
  font-weight: bold;
}

.rec-dot {
  width: 10px;
  height: 10px;
  background: #ef4444;
  border-radius: 50%;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.3); }
  100% { opacity: 1; transform: scale(1); }
}

#voiceWave {
  width: 160px;
  height: 40px;
}

.rec-hint {
  font-size: 12px;
  opacity: 0.6;
}

/* MIC RECORD ANIMATION */

.icon-btn.recording {
  background: #ef4444;
  animation: micPulse 1s infinite;
}

@keyframes micPulse {
  0% { box-shadow: 0 0 0 0 rgba(239,68,68,0.5); }
  70% { box-shadow: 0 0 0 10px rgba(239,68,68,0); }
  100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}
