/* =========================
   PAGE ROOT
========================= */
.page-chat {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(120deg, #ffffff, #ffffff);
}

.page-chat * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

/* =========================
   MAIN CONTAINER
========================= */
.page-chat .app {
  width: 100vw;
  height: 100vh;
  display: flex;
  background: transparent;
  overflow: hidden;
}

/* =========================
   WRAPPER
========================= */
.page-chat .sidebar-wrap {
  padding: 13px;
  height: 100vh;
  box-sizing: border-box;
  background: #f5f7fb;
}

/* =========================
   SIDEBAR CARD
========================= */
.page-chat .sidebar {
  width: 240px;
  height: 100%;
  background: linear-gradient(180deg, #0a0f3c, #050826);
  color: white;
  padding: 18px;
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

/* =========================
   BRAND
========================= */
.page-chat .brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  margin-bottom: 20px;
}

.page-chat .brand-name {
  font-size: 13px;
  font-weight: 600;
  opacity: 0.9;
}

.page-chat .brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  object-fit: cover;
}

/* =========================
   MENU
========================= */
.page-chat .menu {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.page-chat .menu li {
  list-style: none;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  transition: all 0.25s ease;
  color: rgba(255, 255, 255, 0.75);
}

.page-chat .menu li:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  transform: translateX(3px);
}

.page-chat .menu li.active {
  background: linear-gradient(135deg, #00c6ff, #0072ff);
  color: #fff;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 114, 255, 0.4);
}

/* =========================
   PRO CARD
========================= */
.page-chat .procard {
  background: rgba(255, 255, 255, 0.05);
  padding: 14px;
  border-radius: 14px;
  font-size: 12px;
  backdrop-filter: blur(6px);
}

.page-chat .procard b {
  display: block;
  margin-bottom: 4px;
}

.page-chat .procard p {
  opacity: 0.7;
  margin-bottom: 10px;
}

.page-chat .procard button {
  width: 100%;
  border: none;
  background: linear-gradient(135deg, #7c5cff, #5a3fff);
  color: white;
  padding: 8px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  transition: 0.25s;
}

.page-chat .procard button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(124, 92, 255, 0.4);
}

/* =========================
   CONTACT LIST
========================= */
.page-chat .contacts {
  padding: 3px;
  width: 320px;
  border-right: 1px solid #eee;
  display: flex;
  flex-direction: column;
}

.page-chat .tabs {
  display: flex;
  gap: 10px;
  padding: 20px;
}

.page-chat .tab {
  padding: 8px 14px;
  border-radius: 20px;
  background: #f3f3f3;
  font-size: 13px;
  cursor: pointer;
}

.page-chat .tab.active {
  background: #111;
  color: white;
}

.page-chat .search {
  padding: 10px 20px;
}

.page-chat .search input {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #eee;
}

.page-chat .contactlist {
  flex: 1;
  overflow: auto;
}

.page-chat .contact {
  display: flex;
  gap: 12px;
  padding: 15px 20px;
  align-items: flex-start;
  cursor: pointer;
}

.page-chat .contact:hover {
  background: #f7f7f7;
}

.page-chat .contact img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.page-chat .contact .span {
  font-size: 10px !important;
  color: #7c5cff;
}

.page-chat .contact .top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.page-chat .contact .msg {
  font-size: 12px;
  color: #888;
}

.page-chat .contact .time {
  font-size: 11px;
  color: #aaa;
  white-space: nowrap;
  margin-left: 10px;
}

/* =========================
   CHAT AREA
========================= */
.page-chat .chat {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.page-chat .chatheader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #eee;
}

.page-chat .messages {
  flex: 1;
  padding: 20px;
  overflow: auto;
  background: #fafafa;
  display: flex;
  flex-direction: column;
}

/* =========================
   MESSAGES
========================= */
.page-chat .message {
  display: flex;
  margin: 6px 0;
}

.page-chat .message.sent {
  justify-content: flex-end;
}

.page-chat .message.received {
  justify-content: flex-start;
}

.page-chat .bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  max-width: 60%;
  line-height: 1.4;
  position: relative;
  word-break: break-word;
}

.page-chat .received .bubble {
  background: #f1f1f1;
  color: #222;
  border-bottom-left-radius: 4px;
}

.page-chat .sent .bubble {
  background: #7c5cff;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.page-chat .time {
  display: block;
  font-size: 10px !important;
  margin-top: 1px;
  opacity: 0.6;
  text-align: right;
}

.page-chat .bubble:hover {
  transform: scale(1.01);
  transition: 0.2s;
}

/* =========================
   INPUT
========================= */
.page-chat .chatinput {
  padding: 15px 20px;
  border-top: 1px solid #eee;
  display: flex;
  gap: 10px;
}

.page-chat .chatinput input {
  flex: 1;
  padding: 12px;
  border-radius: 20px;
  border: 1px solid #ddd;
}

.page-chat .chatinput button {
  background: #7c5cff;
  border: none;
  color: white;
  padding: 10px 16px;
  border-radius: 50%;
  cursor: pointer;
}

/* =========================
   INFO PANEL
========================= */
.page-chat .info {
  width: 280px;
  border-left: 1px solid #eee;
  padding: 20px;
}

.page-chat .profile {
  text-align: center;
}

.page-chat .profile img {
  width: 70px;
  border-radius: 50%;
  margin-bottom: 10px;
}

.page-chat .card {
  background: #f8f8f8;
  padding: 12px;
  border-radius: 10px;
  margin-top: 15px;
  font-size: 13px;
}

/* =========================
   EMPTY / CONTACT STATES
========================= */
.page-chat .contact-text {
  flex: 1;
}

.page-chat .contact-empty {
  padding: 22px 16px;
  text-align: center;
  border: 1px dashed #2f2f2f;
  border-radius: 18px;
  background: #111;
  color: #ddd;
}

.page-chat .contact-empty img {
  width: 86px;
  height: 86px;
  object-fit: contain;
  margin-bottom: 14px;
}

.page-chat .contact-empty h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.page-chat .contact-empty p {
  margin: 0 0 16px;
  color: #999;
  font-size: 13px;
  line-height: 1.5;
}

.page-chat .start-chat-btn {
  border: 0;
  background: #fff;
  color: #111;
  padding: 12px 16px;
  border-radius: 14px;
  font-weight: 700;
  width: 100%;
  cursor: pointer;
}

/* =========================
   BOTTOM SHEET
========================= */
.page-chat .sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: 0.22s ease;
  z-index: 9998;
}

