:root {
  color-scheme: light;
  font-family: 'Inter', Arial, sans-serif;
  font-size: 16px;
  background: #f4f6f8;
  color: #172033;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.eyebrow,
.section-label {
  display: inline-flex;
  color: #667085;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.auth-page {
  background:
    linear-gradient(120deg, rgba(31, 129, 92, 0.1), transparent 34%),
    linear-gradient(240deg, rgba(242, 153, 74, 0.14), transparent 36%),
    #f5f7f9;
}

.auth-layout {
  width: min(1120px, calc(100% - 2rem));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) 430px;
  gap: 3rem;
  align-items: center;
  padding: 3rem 0;
}

.auth-intro {
  display: grid;
  gap: 1.25rem;
}

.auth-intro h1 {
  max-width: 680px;
  margin: 0;
  color: #111827;
  font-size: clamp(2.5rem, 6vw, 4.9rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.auth-intro p {
  max-width: 560px;
  margin: 0;
  color: #536171;
  font-size: 1.08rem;
  line-height: 1.75;
}

.auth-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.auth-highlights span {
  border: 1px solid #d9e0e7;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: #27364a;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.7rem 0.9rem;
}

.auth-panel,
.chat-sidebar,
.chat-panel {
  border: 1px solid #dde3ea;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(19, 32, 51, 0.1);
}

.auth-panel {
  padding: 2rem;
}

.auth-panel-head {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 1.5rem;
}

.auth-panel h2 {
  margin: 0;
  color: #111827;
  font-size: 1.65rem;
}

.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1.4rem;
  padding: 0.35rem;
  border-radius: 8px;
  background: #eef2f5;
}

.tab-button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #536171;
  font-weight: 800;
}

.tab-button.active {
  background: #ffffff;
  color: #182433;
  box-shadow: 0 5px 18px rgba(23, 32, 51, 0.1);
}

.auth-form {
  display: grid;
  gap: 1rem;
}

.field-group {
  display: grid;
  gap: 0.45rem;
}

.field-group span {
  color: #344054;
  font-size: 0.9rem;
  font-weight: 700;
}

.field-group input,
.composer input {
  width: 100%;
  border: 1px solid #cbd5df;
  border-radius: 8px;
  background: #fbfcfd;
  color: #172033;
  padding: 0.95rem 1rem;
  outline: none;
}

.field-group input:focus,
.composer input:focus {
  border-color: #1f815c;
  box-shadow: 0 0 0 4px rgba(31, 129, 92, 0.13);
}

.primary-button,
.secondary-button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
  padding: 0.85rem 1.15rem;
}

.primary-button {
  background: #1f815c;
  color: #ffffff;
}

.primary-button:hover {
  background: #176a4a;
}

.secondary-button {
  width: 100%;
  border: 1px solid #d8e0e8;
  background: #f6f8fa;
  color: #27364a;
}

.secondary-button:hover {
  background: #eef2f5;
}

.status-message {
  min-height: 1.4rem;
  margin: 1rem 0 0;
  color: #315f93;
  font-size: 0.92rem;
  line-height: 1.45;
}

.status-message[data-type='error'] {
  color: #c03535;
}

.chat-page {
  background: #edf1f5;
}

.chat-shell {
  width: min(1380px, 100%);
  height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem;
}

.chat-sidebar,
.chat-panel {
  min-height: 0;
}

.chat-sidebar {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 1.25rem;
  padding: 1.25rem;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid #e7ecf1;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #182433;
  color: #ffffff;
  font-weight: 800;
}

.brand-block strong,
.profile-strip strong {
  display: block;
  color: #172033;
}

.brand-block span:not(.brand-mark),
.profile-label {
  display: block;
  color: #667085;
  font-size: 0.86rem;
}

.sidebar-scroll {
  min-height: 0;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 1.35rem;
  padding-right: 0.15rem;
}

.channel-panel,
.user-panel {
  min-height: 0;
}

