* {
  font-family: "Inter", "Segoe UI", sans-serif;
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background: #0a0a0f;
  height: 100vh;
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(
    ellipse at 20% 50%,
    rgba(168, 85, 247, 0.03) 0%,
    transparent 55%
  );
  pointer-events: none;
  z-index: 0;
}

/* ── NAVBAR ─────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  border-radius: 0 0 20px 20px;
  justify-content: space-between;
  background: rgba(10, 10, 20, 0.65);
  backdrop-filter: blur(16px);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.6);
  padding: 12px 28px;
  animation: fadeSlideDown 0.8s ease;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 50px;
  height: 50px;
  flex-shrink: 0;
  border-radius: 6px;
  object-fit: contain;
}

.navbar-brand span {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.6px;
  color: rgba(255, 255, 255, 0.92);
  text-transform: uppercase;
}

.navbar-actions {
  display: flex;
  gap: 8px;
}

.nav-btn {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.65);
  transition:
    background 0.25s,
    color 0.25s,
    transform 0.2s;
}

.nav-btn svg {
  width: 17px;
  height: 17px;
}

.nav-btn:hover {
  background: rgba(168, 85, 247, 0.22);
  color: white;
  transform: scale(1.07);
}

/* ── KEYFRAMES ─────────────────────────────── */
@keyframes fadeSlideDown {
  from {
    opacity: 0;
    transform: translateY(-40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── APP LAYOUT ─────────────────────────────── */
.app-layout {
  position: fixed;
  inset: 0;
  top: 74px;
  display: grid;
  grid-template-columns: 300px 1fr;
  z-index: 1;
}

/* ── SIDEBAR ─────────────────────────────────── */
.sidebar {
  background: rgba(10, 10, 20, 0.72);
  backdrop-filter: blur(16px);
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeSlideDown 0.8s ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 12px;
}

.sidebar-header h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: white;
}

/* Search bar */
.search-bar {
  margin: 0 14px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 8px 14px;
  transition: border-color 0.25s;
}

.search-bar:focus-within {
  border-color: rgba(168, 85, 247, 0.35);
}

.search-bar svg {
  width: 15px;
  height: 15px;
  color: rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
}

.search-bar input {
  background: none;
  border: none;
  outline: none;
  color: white;
  font-size: 0.85rem;
  width: 100%;
}

.search-bar input::placeholder {
  color: rgba(255, 255, 255, 0.28);
}

/* Conversation list */
.convo-list {
  list-style: none;
  padding: 0 8px;
  margin: 0;
  overflow-y: auto;
  flex: 1;
}

.convo-list::-webkit-scrollbar {
  width: 4px;
}
.convo-list::-webkit-scrollbar-track {
  background: transparent;
}
.convo-list::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, 0.3);
  border-radius: 2px;
}

.convo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.2s;
  border: 1px solid transparent;
}

.convo-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.convo-item.active {
  background: rgba(168, 85, 247, 0.13);
  border-color: rgba(168, 85, 247, 0.2);
}

.convo-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.convo-info {
  flex: 1;
  min-width: 0;
}

.convo-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 3px;
}

.convo-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: white;
}

.convo-time {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.35);
}

.convo-preview {
  font-size: 0.77rem;
  color: rgba(255, 255, 255, 0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

/* ── CHAT AREA ─────────────────────────────── */
.chat-area {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Chat header */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: rgba(10, 10, 20, 0.65);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  animation: fadeSlideDown 0.8s ease;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 700;
  color: white;
}

.chat-name {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  color: white;
}

.chat-status {
  display: block;
  font-size: 0.7rem;
  color: #4ade80;
}

.chat-header-actions {
  display: flex;
  gap: 6px;
}

/* Messages area */
.messages-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.messages-wrap::-webkit-scrollbar {
  width: 4px;
}
.messages-wrap::-webkit-scrollbar-track {
  background: transparent;
}
.messages-wrap::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, 0.3);
  border-radius: 2px;
}

/* Date divider */
.date-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8px 0 14px;
}

.date-divider span {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
  padding: 3px 14px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

/* Message bubbles */
.message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 68%;
  animation: fadeIn 0.3s ease;
}

.message.sent {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message.received {
  align-self: flex-start;
}

.msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.msg-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  max-width: 100%;
  position: relative;
}

.message.received .msg-bubble {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 4px;
}

.message.sent .msg-bubble {
  background: linear-gradient(135deg, #7b2ff7, #ec4899);
  border-bottom-right-radius: 4px;
}

.msg-bubble p {
  margin: 0 0 4px;
  font-size: 0.875rem;
  color: white;
  line-height: 1.45;
}

.msg-time {
  font-size: 0.63rem;
  color: rgba(255, 255, 255, 0.4);
  display: block;
  text-align: right;
}

.message.received .msg-time {
  text-align: left;
}

/* ── INPUT BAR ─────────────────────────────── */
.input-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px 16px;
  background: rgba(10, 10, 20, 0.88);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 20px 20px 0 0;
  animation: fadeSlideUp 0.8s ease;
}

.input-action-btn {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.5);
  transition:
    background 0.25s,
    color 0.25s,
    transform 0.2s;
  flex-shrink: 0;
}

.input-action-btn svg {
  width: 17px;
  height: 17px;
}

.input-action-btn:hover {
  background: rgba(168, 85, 247, 0.22);
  color: white;
  transform: scale(1.07);
}

.input-field-wrap {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 22px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  transition:
    border-color 0.25s,
    background 0.25s;
}

.input-field-wrap:focus-within {
  border-color: rgba(168, 85, 247, 0.4);
  background: rgba(168, 85, 247, 0.05);
}

.input-field-wrap input {
  background: none;
  border: none;
  outline: none;
  color: white;
  font-size: 0.9rem;
  width: 100%;
  padding: 10px 0;
}

.input-field-wrap input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.send-btn {
  background: linear-gradient(135deg, #a855f7, #ec4899);
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  transition:
    transform 0.2s,
    opacity 0.2s;
  flex-shrink: 0;
}

.send-btn svg {
  width: 18px;
  height: 18px;
}

.send-btn:hover {
  transform: scale(1.1);
  opacity: 0.9;
}

/* ── RESPONSIVE ──────────────────────────────── */
@media (max-width: 768px) {
  .navbar {
    padding: 8px 16px;
  }

  .navbar-brand span {
    font-size: 1rem;
  }

  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .input-bar {
    padding: 10px 14px 14px;
  }
}

@media (max-width: 480px) {
  .navbar-brand span {
    font-size: 0.9rem;
  }

  .brand-icon {
    width: 36px;
    height: 36px;
  }

  .messages-wrap {
    padding: 14px 14px;
  }

  .message {
    max-width: 85%;
  }
}
