/* ==========================================================================
   LucyChat - Header & App-Layout
   ========================================================================== */
header {
  background-color: var(--bg-secondary);
  padding: 8px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.15s ease;
}

.logo-container:hover {
  opacity: 0.88;
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
  transition: transform 0.15s ease;
}

.logo-container:hover .brand-logo {
  transform: scale(1.08);
}

.brand-logo-large {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}

.logo-title {
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.3px;
}

.badge-e2ee {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  color: var(--text-muted);
  opacity: 0.85;
  padding: 3px 8px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  user-select: none;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--offline-red);
  transition: background-color 0.2s;
  flex-shrink: 0;
}

.status-dot.online {
  background-color: var(--online-green);
}

.btn-action {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  transition: all 0.15s;
}

.btn-action:hover {
  background: var(--border);
}

.btn-theme-toggle-compact {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.15s ease;
  padding: 0;
  flex-shrink: 0;
}

.btn-theme-toggle-compact:hover {
  background: var(--border);
  transform: scale(1.08);
}

.app-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Sidebar */
.sidebar {
  width: 380px;
  min-width: 320px;
  max-width: 440px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.sidebar-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-secondary);
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  min-height: 52px;
}

.sidebar-top-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
}

.whatsapp-header-icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
  flex-shrink: 0;
  position: relative;
}

.whatsapp-header-icon-btn:hover {
  background-color: rgba(134, 150, 160, 0.18);
  color: var(--text-main);
}

.sidebar-search-row {
  padding: 8px 12px;
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
}

.whatsapp-search-pill {
  display: flex;
  align-items: center;
  background-color: var(--bg-secondary);
  border-radius: 8px;
  padding: 0 12px;
  height: 36px;
  border: 1px solid transparent;
  transition: border-color 0.15s, background-color 0.15s;
}

.whatsapp-search-pill:focus-within {
  border-color: var(--accent);
  background-color: var(--bg-sidebar);
}

.whatsapp-search-pill .search-icon {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-right: 8px;
  display: flex;
  align-items: center;
}

.whatsapp-search-pill .search-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 0.88rem;
  outline: none;
  padding: 0;
  width: 100%;
}

.chat-filter-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 2px;
}
.chat-filter-pills::-webkit-scrollbar {
  display: none;
}

.chat-filter-pill {
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 5px 13px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  user-select: none;
  line-height: 1.2;
}

.chat-filter-pill:hover {
  background: var(--border);
  color: var(--text-main);
}

.chat-filter-pill.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

.filter-pill-badge {
  background: var(--accent);
  color: #ffffff;
  border-radius: 9999px;
  font-size: 0.70rem;
  font-weight: 700;
  padding: 1px 6px;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.list-container {
  flex: 1;
  overflow-y: auto;
  list-style: none;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 16px;
  opacity: 0.8;
}

.sidebar-section-header {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  padding: 8px 16px 4px 16px;
}

.chat-item,
.user-item {
  padding: 0 16px;
  height: 72px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: background 0.12s ease;
  position: relative;
}

.chat-item:hover,
.user-item:hover {
  background-color: var(--bg-secondary);
}

.chat-item.active {
  background-color: var(--bg-secondary);
}

.avatar-wrapper {
  position: relative;
  flex-shrink: 0;
}

.avatar-img-circle {
  width: 49px;
  height: 49px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.avatar-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  position: absolute;
  bottom: 1px;
  right: 1px;
  border: 2px solid var(--bg-sidebar);
  background-color: var(--offline-red);
}

.avatar-dot.online {
  background-color: var(--online-green);
}

.item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.item-name {
  font-weight: 500;
  font-size: 16px;
  color: var(--text-main);
  display: flex;
  justify-content: space-between;
  align-items: center;
  line-height: 21px;
}

.chat-tag {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-muted);
  margin-left: 6px;
}

[data-theme="dark"] .chat-tag {
  background: rgba(255, 255, 255, 0.08);
}

.item-sub-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 3px;
}

.item-sub {
  font-size: 13.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  line-height: 18px;
}

.unread-badge {
  background-color: var(--offline-red, #ef4444);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 0 6px;
  height: 20px;
  min-width: 20px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  box-shadow: 0 1px 3px rgba(234, 67, 53, 0.4);
}

.quick-add-contact-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 16px;
  margin: 18px auto 20px auto;
  max-width: calc(100% - 48px);
  width: fit-content;
  background: transparent;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: 20px;
  font-size: 0.80rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  text-align: center;
}

.quick-add-contact-btn:hover {
  background: var(--bg-card);
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.btn-favorite-star {
  background: none;
  border: none;
  font-size: 1.15rem;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
  border-radius: 4px;
  transition: transform 0.15s ease, opacity 0.15s ease;
  opacity: 0.75;
}

.btn-favorite-star:hover {
  opacity: 1;
  transform: scale(1.2);
}

.btn-favorite-star.active {
  opacity: 1;
  filter: drop-shadow(0 0 2px rgba(234, 179, 8, 0.5));
}

.btn-item-more {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  cursor: pointer;
  opacity: 0.7;
  transition: all 0.15s ease;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
}

.btn-item-more:hover {
  opacity: 1;
  background: var(--bg-hover);
  color: var(--text-main);
}

/* Empty State Dashboard */
.empty-state-dashboard {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-primary);
  padding: 30px 20px;
  overflow-y: auto;
  text-align: center;
  user-select: none;
  width: 100%;
  height: 100%;
}

.dash-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 480px;
  width: 100%;
  animation: fadeInDashboard 0.22s ease-out;
}

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

.dash-profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 22px;
}

.dash-avatar-wrapper {
  position: relative;
  cursor: pointer;
  margin-bottom: 10px;
  transition: transform 0.18s ease;
}

.dash-avatar-wrapper:hover {
  transform: scale(1.04);
}

.dash-avatar-img {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  display: block;
}

.dash-avatar-edit-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.80rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.dash-user-name-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.dash-user-name {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.dash-edit-name-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.05rem;
  padding: 2px 4px;
  opacity: 0.75;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.dash-edit-name-btn:hover {
  opacity: 1;
  transform: scale(1.15);
}

.dash-user-email {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.dash-user-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 10px;
  border-radius: 12px;
  margin-top: 8px;
  font-weight: 500;
}

.dash-feature-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 26px 24px;
  width: 100%;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.dash-illu-icon-circle {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.dash-feature-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 8px 0;
}

.dash-feature-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0 0 18px 0;
  max-width: 360px;
}

.dash-feature-btn {
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 24px;
  padding: 9px 24px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0, 168, 132, 0.35);
  transition: background 0.15s ease, transform 0.15s ease;
}

.dash-feature-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.dash-quick-actions-row {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 20px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.dash-action-btn {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  width: 80px;
  transition: transform 0.15s ease;
}

.dash-action-btn:hover {
  transform: translateY(-2px);
}

.dash-action-icon-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.dash-action-btn:hover .dash-action-icon-circle {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.dash-action-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.25;
  text-align: center;
  font-weight: 500;
  transition: color 0.15s ease;
}

.dash-action-btn:hover .dash-action-label {
  color: var(--text-main);
}

@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
  }
  .sidebar.hide-mobile {
    display: none;
  }
  .btn-mobile-back {
    display: inline-flex;
  }
}
