/* ========== MAIN CHAT AREA ========== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-default);
  min-height: 0;
}

.main-header {
  padding: 16px 24px;
  background: var(--bg-paper);
  border-bottom: 1px dashed var(--divider);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-height);
}

.main-header-info { display: flex; align-items: center; gap: 16px; }
.main-header-avatar {
  width: 44px;
  height: 44px;
  color: #fff !important;
  font-weight: 700;
  text-transform: uppercase;
  overflow: hidden;
}

.main-header-avatar span {
  color: inherit;
  line-height: 1;
}

.main-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.main-header-details h3 {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}

.main-header-details p { font-size: 0.75rem; color: var(--text-secondary); margin-top: 2px; }
.main-header-details .online { color: var(--success); }
.main-header-actions { display: flex; gap: 4px; }
.main-header-actions .icon-btn.active { background: rgba(0,167,111,0.14); color: var(--primary); }
.main-header-actions #chatSearchToggle.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: var(--shadow-primary);
}

.chat-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 24px;
  padding: 0 10px;
  max-height: 0;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) * 1.75);
  background: linear-gradient(135deg, rgba(0,167,111,0.08) 0%, rgba(145,158,171,0.04) 100%);
  transition: max-height var(--transition), opacity var(--transition), transform var(--transition), margin var(--transition), padding var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.chat-search-bar.active {
  max-height: 88px;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  margin: 10px 24px 8px;
  padding: 10px;
  border-color: rgba(0,167,111,0.18);
  box-shadow: var(--shadow-z8);
}

.chat-search-field {
  position: relative;
  min-width: 0;
  flex: 1;
  background: var(--bg-paper);
  border: 1px solid var(--divider);
  border-radius: 12px;
  box-shadow: var(--shadow-z1);
}

.chat-search-field i {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-disabled);
  font-size: 0.8125rem;
}

.chat-search-input {
  width: 100%;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text-primary);
  padding: 10px 12px 10px 36px;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
}

.chat-search-input:focus {
  outline: none;
}

.chat-search-field:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,167,111,0.14);
}

.chat-search-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.chat-search-count {
  min-width: 102px;
  height: 30px;
  border-radius: 999px;
  padding: 0 10px;
  border: 1px solid var(--divider);
  background: var(--bg-paper);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.chat-search-count[data-state="idle"] {
  color: var(--text-disabled);
}

.chat-search-count[data-state="none"] {
  color: var(--error);
  border-color: rgba(255,86,48,0.32);
  background: rgba(255,86,48,0.08);
}

.chat-search-count[data-state="results"] {
  color: var(--primary-dark);
  border-color: rgba(0,167,111,0.34);
  background: rgba(0,167,111,0.12);
}

.chat-search-hint {
  font-size: 0.6875rem;
  color: var(--text-disabled);
}

.chat-search-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--divider);
  border-radius: 999px;
  padding: 3px;
  background: var(--bg-paper);
  box-shadow: var(--shadow-z1);
}

.chat-search-btn {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.chat-search-btn:hover:not(:disabled) {
  background: rgba(0,167,111,0.12);
  color: var(--primary-dark);
}

.chat-search-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chat-search-btn.close {
  color: var(--text-disabled);
}

.chat-search-btn.close:hover:not(:disabled) {
  background: rgba(255,86,48,0.14);
  color: var(--error);
}

/* Empty State */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.empty-state::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(48% 34% at 12% 10%, rgba(31,127,224,0.10) 0%, rgba(31,127,224,0) 80%),
    radial-gradient(44% 36% at 88% 88%, rgba(149,216,107,0.12) 0%, rgba(149,216,107,0) 82%);
  pointer-events: none;
}

.empty-brand {
  position: relative;
  z-index: 1;
  width: min(460px, 80vw);
  padding: 18px 22px;
  border-radius: 28px;
  background:
    radial-gradient(120% 120% at 8% 12%, rgba(31,127,224,0.16) 0%, rgba(31,127,224,0) 56%),
    radial-gradient(130% 130% at 96% 90%, rgba(149,216,107,0.18) 0%, rgba(149,216,107,0) 58%),
    linear-gradient(135deg, rgba(0,167,111,0.07) 0%, rgba(0,167,111,0.02) 100%);
  border: 1px solid rgba(0,167,111,0.18);
  box-shadow: 0 16px 34px rgba(26,75,61,0.12), inset 0 1px 0 rgba(255,255,255,0.6);
  margin-bottom: 22px;
}

.empty-brand-image {
  width: 100%;
  max-width: 390px;
  height: auto;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 10px 18px rgba(0,167,111,0.15));
}

.empty-icon {
  width: 120px;
  height: 120px;
  background: linear-gradient(135deg, rgba(0,167,111,0.08) 0%, rgba(0,167,111,0.02) 100%);
  border-radius: calc(var(--radius) * 4);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.empty-icon i { font-size: 3rem; color: var(--primary); }
.empty-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 12px; color: var(--text-primary); position: relative; z-index: 1; }
.empty-text { font-size: 0.875rem; color: var(--text-secondary); max-width: 380px; margin-bottom: 24px; line-height: 1.6; position: relative; z-index: 1; }