.channel-list,
.user-list {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.channel-button {
  display: grid;
  gap: 0.25rem;
  width: 100%;
  min-height: 68px;
  border: 1px solid #dde3ea;
  border-radius: 8px;
  background: #fbfcfd;
  color: #172033;
  padding: 0.8rem;
  text-align: left;
}

.channel-button span {
  font-weight: 800;
}

.channel-button small {
  color: #667085;
  font-size: 0.8rem;
  line-height: 1.35;
}

.channel-button.active {
  border-color: #1f815c;
  background: #edf8f3;
}

.channel-button.active small {
  color: #326f55;
}

.user-button {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  width: 100%;
  min-height: 48px;
  border: 1px solid #dde3ea;
  border-radius: 8px;
  background: #fbfcfd;
  color: #172033;
  padding: 0.55rem 0.65rem;
  text-align: left;
  transition: all 0.2s ease;
}

.user-button:hover {
  background: #f1f3f5;
  border-color: #cdd5de;
}

.user-name-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.user-button.active {
  border-color: #1f815c;
  background: #edf8f3;
}

.empty-sidebar {
  border: 1px dashed #d8e0e8;
  border-radius: 8px;
  color: #7a8795;
  font-size: 0.86rem;
  padding: 0.85rem;
}

.profile-strip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  padding: 0.9rem;
  border: 1px solid #e1e7ed;
  border-radius: 8px;
  background: #fbfcfd;
}

.profile-avatar,
.mini-avatar {
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
  border-radius: 8px;
  background: #f2994a;
  color: #ffffff;
  font-weight: 800;
}

.profile-avatar {
  width: 40px;
  height: 40px;
}

.mini-avatar {
  width: 28px;
  height: 28px;
  font-size: 0.8rem;
}

.profile-avatar img,
.mini-avatar {
  object-fit: cover;
}

img.profile-avatar,
img.mini-avatar,
.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.chat-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  padding: 1rem;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding: 0.5rem 0.5rem 1rem;
  border-bottom: 1px solid #e7ecf1;
}

.chat-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.65rem;
}

.chat-header h1 {
  margin: 0.25rem 0 0.25rem;
  color: #111827;
  font-size: clamp(1.6rem, 3vw, 2.35rem);
  line-height: 1.1;
  letter-spacing: 0;
}

.chat-header p {
  margin: 0;
  color: #667085;
  line-height: 1.5;
}

.status-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #edf8f3;
  color: #1f815c;
  font-size: 0.85rem;
  font-weight: 800;
  padding: 0.55rem 0.75rem;
}

.compact-button {
  width: auto;
  min-height: 36px;
  padding: 0.5rem 0.7rem;
  font-size: 0.86rem;
}

.message-list {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  overflow-y: auto;
  padding: 1rem 0.5rem;
}

.message-card {
  width: fit-content;
  max-width: min(680px, 86%);
  border: 1px solid #e1e7ed;
  border-radius: 8px;
  background: #f8fafb;
  padding: 0.85rem 1rem;
}

.message-card.own-message {
  align-self: flex-end;
  border-color: #bee3d1;
  background: #edf8f3;
}

.message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 0.35rem;
}

.message-author {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.5rem;
}

.message-meta strong {
  color: #172033;
  font-size: 0.92rem;
}

.message-meta time {
  color: #7a8795;
  font-size: 0.78rem;
}

.message-time-receipt {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
}

.read-receipt {
  color: #8696a0; /* Gray for sent checkmark */
  font-size: 0.85rem;
  font-weight: 600;
  min-width: fit-content;
}

.read-receipt.seen {
  color: #53bdeb; /* Beautiful light blue for read receipts */
}

.read-receipt.channel-reads {
  color: #667085;
  font-size: 0.72rem;
  font-weight: 500;
  background: rgba(0, 0, 0, 0.05);
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  opacity: 0.85;
}

.message-card p {
  margin: 0;
  color: #27364a;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.deleted-message p {
  color: #7a8795;
  font-style: italic;
}

.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.7rem;
}

