/* =============================================
   Chat Page Layout
   ============================================= */
.chat-page {
  display: flex;
  height: calc(100vh - 60px); /* adjust based on your navbar height */
  /* background-color: #1a1f2e; */
  overflow: hidden;
  /* border-top: 1px solid #2e3444; */
}

  span {
    line-height: 16px;
  }
/* =============================================
   Sidebar
   ============================================= */
.chat-sidebar {
  width: 310px;
  min-width: 310px;
  /* background-color: #1e2433; */
  background-color: #2a2d34;
  border-right: 1px solid #444957;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-title {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  letter-spacing: 0.2px;
}

/* Search */
.chat-search-wrapper {
  position: relative;
  padding: 8px 12px 12px 12px;
}

.chat-search-icon {
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  color: #6b7280;
  font-size: 13px;
  pointer-events: none;
}

.chat-search-input {
  width: 100%;
  /* background-color: #252d3a; */
  border: 1px solid #2e3444;
  border-radius: 20px;
  padding: 8px 14px 8px 36px;
  font-size: 13px;
  color: #d1d5db;
  outline: none;
  transition: border-color 0.2s ease;
  font-family: inherit;
}

.chat-search-input::placeholder {
  color: #4b5563;
}

.chat-search-input:focus {
  border-color: #fbbf24;
  background-color: #2a3341;
}

/* Filter Tabs */
.chat-filter-tabs {
  display: flex;
  gap: 0;
  padding: 0 12px;
  border-bottom: 1px solid #444957;
  margin-bottom: 0;
}

.chat-filter-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: #6b7280;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: -1px;
  font-family: inherit;
}

.chat-filter-btn:hover {
  color: #d1d5db;
}

.chat-filter-btn.active {
  color: #fbbf24;
  border-bottom-color: #fbbf24;
  font-weight: 600;
}

/* Contact List */
.chat-contact-list {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #2e3444 transparent;
}

.chat-contact-list::-webkit-scrollbar {
  width: 4px;
}

.chat-contact-list::-webkit-scrollbar-track {
  background: transparent;
}

.chat-contact-list::-webkit-scrollbar-thumb {
  background-color: #2e3444;
  border-radius: 4px;
}

/* Contact Item */
.chat-contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  border-bottom: 1px solid #444957;
}

.chat-contact-item:hover {
  background-color: rgba(251, 191, 36, 0.04);
}

.chat-contact-item.active {
  background-color: rgba(251, 191, 36, 0.08);
  border-left: 2px solid #fbbf24;
  padding-left: 12px;
}

/* Avatar */
.chat-avatar-wrapper {
  position: relative;
  flex-shrink: 0;
}

.chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  text-transform: uppercase;
}

.chat-avatar-md {
  width: 38px;
  height: 38px;
  font-size: 12px;
}

.chat-avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 11px;
  flex-shrink: 0;
  align-self: flex-end;
  margin-bottom: 2px;
}

.chat-online-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 12px;
  height: 12px;
  background-color: #10b981;
  border-radius: 50%;
  border: 2px solid #1e2433;
}

/* Contact Info */
.chat-contact-info {
  flex: 1;
  min-width: 0;
}

.chat-contact-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}

.chat-contact-name {
  font-size: 13px;
  font-weight: 600;
  color: #e5e7eb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-verified-icon {
  color: #fbbf24;
  font-size: 11px;
  flex-shrink: 0;
}

.chat-contact-time {
  font-size: 11px;
  color: #6b7280;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 6px;
}

.chat-contact-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-contact-preview {
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.chat-unread-badge {
  background-color: #fbbf24;
  color: #000;
  font-size: 10px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 6px;
}

/* =============================================
   Main Chat Area
   ============================================= */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
    background-color: #2a2d34;
  /* background-color: #1a1f2e; */
  /* overflow: hidden; */
  position: relative;
}

/* Chat Header */
.chat-main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid #2e3444;
  /* background-color: #1e2433; */
  flex-shrink: 0;
}

.chat-main-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-main-header-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-main-header-name {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 5px;
}

.chat-main-header-status {
  font-size: 11px;
  color: #6b7280;
}

