/* ============================================================
   TRENDTER — Phase 3 Styles
   assets/css/phase3.css
   ============================================================ */

/* ══════════════════════════════════════════════════════════ */
/*  DIRECT MESSAGES                                          */
/* ══════════════════════════════════════════════════════════ */

.dm-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* Conversation list panel */
.dm-list-panel {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dm-list-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.dm-list-title {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 800;
}

.dm-search-wrap {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.dm-search {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 9px 16px 9px 38px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.2s;
}
.dm-search:focus { border-color: var(--accent); }
.dm-search::placeholder { color: var(--text3); }

.dm-list-scroll { overflow-y: auto; flex: 1; }

/* Conversation item */
.convo-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
  text-decoration: none;
  color: inherit;
  align-items: flex-start;
}
.convo-item:hover            { background: var(--bg3); }
.convo-item.active           { background: var(--accent-bg); }
.convo-item.unread .convo-name { font-weight: 800; color: var(--text); }
.convo-item.unread .convo-preview { color: var(--text2); }

.convo-info    { flex: 1; min-width: 0; }
.convo-name-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 3px; }
.convo-name    { font-weight: 600; font-size: 15px; }
.convo-time    { font-size: 12px; color: var(--text3); white-space: nowrap; }
.convo-preview { font-size: 14px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.convo-unread-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 6px;
}

/* Conversation chat panel */
.dm-chat-panel {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.dm-chat-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(16px);
}

.dm-chat-user-name {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 17px;
}
.dm-chat-user-handle { font-size: 13px; color: var(--text3); }

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

/* Message bubbles */
.msg-group {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  max-width: 75%;
}
.msg-group.mine {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.msg-group.theirs { align-self: flex-start; }

.msg-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.5;
  max-width: 100%;
  word-break: break-word;
}
.msg-group.mine   .msg-bubble { background: var(--accent); color: #000; border-bottom-right-radius: 4px; font-weight: 500; }
.msg-group.theirs .msg-bubble { background: var(--bg3);    color: var(--text); border-bottom-left-radius: 4px; }

.msg-time {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
  padding: 0 4px;
  align-self: flex-end;
}

.msg-group.mine .msg-time { text-align: right; }

/* Read receipt */
.msg-read-receipt { font-size: 11px; color: var(--text3); text-align: right; padding: 0 4px; margin-top: 1px; }

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 12px 16px;
  color: var(--text3);
  font-size: 13px;
}
.typing-dots { display: flex; gap: 3px; }
.typing-dot  {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text3);
  animation: typingBounce 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%,60%,100% { transform: translateY(0); }
  30%         { transform: translateY(-6px); }
}

/* Message input bar */
.dm-input-bar {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-shrink: 0;
  background: var(--bg);
}

.dm-textarea {
  flex: 1;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: 22px;
  padding: 11px 18px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  outline: none;
  resize: none;
  max-height: 120px;
  overflow-y: auto;
  line-height: 1.4;
  transition: border-color 0.2s;
}
.dm-textarea:focus   { border-color: var(--accent); }
.dm-textarea::placeholder { color: var(--text3); }

.dm-send-btn {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.15s;
  flex-shrink: 0;
}
.dm-send-btn:hover    { background: #fff; transform: scale(1.05); }
.dm-send-btn:disabled { background: var(--bg4); cursor: not-allowed; transform: none; }

/* Empty / no selection state */
.dm-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  color: var(--text2);
}
.dm-empty-icon  { font-size: 56px; }
.dm-empty-title { font-family: var(--font-head); font-weight: 800; font-size: 22px; color: var(--text); }
.dm-empty-desc  { font-size: 15px; color: var(--text3); text-align: center; max-width: 280px; line-height: 1.6; }

/* New DM modal trigger */
.dm-new-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}
.dm-new-btn:hover { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }

/* Mobile DM */
@media (max-width: 768px) {
  .dm-layout { grid-template-columns: 1fr; }
  .dm-chat-panel { display: none; }
  .dm-chat-panel.mobile-active { display: flex; position: fixed; inset: 0; z-index: 500; background: var(--bg); }
  .dm-list-panel { height: 100vh; }
  .dm-mobile-back { display: flex; align-items: center; gap: 8px; margin-right: 8px; color: var(--text2); font-size: 20px; cursor: pointer; }
}

/* ══════════════════════════════════════════════════════════ */
/*  POLLS                                                    */
/* ══════════════════════════════════════════════════════════ */

.poll-composer {
  border-top: 1px solid var(--border);
  padding: 14px 0 8px;
  display: none;
}
.poll-composer.open { display: block; }

.poll-option-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.poll-option-input {
  flex: 1;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.2s;
}
.poll-option-input:focus { border-color: var(--accent); }
.poll-option-input::placeholder { color: var(--text3); }

.poll-remove-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: none;
  border: none;
  color: var(--text3);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.poll-remove-btn:hover { color: var(--danger); background: rgba(255,68,68,0.1); }

.poll-add-btn {
  background: none;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 9px 14px;
  color: var(--text3);
  font-size: 14px;
  font-family: var(--font-body);
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all 0.15s;
}
.poll-add-btn:hover { border-color: var(--accent); color: var(--accent); }

