/* ============================================
   inbox.css — Inbox and Chat views
   Scoped to .inbox-split-layout
   ============================================ */

/* ========== SPLIT LAYOUT ========== */

.inbox-split-layout {
  display: flex;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

/* ========== COLUMN 1 — INBOX PANEL ========== */

.inbox-panel {
  flex: 1;
  border-right: 1px solid #c0c0c0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.inbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  padding: 0 16px;
  border-bottom: 1px solid #c0c0c0;
  flex-shrink: 0;
  gap: 8px;
}

.inbox-title {
  font-size: 20px;
  font-weight: 400;
  font-family: var(--font-display);
  color: var(--color-text-primary);
  flex: 1;
  text-align: center;
}

.inbox-new-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--color-purple);
  color: var(--color-purple);
  background: none;
  cursor: pointer;
  transition: background 0.15s;
  padding: 0;
}

.inbox-new-btn:hover {
  background: rgba(109, 40, 217, 0.06);
}

.inbox-list {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex: 1;
}

.inbox-convo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid #c0c0c0;
  cursor: pointer;
  transition: background 0.12s;
}

.inbox-convo:hover {
  background: var(--color-canvas-subtle);
}

.inbox-convo.active {
  background: var(--color-canvas-subtle);
  border-left: 2px solid var(--color-purple);
  padding-left: 14px;
}

/* ========== AVATAR ========== */

.inbox-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  font-family: var(--font-display);
}

.inbox-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.inbox-avatar.unread {
  outline: 3px solid #6D28D9;
  outline-offset: 2px;
}

/* ========== CONVO BODY ========== */

.inbox-convo-body {
  flex: 1;
  min-width: 0;
}

.inbox-convo-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.inbox-convo-name {
  font-size: 18px;
  font-weight: 600;
  font-family: var(--font-display);
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inbox-convo-time {
  font-size: 14px;
  color: var(--color-text-muted);
  font-family: var(--font-display);
  flex-shrink: 0;
}

.inbox-convo-preview {
  font-size: 15px;
  color: var(--color-text-secondary);
  font-family: var(--font-display);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inbox-convo.unread .inbox-convo-name {
  font-weight: 700;
}

.inbox-convo.unread .inbox-convo-preview {
  font-weight: 600;
  color: var(--color-text-primary);
}


/* ========== COLUMN 2 — CHAT PANEL ========== */

.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid #c0c0c0;
}

.chat-panel-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--color-text-muted);
  font-size: 14px;
  font-family: var(--font-display);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 60px;
  padding: 0 20px;
  border-bottom: 1px solid #c0c0c0;
  flex-shrink: 0;
}

.chat-name {
  font-size: 20px;
  font-weight: 600;
  font-family: var(--font-display);
  color: var(--color-text-primary);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-msg {
  max-width: 65%;
  padding: 14px 18px;
  border-radius: 16px;
  font-size: 17px;
  font-family: var(--font-display);
  line-height: 1.5;
  word-break: break-word;
}

.chat-msg.mine {
  align-self: flex-end;
  background: var(--color-purple);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-msg.theirs {
  align-self: flex-start;
  background: var(--color-canvas-inset);
  color: var(--color-text-primary);
  border-bottom-left-radius: 4px;
}

.chat-input-row {
  padding: 12px 16px;
  border-top: 1px solid #c0c0c0;
  background: white;
  display: flex;
  align-items: flex-end;
  flex-shrink: 0;
}

.chat-input-box {
  position: relative;
  border: 1.5px solid #c0c0c0;
  border-radius: 12px;
  padding: 10px 52px 10px 46px;
  background: white;
  display: flex;
  align-items: flex-end;
  flex: 1;
}

.chat-input-box:focus-within {
  border-color: #6D28D9;
}

.chat-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 17px;
  font-family: var(--font-display);
  resize: none;
  background: transparent;
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
  width: 100%;
  color: var(--color-text-primary);
}

.chat-input::placeholder {
  color: var(--color-text-muted);
}

.chat-send-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #6D28D9;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.chat-send-btn:hover {
  opacity: 0.85;
}

.chat-char-count {
  display: none;
  font-size: 11px;
  color: var(--color-text-muted);
  position: absolute;
  bottom: 46px;
  right: 8px;
  pointer-events: none;
}

.chat-char-count.visible {
  display: block;
}

.chat-char-count.danger {
  color: var(--color-error);
}

.chat-plus-btn {
  position: absolute;
  left: 10px;
  bottom: 10px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-plus-btn:hover {
  color: #6D28D9;
}

#sticker-picker-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.3);
}

#sticker-picker-overlay.visible {
  display: flex;
  align-items: center;
  justify-content: center;
}

#sticker-picker {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 860px;
  max-height: 640px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#sticker-picker-header {
  padding: 14px 16px 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
  border-bottom: 1px solid #c0c0c0;
  flex-shrink: 0;
  text-align: center;
  position: relative;
}

#sticker-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  padding: 12px;
  overflow-y: auto;
  flex: 1;
}

.sticker-picker-item {
  cursor: pointer;
  border-radius: 8px;
  display: block;
  background: transparent;
}

.sticker-picker-item:hover {
  background: #ede9fe;
}

.sticker-picker-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  display: block;
  border-radius: 8px;
}

.chat-sticker-img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  border-radius: 8px;
}

/* ========== COLUMN 3 — AD PANEL ========== */

.ad-panel {
  width: 220px;
  flex-shrink: 0;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ad-panel-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-family: var(--font-display);
}

.ad-panel-placeholder {
  flex: 1;
  border: 1.5px dashed var(--color-border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--color-text-muted);
  font-family: var(--font-display);
}

/* ========== BACK BUTTON (hidden on desktop) ========== */

#chat-back-btn {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--color-text-primary);
  flex-shrink: 0;
}

/* ========== MOBILE ========== */

@media (max-width: 768px) {
  .ad-panel {
    display: none;
  }

  .inbox-split-layout {
    flex-direction: column;
    height: 100%;
    overflow: hidden;
  }

  .inbox-panel {
    width: 100%;
    height: 100%;
    flex-shrink: 0;
    overflow-y: auto;
  }

  .chat-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    background: #ffffff;
    display: none;
    flex-direction: column;
  }

  .chat-panel.mobile-open {
    display: flex;
  }

  #chat-back-btn {
    display: flex;
  }

  .chat-messages {
    flex: 1;
    overflow-y: auto;
  }
}