.chat-main-header-status.online {
  color: #10b981;
}

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

/* Icon Buttons */
.chat-icon-btn {
  background: none;
  border: none;
  color: #6b7280;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: all 0.2s ease;
}

.chat-icon-btn:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: #d1d5db;
}

/* Messages */
.chat-messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  scrollbar-width: thin;
  scrollbar-color: #2e3444 transparent;
  background-image: radial-gradient(circle at 20% 80%, rgba(251, 191, 36, 0.02) 0%, transparent 50%),
                    radial-gradient(circle at 80% 20%, rgba(16, 185, 129, 0.02) 0%, transparent 50%);
}

.chat-messages-area::-webkit-scrollbar {
  width: 4px;
}

.chat-messages-area::-webkit-scrollbar-thumb {
  background-color: #2e3444;
  border-radius: 4px;
}

.chat-messages-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
  /* max-width: 720px; */
  margin: 0 auto;
}

/* Message Row */
.chat-message-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  animation: msgIn 0.2s ease;
}

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

.chat-message-row.me {
  flex-direction: row-reverse;
}

.chat-bubble-wrapper {
  display: flex;
  flex-direction: column;
  max-width: 65%;
}

.chat-message-row.me .chat-bubble-wrapper {
  align-items: flex-end;
}

.chat-message-row.them .chat-bubble-wrapper {
  align-items: flex-start;
}

/* Bubble */
.chat-bubble {
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
}

.chat-bubble-them {
  /* background-color: #252d3a; */
  background-color: #1d1e24;
  color: #e5e7eb;
  border-bottom-left-radius: 3px;
}

.chat-bubble-me {
  /* background-color: #f59e0b; */
  background-color: #6c757d;
  color: #fff;
  border-bottom-right-radius: 3px;
}

.chat-msg-time {
  font-size: 10px;
  color: #a1a2a3f7;
  margin-top: 3px;
  padding: 0 2px;
}

/* Input Area */
.chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid #2e3444;
  background-color: #1e2433;
  flex-shrink: 0;
}

.chat-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  /* background-color: #252d3a; */
  background-color: #1d1e24;
  border: 1px solid #57585b;
  border-radius: 24px;
  padding: 4px 6px 4px 10px;
  transition: border-color 0.2s ease;
}

.chat-input-row:focus-within {
  border-color: #fbbf24;
}

.chat-attach-btn {
  transform: rotate(45deg);
}

.chat-text-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: #e5e7eb;
  font-size: 13.5px;
  padding: 6px 4px;
  font-family: inherit;
}

.chat-text-input::placeholder {
  color: #4b5563;
}

.chat-send-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background-color: #374151;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.chat-send-btn.active {
  background-color: #fbbf24;
  color: #000;
  transform: scale(1.05);
}

.chat-send-btn.active:hover {
  background-color: #f59e0b;
}

/* Empty State */
.chat-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #4b5563;
}

.chat-empty-icon {
  position: relative;
  margin-bottom: 8px;
}

.chat-empty-icon > i {
  font-size: 52px;
  color: #374151;
}

.chat-empty-smile {
  position: absolute;
  bottom: -4px;
  right: -8px;
  font-size: 22px;
  color: #fbbf24;
}

.chat-empty-title {
  font-size: 15px;
  color: #9ca3af;
  font-weight: 500;
  margin: 0;
}

.chat-empty-sub {
  font-size: 13px;
  color: #4b5563;
  margin: 0;
}

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 768px) {
  .chat-sidebar {
    width: 100%;
    min-width: unset;
  }

  .chat-page {
    flex-direction: column;
  }

}

/* ===========================================  */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.chat-main-content{
  display:flex;
  flex-direction:column;
  height:100%;
}

/* Mobile */

.chat-mobile-close{
  display:none;
  margin-right:10px;
  border:none;
  background:none;
  font-size:18px;
}

@media (max-width:768px){

  .chat-main{
    display:none;
  }

  .chat-main.active{
    display:flex;
    position:fixed;
    inset:0;
    height:100vh;
    z-index:1000;
  }

  .chat-mobile-close{
    display:block;
  }

}