/* =======================================
   1) Base / Theme
======================================= */
:root {
  --bg: #0b0b0c;
  --panel: #141416;
  --panel-2: #0f0f11;
  --border: #242428;
  --text: #f1f1f1;
  --muted: #9aa0a6;

  /* Bubbles */
  --bot-bubble: linear-gradient(135deg, #fb18a6, #f3473f);
  --bot-text: #1a1a1a;
  --user-bubble: #ffffff;
  --user-text: #111214;

  /* Shadows */
  --bubble-shadow: 0 4px 10px rgba(0,0,0,0.25);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: linear-gradient(135deg, #2b2b2b, #131313);
  color: var(--text);
  min-height: 100vh;
}

/* =======================================
   2) Layout
======================================= */
.wrap { max-width: 780px; margin: 0 auto; padding: 24px; }
.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.28);
}

/* =======================================
   3) Header
======================================= */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pfp {
  width: 88px;
  height: 88px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 0%;
}

.title {
  font-size: 25px;
  font-weight: 700;         /* bolder for emphasis */
  color: #fff;
  letter-spacing: 0.3px;
}

.sub {
  font-size: 16px;
  color: var(--muted);
  font-style: italic;
}

.header-right .social-link {
  color: var(--text);
  transition: color 0.3s ease;
}
.header-right .social-link:hover { color: #fb18a6; } /* Instagram pink */

.header-right .icon {
  width: 28px;
  height: 28px;
  margin-left: 6px;
  margin-top: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mood-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid #2a2a3e;
  background: #15151f;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05);
}

.mood-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.mood-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.mood-btn:not(:disabled):hover {
  transform: translateY(-1px);
}
.mood-btn.active {
  background: rgba(251, 24, 166, 0.18);
  color: #ff9ddc;
}
body.mood-normal .mood-btn--normal.active {
  background: rgba(59, 130, 246, 0.22);
  color: #8ab4ff;
}
body.mood-flirty .mood-btn--flirty.active {
  background: rgba(251, 24, 166, 0.3);
  color: #ff9ddc;
}

/* =======================================
   4) Chat Log + Empty Overlay
======================================= */
.log {
  position: relative;                 /* for overlay positioning */
  height: 55vh;
  overflow: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: url("images/chat-bg.png") center center / cover no-repeat, var(--panel-2);
}

/* Empty state overlay (inside .log) */
.empty-overlay {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.35);
  z-index: 2;
  transition: opacity .4s ease, visibility .4s ease;
  opacity: 1;
  visibility: visible;
  pointer-events: none; /* never block input/clicks */
}
.empty-overlay.hide { opacity: 0; visibility: hidden; }

.empty-overlay img {
  width: 60%;
  max-width: 500px;
  height: auto;
}

/* =======================================
   5) Messages
======================================= */
/* Make each message row span the chat width */
.row {
  display: flex;
  gap: 10px;
  width: 100%;                 /* ← important */
}
.row.user { justify-content: flex-end; }
.row.bot  { align-items: center; }

/* Bot avatar */
.row.bot .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 40px;
  border: 2px solid transparent;
  transition: box-shadow 0.3s ease;
}

body.mood-normal .row.bot .avatar {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.85);
}

body.mood-flirty .row.bot .avatar {
  box-shadow: 0 0 0 3px rgba(251, 24, 166, 0.9);
}

body:not(.mood-normal):not(.mood-flirty) .row.bot .avatar {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.4;
  animation: typing-blink 1s infinite ease-in-out;
}
.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}
.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes typing-blink {
  0%, 100% {
    opacity: 0.2;
    transform: translateY(0);
  }
  50% {
    opacity: 0.9;
    transform: translateY(-2px);
  }
}

/* Bubble + timestamp container */
.bubble-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;                 /* ← fill row */
  flex: 1 1 0;                 /* ← allow to grow */
}
.row.user { justify-content: flex-end; }
.row.user .bubble-wrapper { align-items: flex-end; }

/* Bubble common */
.msg {
  padding: 12px 16px;
  border-radius: 9999px;
  line-height: 1.45;
  font-size: 15px;
  box-shadow: var(--bubble-shadow);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;

  max-width: 80%;              /* ← was 75%; now relative to full row */
  min-width: 64px;
}

/* Bot bubble */
.row.bot .msg {
  background: var(--bot-bubble);
  color: var(--bot-text);
   border-radius: 16px 16px 16px 4px;
}

/* User bubble */
.row.user .msg {
  background: var(--user-bubble);
  color: var(--user-text);
  border-radius: 16px 16px 4px 16px;
}

/* Safety override (legacy classes) */
.msg.user, .msg.bot { background: transparent; color: inherit; }

/* Timestamp */
.timestamp {
  font-size: 11px;
  color: #fff;
  margin-top: 4px;
  padding: 0 4px;
}

/* =======================================
   6) Input + Send
======================================= */
form { margin-top: 12px; display: flex; gap: 8px; }
input, button {
  font-size: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #131317;
  color: var(--text);
}
input { flex: 1; }
button { cursor: pointer; }

.send-btn {
  background: #d6189e;
  color: white;
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s ease;
}
.send-btn:hover { background: #ff8fb5; }
.send-icon {
  width: 22px;
  height: 22px;
  pointer-events: none;
}

/* Hint */
.small { color: var(--muted); margin-top: 6px; }
#hintRotator { 
  font-size: 15px; 
  font-weight: 500; 
  color: #cfcfcf; 
  transition: opacity 0.8s ease; 
}
#hintRotator.hint-fade-out { opacity: 0; }
#hintRotator.hint-fade-in  { opacity: 1; }
#hintRotator.hint-clickable { cursor: pointer; text-decoration: none; } /* no underline */

/* =======================================
   7) Footer / Disclaimer
======================================= */
.disclaimer {
  max-width: 780px;
  margin: 12px auto 24px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  line-height: 1.4;
}

.footer {
  max-width: 780px;
  margin: 20px auto 40px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
.footer-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.footer-logo {
  max-height: 80px;
  width: auto;
  opacity: 0.9;
}
.footer .version {
  font-weight: 500;
  font-size: 12px;
  color: #bbb;
}
.footer-bottom a { color: #92b4ff; text-decoration: none; }
.footer-bottom a:hover { text-decoration: underline; }

/* =======================================
   8) Responsive
======================================= */
@media (max-width: 520px) {
  .wrap { padding: 16px; }
  .log  { height: 60vh; }
  .pfp { width: 64px; height: 64px; }
  .title { font-size: 22px; }
  .sub { font-size: 14px; }
}
/* Chat image attachments */
.msg.has-image {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  border-radius: 20px;
}
.msg-text {
  display: block;
}
.msg-text a {
  color: #8ab4ff;
  text-decoration: none;
  word-break: break-word;
}
.msg-text a:hover {
  text-decoration: underline;
}
.row.bot .msg-text {
  font-weight: 600;
}
.msg-image {
  width: 220px;
  max-width: min(100%, 320px);
  border-radius: 12px;
  box-shadow: var(--bubble-shadow);
  object-fit: cover;
  cursor: pointer;
}
.image-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  padding: 24px;
}
.image-modal.open {
  display: flex;
}
.image-modal img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
.image-modal-close {
  position: absolute;
  top: 18px;
  right: 24px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.image-modal-close:hover {
  background: rgba(0, 0, 0, 0.8);
}
