/* ============================================================
   chat.css — Chat section, message bubbles, inbox list,
              signup modal
   ============================================================ */

/* ── CHAT SECTION LAYOUT ──────────────────────────────────── */
#section-chat.active {
  display: flex;
  padding: 0;
  height: calc(100vh - 58px - 34px);
  flex-direction: column;
}

.chat-wrap { display: flex; flex: 1; overflow: hidden; }
.chat-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ── CHAT HEADER BAR (clean, no background photo) ───────── */
.chat-header-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--sur);
  border-bottom: 1px solid var(--bdr);
  flex-shrink: 0;
  min-height: 64px;
}

.chat-back-btn {
  display: none; /* hidden on desktop */
  align-items: center;
  gap: 6px;
  background: var(--sur2);
  border: 1px solid var(--bdr);
  color: var(--txt);
  font-size: 13px; font-weight: 700;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.chat-back-btn:hover { background: rgba(255,255,255,0.08); }

.ch-av {
  width: 42px; height: 42px;
  border-radius: 10px;
  background: var(--sur2);
  overflow: hidden;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.ch-av img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }

.ch-header-info { flex: 1; min-width: 0; }
.ch-name { font-size: 15px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-live { font-size: 11px; color: var(--grn); display: flex; align-items: center; gap: 4px; margin-top: 2px; }

/* View Profile button */
.ch-view-profile-btn {
  padding: 8px 16px;
  background: rgba(224,25,121,.12);
  border: 1px solid rgba(224,25,121,.3);
  border-radius: 20px;
  color: #f979b7;
  font-size: 12.5px; font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background .15s;
}
.ch-view-profile-btn:hover { background: rgba(224,25,121,.22); }

.ldot { width: 7px; height: 7px; background: var(--grn); border-radius: 50%; animation: ldpulse 1.4s ease-in-out infinite; }
@keyframes ldpulse { 0%,100%{ opacity: 1; } 50%{ opacity: .35; } }

@media (max-width: 768px) {
  .chat-back-btn { display: flex; }
  .ch-view-profile-btn { display: none; } /* hidden on small mobile to save space */
}

.ldot { width: 7px; height: 7px; background: var(--grn); border-radius: 50%; animation: ldpulse 1.4s ease-in-out infinite; }
@keyframes ldpulse { 0%,100%{ opacity: 1; } 50%{ opacity: .35; } }

/* ── MESSAGES ─────────────────────────────────────────────── */
#chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  background: var(--bg);
}
.msg     { display: flex; max-width: 78%; }
.msg.me  { align-self: flex-end; flex-direction: row-reverse; }
.mbub    { padding: 11px 15px; border-radius: 17px; font-size: 13.5px; line-height: 1.5; }
.msg.them .mbub { background: var(--sur2); border-radius: 17px 17px 17px 4px; }
.msg.me   .mbub { background: linear-gradient(135deg, #e01979, #f472b6); border-radius: 17px 17px 4px 17px; }

/* ── INPUT BAR ────────────────────────────────────────────── */
.cin-bar {
  position: relative;
  padding: 11px 14px;
  background: var(--sur);
  border-top: 1px solid var(--bdr);
  display: flex; gap: 9px; flex-shrink: 0;
}
.cin {
  flex: 1;
  background: var(--sur2);
  border: 1px solid var(--bdr);
  border-radius: 11px;
  padding: 11px 15px;
  color: var(--txt); font-size: 13.5px;
  outline: none; font-family: inherit;
  transition: border-color .15s;
}
.cin:focus        { border-color: #e01979; }
.cin::placeholder { color: var(--mut); }
.csend {
  padding: 11px 18px;
  background: linear-gradient(135deg, #e01979, #f472b6);
  border: none; border-radius: 11px;
  color: #fff; font-weight: 700; font-size: 13px;
  cursor: pointer;
}

/* ── VIP CHAT: photo/gift attach buttons ─────────────────── */
.cin-attach {
  flex-shrink: 0;
  width: 42px; height: 42px;
  background: var(--sur2);
  border: 1px solid var(--bdr);
  border-radius: 11px;
  font-size: 17px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, background .15s;
}
.cin-attach:hover { border-color: #e01979; background: rgba(224,25,121,0.12); }

/* Gift picker popover, anchored above the input bar */
.gift-picker {
  position: absolute;
  bottom: 64px;
  left: 14px;
  background: var(--sur);
  border: 1px solid var(--bdr);
  border-radius: 14px;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  z-index: 20;
}
.gift-opt {
  width: 52px; height: 52px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--sur2);
  border: 1px solid var(--bdr);
  border-radius: 10px;
  cursor: pointer;
  font-size: 20px;
  transition: border-color .15s;
}
.gift-opt:hover { border-color: #e01979; }
.gift-opt .go-price { font-size: 8.5px; color: var(--mut); margin-top: 1px; }

/* Photo message bubble (sent) */
.msg-photo {
  max-width: 220px;
  border-radius: 14px;
  overflow: hidden;
  display: block;
}
.msg-photo img { width: 100%; display: block; }

/* Blurred / lockable received photo */
.msg-photo-locked {
  position: relative;
  width: 220px;
  height: 220px;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
}
.msg-photo-locked img {
  width: 100%; height: 100%; object-fit: cover;
  filter: blur(22px) brightness(0.7);
  transform: scale(1.1);
}
.msg-photo-locked .mpl-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px;
  background: rgba(0,0,0,.25);
  color: #fff; text-align: center; padding: 10px;
}
.msg-photo-locked .mpl-icon { font-size: 26px; }
.msg-photo-locked .mpl-btn {
  margin-top: 4px;
  padding: 7px 14px;
  background: linear-gradient(135deg, #b45309, #fbbf24);
  border-radius: 20px;
  color: #000; font-weight: 800; font-size: 11.5px;
}

/* Gift message bubble */
.msg-gift {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 14px 18px;
}
.msg-gift .mg-icon { font-size: 34px; }
.msg-gift .mg-label { font-size: 11px; color: var(--mut); }

/* ── CHAT ACTIVITY SIDEBAR ────────────────────────────────── */
.chat-act {
  width: 230px; flex-shrink: 0;
  border-left: 1px solid var(--bdr);
  background: var(--sur);
  overflow-y: auto;
  padding: 13px;
  display: flex; flex-direction: column; gap: 10px;
}
.ca-ttl { font-size: 13.5px; font-weight: 800; margin-bottom: 2px; }

/* ── INBOX LIST ───────────────────────────────────────────── */
.iitem {
  display: flex; align-items: center; gap: 11px;
  padding: 13px;
  background: var(--sur);
  border: 1px solid var(--bdr);
  border-radius: 13px;
  cursor: pointer;
  transition: border-color .15s;
  margin-bottom: 9px;
}
.iitem:hover { border-color: rgba(224,25,121,.4); }
.iav {
  font-size: 28px; width: 44px; height: 44px;
  background: var(--sur2); border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.iname { font-size: 13.5px; font-weight: 700; }
.iprev {
  font-size: 12px; color: var(--mut); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 200px;
}
.itime { font-size: 11px; color: var(--mut); flex-shrink: 0; margin-left: auto; }
.udot  { display: inline-block; width: 7px; height: 7px; background: var(--acc); border-radius: 50%; margin-left: 5px; vertical-align: middle; }

/* ── SIGNUP MODAL ─────────────────────────────────────────── */
.su-box {
  background: var(--sur);
  border: 1px solid var(--bdr);
  border-radius: 22px;
  max-width: 370px; width: 100%;
  padding: 30px; text-align: center;
  position: relative;
  overflow: visible;
}
.su-ico { font-size: 50px; margin-bottom: 12px; }
.su-box h2 { font-size: 21px; font-weight: 900; margin-bottom: 7px; }
.su-box p  { color: var(--mut); font-size: 13px; line-height: 1.65; margin-bottom: 22px; }

.su-form    { display: flex; flex-direction: column; gap: 9px; text-align: left; }
.su-form input {
  background: var(--sur2);
  border: 1px solid var(--bdr);
  border-radius: 11px;
  padding: 12px 15px;
  color: var(--txt); font-size: 13.5px;
  outline: none; font-family: inherit;
  transition: border-color .15s; width: 100%;
}
.su-form input:focus        { border-color: #e01979; }
.su-form input::placeholder { color: var(--mut); }

.su-sub {
  padding: 13px; border: none; border-radius: 11px;
  background: linear-gradient(135deg, #e01979, #f472b6);
  color: #fff; font-weight: 800; font-size: 14px;
  cursor: pointer; margin-top: 3px; width: 100%;
  transition: opacity .15s;
}
.su-sub:hover { opacity: .9; }

/* Gender buttons */
.su-gender {
  flex: 1; padding: 10px 8px;
  background: rgba(255,255,255,0.05);
  border: 1.5px solid rgba(246,48,144,0.25);
  border-radius: 11px;
  color: #ffa3d0; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.su-gender:hover { border-color: #f63090; color: #fff; }
.su-gender.active {
  background: rgba(246,48,144,0.25);
  border-color: #f63090;
  color: #fff;
}

/* Age confirmation checkbox row */
.su-age-label {
  display: flex !important; align-items: flex-start;
  gap: 10px; padding: 11px 13px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px; cursor: pointer;
  font-size: 12.5px; color: #ffa3d0; line-height: 1.5;
}
.su-age-label input[type="checkbox"] {
  width: 16px !important; height: 16px !important;
  flex-shrink: 0; margin-top: 1px;
  accent-color: #f63090;
  padding: 0 !important; background: none !important;
  border: none !important;
}

/* Maybe later button */
.su-maybe {
  background: none; border: none;
  color: var(--mut); font-size: 12px;
  cursor: pointer; padding: 4px; width: 100%;
  margin-top: 2px; transition: color .15s;
}
.su-maybe:hover { color: var(--txt); }

.su-skip { color: var(--mut); font-size: 12px; margin-top: 11px; cursor: pointer; display: block; }
.su-skip:hover { color: var(--txt); }

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .chat-act { display: none; }
}
@media (max-width: 380px) {
  .su-box { padding: 18px; }
}

@media (max-width: 768px) {
  /* chat-wrap fills the fixed section as a flex column */
  .chat-wrap {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  /* chat-main: flex column so messages scroll and input stays at bottom */
  .chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
  }

  /* messages scrolls within its own area */
  #chat-msgs {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
  }

  /* FIX: position:sticky fails inside overflow:hidden parent.
     Using position:relative so it stays at bottom of flex column. */
  .cin-bar {
    position: relative !important;
    flex-shrink: 0;
    background: var(--sur);
    border-top: 1px solid var(--bdr);
    padding: 10px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 10;
  }

  /* Denser message bubbles on mobile — Matt/JP flagged, 2026-09-26 — so more
     of the conversation fits on a small screen without scrolling as much.
     Smaller font/padding/gaps, and bubbles can use more of the width since
     screens are already narrow (78% of a phone width wastes space). */
  #chat-msgs { gap: 7px; padding-top: 10px; padding-left: 10px; padding-right: 10px; }
  .msg { max-width: 88%; }
  .mbub { padding: 8px 12px; font-size: 12.5px; line-height: 1.4; border-radius: 15px; }
  .msg.them .mbub { border-radius: 15px 15px 15px 3px; }
  .msg.me   .mbub { border-radius: 15px 15px 3px 15px; }
}
@media (max-width: 400px) {
  /* Tighten the VIP attach buttons + send button so the text input
     keeps enough room to actually type on narrow phones. */
  .cin-bar { gap: 6px !important; }
  .cin-attach { width: 36px !important; height: 36px !important; font-size: 15px !important; }
  .csend { padding: 10px 12px !important; font-size: 12.5px !important; }
  .cin { padding: 10px 12px !important; font-size: 13px !important; }
  .gift-picker { left: 6px !important; bottom: 58px !important; }
}
/* ── Typing indicator dots ───────────────────────────── */
.typing-dot {
  display: inline-block;
  font-size: 10px;
  color: var(--muted, #888);
  animation: typingBounce 1.2s infinite ease-in-out;
  margin: 0 1px;
}
.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); opacity: 0.4; }
  30%            { transform: translateY(-4px); opacity: 1; }
}