.message-actions button {
  border: 1px solid #d8e0e8;
  border-radius: 999px;
  background: #ffffff;
  color: #536171;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.35rem 0.55rem;
}

.message-actions button:hover {
  color: #c03535;
  border-color: #f0c7c7;
  background: #fff7f7;
}

.empty-state {
  margin: auto;
  color: #667085;
  text-align: center;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  padding: 1rem 0.5rem 0.25rem;
  border-top: 1px solid #e7ecf1;
}

.composer .primary-button {
  min-width: 96px;
}

.chat-status {
  margin: 0.25rem 0.5rem 0;
}

.profile-dialog {
  width: min(460px, calc(100% - 2rem));
  border: 1px solid #dde3ea;
  border-radius: 8px;
  padding: 0;
  background: #ffffff;
  box-shadow: 0 28px 90px rgba(19, 32, 51, 0.22);
}

.profile-dialog::backdrop {
  background: rgba(17, 24, 39, 0.42);
}

.profile-form {
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
}

.profile-form h2 {
  margin: 0.25rem 0 0;
  color: #111827;
  font-size: 1.45rem;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

@media (max-width: 900px) {
  .auth-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
    align-content: center;
  }

  .auth-panel {
    max-width: 520px;
  }

  .chat-shell {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
  }

  .chat-sidebar {
    grid-template-rows: auto auto auto auto;
  }

  .channel-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .user-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chat-panel {
    min-height: 68vh;
  }
}

@media (max-width: 640px) {
  .auth-layout {
    width: min(100% - 1rem, 520px);
    padding: 1rem 0;
  }

  .auth-panel,
  .chat-sidebar,
  .chat-panel {
    border-radius: 8px;
  }

  .auth-panel {
    padding: 1.25rem;
  }

  .auth-intro h1 {
    font-size: 2.35rem;
  }

  .chat-shell {
    padding: 0.5rem;
  }

  .channel-list {
    grid-template-columns: 1fr;
  }

  .chat-header {
    align-items: stretch;
    flex-direction: column;
  }

  .chat-actions {
    justify-content: flex-start;
  }

  .status-pill {
    width: fit-content;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .composer .primary-button {
    width: 100%;
  }

  .message-card {
    max-width: 94%;
  }

  .user-list {
    grid-template-columns: 1fr;
  }

  .sidebar-actions,
  .dialog-actions {
    grid-template-columns: 1fr;
  }
}

/* Toast Notifications Container */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: grid;
  gap: 0.75rem;
  max-width: 380px;
  width: calc(100% - 3rem);
  pointer-events: none;
}

/* Individual Toast */
.toast-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.85rem;
  align-items: center;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px) saturate(190%);
  -webkit-backdrop-filter: blur(12px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.02);
  pointer-events: auto;
  cursor: pointer;
  transform: translateY(-20px);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease, background-color 0.2s ease;
}

.toast-card:hover {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.12);
}

.toast-card.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-card.hide {
  transform: scale(0.9);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.toast-avatar {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #f2994a;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  overflow: hidden;
  font-size: 1rem;
}

.toast-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.toast-content {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.toast-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: #172033;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast-message {
  font-size: 0.85rem;
  color: #4f5e71;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.toast-close {
  background: transparent;
  border: none;
  color: #a0aec0;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
  line-height: 1;
}

.toast-close:hover {
  color: #4a5568;
}

/* Unread Badge next to Channels/DMs */
.unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #1f815c;
  color: white;
  font-size: 0.72rem;
  font-weight: 800;
  border-radius: 999px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  box-shadow: 0 2px 4px rgba(31, 129, 92, 0.2);
}

.channel-button-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

/* Premium Vibe Enhancements */
.chat-shell {
  border-radius: 12px;
  overflow: hidden;
}

.channel-button {
  transition: all 0.2s ease;
}
.channel-button:hover {
  background: #f1f3f5;
  border-color: #cdd5de;
}

.message-card {
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
  transition: box-shadow 0.25s ease;
}
.message-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* WhatsApp Toast Custom Styling for Avatar inside Toast */
.toast-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}