.poll-settings {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--text3);
}
.poll-duration-select {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 5px 10px;
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

/* Poll display on post card */
.poll-display { margin-top: 14px; }

.poll-option {
  position: relative;
  margin-bottom: 8px;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
}
.poll-option.voted { cursor: default; }

.poll-bar {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  border-radius: var(--radius);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 0;
}
.poll-option.winner .poll-bar { background: var(--accent-bg); border: 1px solid rgba(242,226,0,0.3); }
.poll-option:not(.winner) .poll-bar { background: var(--bg4); }

.poll-option-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
}
.poll-option-label { font-size: 15px; font-weight: 500; }
.poll-option-pct   { font-size: 14px; font-weight: 700; color: var(--text3); }
.poll-option.winner .poll-option-pct { color: var(--accent); }
.poll-option.my-vote .poll-option-label::before { content: '✓ '; color: var(--accent); }

.poll-option-vote-btn {
  width: 100%;
  text-align: left;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text);
  font-size: 15px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 8px;
  display: block;
}
.poll-option-vote-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }

.poll-meta {
  font-size: 13px;
  color: var(--text3);
  margin-top: 6px;
  display: flex;
  gap: 12px;
}

/* ══════════════════════════════════════════════════════════ */
/*  QUOTE REPOST                                             */
/* ══════════════════════════════════════════════════════════ */

/* Repost dropdown (appears on repost btn click) */
.repost-dropdown {
  position: absolute;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  min-width: 180px;
  overflow: hidden;
  animation: fadeUp 0.15s both;
}
.repost-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
  color: var(--text);
}
.repost-dropdown-item:hover { background: var(--bg3); }
.repost-dropdown-item .rd-icon { font-size: 18px; }

/* Quote composer modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s both;
}
.modal-overlay.hidden { display: none; }

.modal-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: fadeUp 0.2s both;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 800;
}
.modal-close {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--bg3);
  border: none;
  color: var(--text2);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.modal-close:hover { background: var(--bg4); color: var(--text); }

.modal-body { padding: 20px; }

/* Quote preview inside modal */
.quote-preview-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 14px;
  background: var(--bg3);
}
.qpc-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.qpc-name   { font-weight: 700; font-size: 14px; }
.qpc-handle { color: var(--text3); font-size: 13px; }
.qpc-text   { font-size: 14px; color: var(--text2); line-height: 1.6; }

/* ══════════════════════════════════════════════════════════ */
/*  REPORT MODAL                                             */
/* ══════════════════════════════════════════════════════════ */

.report-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.12s;
  margin-bottom: 4px;
}
.report-option:hover { background: var(--bg3); }
.report-option input[type=radio] { accent-color: var(--accent); width: 18px; height: 18px; flex-shrink: 0; }
.report-option-label { font-size: 15px; font-weight: 500; }
.report-option-desc  { font-size: 13px; color: var(--text3); margin-top: 1px; }

/* ══════════════════════════════════════════════════════════ */
/*  DROPDOWN / CONTEXT MENU (post card three-dot)           */
/* ══════════════════════════════════════════════════════════ */

.ctx-menu {
  position: absolute;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  min-width: 200px;
  overflow: hidden;
  animation: fadeUp 0.15s both;
}
.ctx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s;
  color: var(--text);
  border: none;
  background: none;
  width: 100%;
  font-family: var(--font-body);
}
.ctx-item:hover         { background: var(--bg3); }
.ctx-item.danger        { color: var(--danger); }
.ctx-item.danger:hover  { background: rgba(255,68,68,0.08); }
.ctx-item .ctx-icon     { font-size: 16px; min-width: 20px; text-align: center; }
.ctx-divider            { height: 1px; background: var(--border); margin: 4px 0; }

/* ══════════════════════════════════════════════════════════ */
/*  FOLLOW REQUESTS                                          */
/* ══════════════════════════════════════════════════════════ */

.fr-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.fr-info   { flex: 1; min-width: 0; }
.fr-name   { font-weight: 700; font-size: 15px; }
.fr-handle { color: var(--text3); font-size: 14px; }
.fr-bio    { font-size: 13px; color: var(--text2); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fr-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ══════════════════════════════════════════════════════════ */
/*  DRAFT INDICATOR                                          */
/* ══════════════════════════════════════════════════════════ */

.draft-saved {
  font-size: 12px;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.3s;
}
.draft-saved.visible { opacity: 1; }

/* Draft banner in composer */
.draft-banner {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-size: 13px;
  color: var(--text3);
  border-top: 1px solid var(--border);
  margin-top: 6px;
}
.draft-banner.visible { display: flex; }
.draft-banner a { color: var(--accent); cursor: pointer; font-weight: 600; }

/* ══════════════════════════════════════════════════════════ */
/*  PIN BADGE ON POST                                        */
/* ══════════════════════════════════════════════════════════ */

.pinned-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text3);
  padding: 10px 20px 0;
  font-weight: 500;
}

/* ══════════════════════════════════════════════════════════ */
/*  RESPONSIVE PHASE 3                                       */
/* ══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .dm-layout { grid-template-columns: 1fr; height: calc(100vh - 68px); }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-box { border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 85vh; }
}