.page-chat .sheet-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.page-chat .start-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  transform: translateY(110%);
  transition: transform 0.25s ease;
  z-index: 9999;
  background: #101010;
  border-top: 1px solid #2b2b2b;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -20px 45px rgba(0, 0, 0, 0.45);
  max-height: 72vh;
  display: flex;
  flex-direction: column;
}

.page-chat .start-sheet.open {
  transform: translateY(0);
}

.page-chat .sheet-top {
  width: 56px;
  height: 5px;
  border-radius: 999px;
  background: #3a3a3a;
  margin: 10px auto 6px;
}

.page-chat .sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 16px 14px;
  border-bottom: 1px solid #232323;
}

.page-chat .sheet-head b {
  font-size: 16px;
  display: block;
  color: #fff;
}

.page-chat .sheet-head p {
  margin: 4px 0 0;
  font-size: 12px;
  color: #9a9a9a;
}

.page-chat .sheet-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 12px;
  background: #1f1f1f;
  color: #fff;
  cursor: pointer;
}

.page-chat .sheet-users {
  padding: 12px 16px 18px;
  overflow-y: auto;
  display: grid;
  gap: 10px;
}

.page-chat .sheet-user {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #171717;
  border: 1px solid #2a2a2a;
  border-radius: 16px;
  padding: 12px;
}

.page-chat .sheet-user img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}

.page-chat .sheet-user .meta {
  flex: 1;
  min-width: 0;
}

.page-chat .sheet-user .meta b {
  display: block;
  color: #fff;
  font-size: 14px;
  margin-bottom: 3px;
}

.page-chat .sheet-user .meta span {
  color: #9b9b9b;
  font-size: 12px;
}

