/* ========================================
   MATERIAL DESIGN 3 - STATUS STYLES
   Abie Messenger - Online/Offline & Read Receipts
   ======================================== */

/* ========================================
   AVATAR WRAPPER
   ======================================== */
.avatar-wrapper {
  position: relative;
  flex-shrink: 0;
}

/* ========================================
   ONLINE INDICATOR
   ======================================== */
.online-indicator {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  background: var(--md-sys-color-success);
  border: 2px solid var(--md-sys-color-surface);
  border-radius: var(--md-sys-shape-corner-full);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  animation: md-pulse 2s ease-in-out infinite;
}

/* Smaller indicator for chat list */
.chat-item .online-indicator {
  width: 10px;
  height: 10px;
  bottom: 1px;
  right: 1px;
  border-width: 1.5px;
}

/* ========================================
   STATUS TEXT STYLES
   ======================================== */
.status-online {
  font-family: var(--md-sys-typescale-label-medium-font-family);
  font-size: var(--md-sys-typescale-label-medium-font-size);
  font-weight: var(--md-sys-typescale-label-medium-font-weight);
  letter-spacing: var(--md-sys-typescale-label-medium-letter-spacing);
  color: var(--md-sys-color-success);
}

.status-lastseen {
  font-family: var(--md-sys-typescale-label-medium-font-family);
  font-size: var(--md-sys-typescale-label-medium-font-size);
  letter-spacing: var(--md-sys-typescale-label-medium-letter-spacing);
  color: var(--md-sys-color-on-surface-variant);
}

/* Contact status container */
.contact-status {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.contact-status-line {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Chat header online status */
.chat-subtitle.online {
  color: var(--md-sys-color-success) !important;
  font-weight: 500;
}

/* ========================================
   READ RECEIPTS (✓✓)
   ======================================== */
.read-receipt {
  font-size: 14px;
  margin-left: 4px;
  vertical-align: middle;
  transition: color var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard);
}

/* Sent but not read - single check */
.read-receipt.sent {
  color: var(--md-sys-color-on-primary-container);
  opacity: 0.7;
}

/* Read - double check turns primary */
.read-receipt.read {
  color: var(--md-sys-color-success);
  opacity: 1;
}

/* For other people's messages */
.message:not(.own) .read-receipt.sent {
  color: var(--md-sys-color-on-surface-variant);
}

/* Time with receipt wrapper */
.message-time-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

/* ========================================
   TYPING INDICATOR
   ======================================== */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: var(--md-sys-color-surface-container);
  border-radius: var(--md-sys-shape-corner-medium);
  width: fit-content;
}

.typing-indicator span {
  font-family: var(--md-sys-typescale-label-small-font-family);
  font-size: var(--md-sys-typescale-label-small-font-size);
  color: var(--md-sys-color-on-surface-variant);
  font-style: italic;
}

.typing-dots {
  display: flex;
  gap: 3px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background: var(--md-sys-color-outline);
  border-radius: 50%;
  animation: typing-bounce 1.4s ease-in-out infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing-bounce {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-4px);
  }
}

/* ========================================
   PRESENCE BADGE (Alternative Style)
   ======================================== */
.presence-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--md-sys-shape-corner-full);
  font-family: var(--md-sys-typescale-label-small-font-family);
  font-size: var(--md-sys-typescale-label-small-font-size);
  font-weight: var(--md-sys-typescale-label-small-font-weight);
}

.presence-badge.online {
  background: var(--md-sys-color-success-container);
  color: var(--md-sys-color-on-success-container);
}

.presence-badge.offline {
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
}

.presence-badge::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.presence-badge.online::before {
  background: var(--md-sys-color-success);
}

.presence-badge.offline::before {
  background: var(--md-sys-color-outline);
}

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
  .online-indicator {
    width: 10px;
    height: 10px;
    border-width: 1.5px;
  }

  .chat-item .online-indicator {
    width: 8px;
    height: 8px;
    border-width: 1px;
  }

  .status-online,
  .status-lastseen {
    font-size: var(--md-sys-typescale-label-small-font-size);
  }

  .read-receipt {
    font-size: 12px;
  }
}