.page-chat .sheet-user button {
  border: 0;
  background: #fff;
  color: #111;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

/* =========================
   CONTACTS BOTTOM TIME
========================= */
.page-chat .contacts-time {
  position: absolute;
  bottom: 10px;
  right: 15px;
  font-size: 12px;
  color: #999;
  background: rgba(255, 255, 255, 0.8);
  padding: 5px 10px;
  border-radius: 10px;
  backdrop-filter: blur(5px);
}

/* =========================
   SUGGESTIONS
========================= */
.page-chat .suggestions {
  display: flex;
  gap: 8px;
  padding: 10px 20px;
  flex-wrap: wrap;
  border-top: 1px solid #eee;
  background: #fff;
}

.page-chat .suggestion {
  background: #f1f1f1;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: 0.2s;
}

.page-chat .suggestion:hover {
  background: #7c5cff;
  color: #fff;
}

/* =========================
   EMPTY / LOADING
========================= */
.page-chat .empty-state {
  text-align: center;
  margin-top: 80px;
  color: #777;
}

.page-chat .quick-actions {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  justify-content: center;
}

.page-chat .quick-actions button {
  border: none;
  background: #7c5cff;
  color: #fff;
  padding: 8px 14px;
  border-radius: 20px;
  cursor: pointer;
}

.page-chat .empty {
  text-align: center;
  padding: 40px 20px;
  color: #aaa;
}

.page-chat .empty b {
  display: block;
  color: #fff;
  margin-bottom: 6px;
}

.page-chat .empty button {
  margin-top: 10px;
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  background: #5865f2;
  color: #fff;
  cursor: pointer;
}

.page-chat .loading {
  padding: 20px;
  text-align: center;
  color: #888;
  font-size: 13px;
}

/* =========================
   BADGE / AVATARS
========================= */
.page-chat .badge {
  background: #ff3b30;
  color: #fff;
  font-size: 10px;
  padding: 4px 7px;
  border-radius: 20px;
  font-weight: 600;
  min-width: 18px;
  text-align: center;
}

.page-chat .chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-chat .chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.page-chat .msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.page-chat .sender-name {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 4px;
  opacity: 0.7;
}

/* =========================
   MOBILE NAVBAR
========================= */
.page-chat .mobile-nav {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 92%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(16px);
  border-radius: 22px;
  padding: 10px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  z-index: 999;
  transition: 0.3s ease;
}

.page-chat .mobile-nav.hide {
  transform: translateX(-50%) translateY(120%);
  opacity: 0;
}

.page-chat .nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 10px;
  color: #666;
  cursor: pointer;
  transition: 0.2s;
}

.page-chat .nav-item img {
  width: 22px;
  height: 22px;
  margin-bottom: 2px;
  opacity: 0.7;
}

.page-chat .nav-item.active {
  color: #7c5cff;
}

.page-chat .nav-item.active img {
  opacity: 1;
  transform: scale(1.1);
}

/* =========================
   BACK ICON
========================= */
.page-chat .back-icon {
  width: 20px;
  height: 20px;
}

/* =========================
   FLASH STATE
========================= */
.page-chat .contact.flash {
  background: rgba(0, 150, 255, 0.12);
  transition: background 0.8s ease;
}

/* =========================
   MOBILE ONLY
========================= */
@media (max-width: 768px) {
  .page-chat {
    background: #fff;
  }

  .page-chat .sidebar,
  .page-chat .sidebar-wrap {
    display: none;
  }

  .page-chat .contacts {
    width: 100%;
    height: 100%;
  }

  .page-chat .chat {
    position: fixed;
    top: 0;
    left: 100%;
    width: 100%;
    height: 100%;
    background: #fff;
    transition: 0.3s;
    z-index: 10;
  }

  .page-chat .chat.open {
    left: 0;
  }

  .page-chat .back-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 30px;
    background: #f3f3f3;
    font-size: 28px;
    cursor: pointer;
    transition: 0.2s;
  }

  .page-chat .back-btn:hover {
    background: #eaeaea;
  }

  .page-chat .chatheader {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .page-chat .messages {
    padding: 15px;
  }
}

@media (min-width: 768px) {
  .page-chat .mobile-nav {
    display: none;
  }
}