/* Chat immersiva (da "Chat v2.dc.html") — lista chat | ritratto+galleria | conversazione */

.chat-shell { display: flex; height: 100vh; height: 100dvh; background: var(--bg); color: var(--text);
  font-family: var(--sans); overflow: hidden; position: relative; }

/* ---------- colonna "le tue chat" (una per ragazza) ---------- */
.chat-list { width: 270px; flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--bg-alt); border-inline-end: 1px solid var(--line); }
.chat-list .cl-head { padding: 20px 18px 12px; font-family: var(--serif); font-size: 24px;
  font-weight: 600; color: var(--text); }
.chat-list .cl-items { flex: 1; overflow-y: auto; padding: 0 10px; display: flex;
  flex-direction: column; gap: 4px; }
.cl-item { display: flex; align-items: center; gap: 11px; padding: 10px 10px;
  border-radius: 14px; border: 1px solid transparent; }
.cl-item:hover { background: rgba(255,255,255,.04); }
.cl-item.active { background: rgba(224,90,134,.1); border-color: rgba(224,90,134,.35); }
/* riga = link chat + pulsante elimina (compare al passaggio del mouse) */
.cl-row { position: relative; }
.cl-row .cl-item { padding-inline-end: 34px; }
.cl-del { position: absolute; top: 50%; inset-inline-end: 8px; transform: translateY(-50%);
  width: 28px; height: 28px; border-radius: 8px; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; line-height: 1; font-size: 13px;
  background: rgba(0,0,0,.3); color: var(--dim); opacity: 0;
  transition: opacity .15s ease, background .15s ease, color .15s ease; }
.cl-row:hover .cl-del, .cl-del:focus-visible { opacity: 1; }
.cl-del:hover { background: rgba(224,90,134,.85); color: #fff; }
.cl-del:disabled { opacity: .4; cursor: default; }
.cl-ava { width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0; display: flex;
  align-items: center; justify-content: center; font-family: var(--serif); font-style: italic;
  font-size: 20px; color: rgba(255,255,255,.85);
  background: linear-gradient(135deg, #8a2f57, #3d1430); border: 1px solid rgba(255,255,255,.12); }
.cl-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cl-meta .n { font-family: var(--serif); font-size: 17px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-meta .p { font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.cl-item.active .cl-meta .p { color: var(--muted); }
.cl-new { margin: 10px 14px 16px; padding: 11px 0; text-align: center; border-radius: 999px;
  border: 1px dashed rgba(224,90,134,.45); color: var(--pink); font-size: 13.5px; }
.cl-new:hover { background: rgba(224,90,134,.08); }

/* ---------- galleria del ritratto (frecce + puntini) ---------- */
.gal-arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25);
  background: rgba(20,11,17,.5); color: #fff; font-size: 22px; line-height: 1; cursor: pointer;
  backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center;
  opacity: .75; transition: opacity .2s ease, border-color .2s ease; }
.gal-arrow:hover { opacity: 1; border-color: var(--pink); }
.gal-arrow.prev { left: 14px; }
.gal-arrow.next { right: 14px; }
.gal-dots { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); z-index: 3;
  display: flex; gap: 7px; padding: 7px 12px; border-radius: 999px;
  background: rgba(20,11,17,.45); backdrop-filter: blur(4px); }
.gal-dots span { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.35);
  transition: background .2s ease; }
.gal-dots span.on { background: var(--pink); }

/* pannello ritratto (sinistra) */
.chat-panel { width: 42%; min-width: 380px; position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end; }
.chat-panel .portrait-bg { position: absolute; inset: 0; transition: background .6s ease; }
/* NESSUN velo sulla foto: resta pulita e luminosa. L'unica ombra è una strisciolina
   in alto dietro al logo (che sulle foto chiare sparirebbe); la leggibilità del testo
   la garantisce il gradiente dedicato del blocco .info qui sotto. */
.chat-panel .portrait-shade { position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(20,11,17,.5) 0%, transparent 16%); }
.chat-panel .portrait-initial { position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; }
.chat-panel .portrait-initial span { font-family: var(--serif); font-style: italic; font-size: 220px;
  font-weight: 500; color: rgba(255,255,255,.16); animation: glow 5s ease infinite; }
@keyframes glow { 0%,100% { opacity: .5; } 50% { opacity: .9; } }
/* Gradiente DEDICATO dietro al testo (l'UNICO sulla foto): parte trasparente ben sopra
   il nome e si scurisce scendendo, così nome/bio/legame/disclaimer restano leggibili
   su qualunque foto, e il resto dell'immagine resta senza veli. */
.chat-panel .info { position: relative; padding: 110px 30px 30px; display: flex;
  flex-direction: column; gap: 14px;
  background: linear-gradient(180deg, transparent 0%, rgba(20,11,17,.55) 26%,
              rgba(20,11,17,.86) 55%, rgba(20,11,17,.96) 100%);
  text-shadow: 0 1px 10px rgba(0,0,0,.5); }
.chat-panel .info .who { font-family: var(--serif); font-size: 44px; font-weight: 600; line-height: 1;
  text-shadow: 0 2px 14px rgba(0,0,0,.6); }
.chat-panel .info .mood { font-size: 13.5px; color: var(--green); margin-top: 6px; }
.chat-panel .info .bio { font-size: 14px; color: #d9cbd4; line-height: 1.55; max-width: 400px; }
.chat-panel .home-logo { position: absolute; top: 24px; left: 30px; z-index: 2; }
.bond-label { font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--dim); margin-bottom: 5px; }
.bond-bar { height: 5px; background: rgba(255,255,255,.12); border-radius: 3px; overflow: hidden; }
/* Misuratore di COINVOLGIMENTO: la barra è SEMPRE piena (100%). È il GRADIENTE (costruito via JS)
   a raccontare l'HOT: la scala [0..HOT] azzurro -> verde -> giallo -> arancio -> rosso viene
   ridistribuita su tutta la larghezza. HOT 0 = azzurro pieno (fallback qui sotto). */
.bond-bar .fill { width: 100%; height: 100%; border-radius: 3px; background: #35b8f0; }
/* voto alla compagna: 5 cuori selezionabili (come le stelline delle recensioni) */
.rate-box { display: flex; flex-direction: column; gap: 4px; margin-inline-start: auto; }
.rate-lbl { font-size: 12px; color: var(--dim); }
.rate-hearts { display: inline-flex; gap: 2px; }
.rate-h { background: transparent; border: 0; cursor: pointer; padding: 0 1px; line-height: 1;
  font-size: 19px; color: rgba(255,255,255,.22); transition: color .12s ease, transform .12s ease; }
.rate-h.on { color: var(--pink, #e05a86); }
.rate-h:hover { transform: scale(1.12); }
.profile-link { padding: 9px 18px; border: 1px solid rgba(255,255,255,.25); border-radius: 999px;
  color: var(--text); font-size: 13px; backdrop-filter: blur(4px); }
.profile-link:hover { border-color: var(--pink); color: var(--pink); }
.panel-close { display: none; position: absolute; top: 18px; right: 18px; z-index: 3; width: 38px;
  height: 38px; border-radius: 50%; background: rgba(20,11,17,.55); border: 1px solid rgba(255,255,255,.2);
  color: var(--text); font-size: 16px; cursor: pointer; backdrop-filter: blur(4px); }

/* colonna chat (destra) */
.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0;
  border-inline-start: 1px solid var(--line); }
.chat-head { position: relative; z-index: 20; padding: 12px clamp(14px, 3vw, 28px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center;
  justify-content: space-between; gap: 12px; }
.chat-identity { display: flex; align-items: center; gap: 10px; background: transparent; border: 0;
  padding: 4px 6px 4px 2px; border-radius: 12px; font-family: var(--sans); cursor: default; }
.chat-identity .name { font-family: var(--serif); font-size: 21px; font-weight: 600; line-height: 1; color: var(--text); text-align: start; }
.chat-identity .sub { font-size: 11.5px; color: var(--green); margin-top: 2px; text-align: start; }
/* bottone "Le tue chat" nell'header: invisibile su desktop (la colonna è sempre lì),
   compare sotto i 1100px per aprire la colonna come cassetto */
.list-btn { display: none; width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  cursor: pointer; align-items: center; justify-content: center; font-size: 15px; line-height: 1;
  background: rgba(255,255,255,.06); border: 1px solid var(--line-2, rgba(255,255,255,.12));
  transition: background .15s ease, border-color .15s ease; }
.list-btn:hover { background: rgba(224,90,134,.2); border-color: rgba(224,90,134,.5); }
/* pulsante elimina chat: flotta in basso a destra dell'area messaggi, ancorato al
   composer-wrap (position:relative) così segue il bordo anche quando compare il
   suggeritore. Attenuato di suo, pieno al passaggio. */
.head-del { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 15px; line-height: 1;
  background: rgba(255,255,255,.06); border: 1px solid var(--line-2, rgba(255,255,255,.12));
  color: var(--dim, #9c8391); transition: background .15s ease, color .15s ease, border-color .15s ease; }
.head-del:hover { background: rgba(224,90,134,.85); color: #fff; border-color: transparent; }
.head-del:disabled { opacity: .4; cursor: default; }
.del-float { position: absolute; top: -46px; inset-inline-end: 14px; z-index: 5;
  opacity: .65; backdrop-filter: blur(4px); background: rgba(20,11,17,.55); }
.del-float:hover { opacity: 1; }
.head-avatar { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-family: var(--serif); font-style: italic; font-weight: 600;
  color: rgba(255,255,255,.9); font-size: 17px; }
.tokens-label { font-size: 13px; color: var(--gold); white-space: nowrap; }
.gift-btn { width: 34px; height: 34px; border-radius: 50%; background: rgba(212,165,99,.1);
  border: 1px solid rgba(212,165,99,.4); font-size: 15px; cursor: pointer; display: flex;
  align-items: center; justify-content: center; }
.gift-btn:hover { background: rgba(212,165,99,.2); }
.gift-btn:disabled { opacity: .4; cursor: default; }
.gift-btn:disabled:hover { background: rgba(212,165,99,.1); }
.account-btn { width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #3a2331, #241520); border: 1px solid rgba(255,255,255,.12);
  display: flex; align-items: center; justify-content: center; color: var(--gold);
  font-family: var(--serif); font-size: 16px; font-weight: 600; }

/* dropdown regali (mock visivo, D4 roadmap) */
.gift-pop { position: absolute; top: calc(100% + 10px); right: clamp(14px, 3vw, 28px);
  width: min(360px, calc(100vw - 28px)); padding: 16px; background: var(--panel-2);
  border: 1px solid rgba(212,165,99,.3); border-radius: 16px; animation: popIn .2s ease;
  box-shadow: 0 20px 50px rgba(0,0,0,.5); z-index: 30; }
.gift-pop .head-row { display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 12px; gap: 12px; }
.gift-pop .label { font-size: 11px; letter-spacing: 2.5px; text-transform: uppercase; color: var(--dim); }
.gift-pop .more { font-size: 12.5px; color: var(--gold); white-space: nowrap; }
.gift-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.gift-item { padding: 12px 4px; background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px; cursor: pointer; display: flex; flex-direction: column; align-items: center;
  gap: 5px; color: var(--text); font-family: var(--sans); }
.gift-item:hover { border-color: rgba(212,165,99,.5); background: rgba(212,165,99,.06); }
.gift-item .ico { font-size: 21px; }
.gift-item .lbl { font-size: 11px; color: var(--dim); }
.gift-item .cost { font-size: 11px; color: var(--gold); }

/* area messaggi */
.chat-scroll { flex: 1; overflow-y: auto;
  padding: clamp(16px, 4vw, 28px) clamp(14px, 4vw, 32px) 12px;
  display: flex; flex-direction: column; gap: 14px;
  background: radial-gradient(ellipse 80% 60% at 30% 0%, rgba(224,90,134,.05), transparent), var(--bg); }
.day-chip { align-self: center; padding: 6px 18px; border-radius: 999px;
  background: rgba(255,255,255,.04); font-size: 12px; color: var(--dim); letter-spacing: 1px; }
.chat-scroll .bubble-her, .chat-scroll .bubble-me { padding: 13px 18px; font-size: 16px; line-height: 1.55; }
.chat-scroll .bubble-her { border-radius: 18px 18px 18px 4px; }
.chat-scroll .bubble-me  { border-radius: 18px 18px 4px 18px; }
/* Foto su misura consegnata in chat (role 'photo'): media dentro la bolla di lei */
.bubble-photo { padding: 6px; }
.bubble-photo img, .bubble-photo video { display: block; max-width: min(320px, 62vw);
  max-height: 420px; border-radius: 14px; cursor: pointer; }
/* messaggi consecutivi della ragazza: distanza dimezzata (restano un gruppetto, ma piu vicini) */
.chat-scroll .msg-row:not(.me) + .msg-row:not(.me) { margin-top: -7px; }
.typing-dots { padding: 14px 18px; background: var(--panel-2); border-radius: 18px 18px 18px 4px;
  display: flex; gap: 5px; align-items: center; }
.typing-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--pink);
  animation: typingDot 1.2s infinite; }
.typing-dots i:nth-child(2) { animation-delay: .2s; }
.typing-dots i:nth-child(3) { animation-delay: .4s; }

/* composer */
.composer-wrap { position: relative; border-top: 1px solid var(--line); background: var(--bg-alt); }
.suggestion-row { padding: 12px clamp(14px, 4vw, 32px) 0; }
.suggestion-box { width: 100%; text-align: start; padding: 12px 18px; background: rgba(212,165,99,.08);
  border: 1px dashed rgba(212,165,99,.4); border-radius: 14px; color: var(--gold);
  font-family: var(--sans); font-size: 14px; font-style: italic; cursor: pointer; animation: popIn .2s ease; }
.suggestion-box:hover { background: rgba(212,165,99,.14); }
.suggestion-box.loading { cursor: default; }
.composer { padding: 12px clamp(14px, 4vw, 32px) clamp(14px, 3vw, 22px);
  display: flex; gap: 8px; align-items: center; }
.bulb-btn { flex-shrink: 0; width: 48px; height: 48px; border-radius: 50%;
  background: rgba(212,165,99,.14); border: 1px solid rgba(212,165,99,.4); font-size: 19px;
  cursor: pointer; display: flex; align-items: center; justify-content: center; }
.bulb-btn:hover { background: rgba(212,165,99,.24); }
.bulb-btn:disabled { opacity: .5; cursor: default; }
.chat-input { flex: 1; min-width: 0; padding: 13px 20px; background: var(--panel-2);
  border: 1px solid rgba(255,255,255,.08); border-radius: 999px; color: var(--text);
  font-family: var(--sans); font-size: 16px; outline: none; }
.chat-input:focus { border-color: rgba(224,90,134,.5); }
.send-btn { flex-shrink: 0; width: 48px; height: 48px; border-radius: 50%; background: var(--grad);
  border: 0; color: #fff; font-size: 18px; cursor: pointer; box-shadow: 0 4px 16px rgba(224,90,134,.35); }
.send-btn:hover { filter: brightness(1.1); }
.send-btn:disabled { opacity: .5; }

/* schermi stretti: la lista chat diventa un CASSETTO fuori schermo, aperto dal
   bottone 💬 dell'header; il backdrop (condiviso col pannello ritratto) la richiude */
@media (max-width: 1100px) {
  .chat-list { position: fixed; top: 0; left: 0; bottom: 0; width: min(86vw, 320px);
    z-index: 100; transform: translateX(-105%); transition: transform .3s ease;
    box-shadow: 30px 0 80px rgba(0,0,0,.5); }
  .chat-shell.list-open .chat-list { transform: translateX(0); }
  .chat-shell.list-open .chat-backdrop { display: block; }
  .list-btn { display: flex; }
  /* al tocco non c'è hover: il cestino di ogni riga resta sempre visibile */
  .cl-del { opacity: 1; }
}

/* mobile: pannello a cassetto */
.chat-backdrop { display: none; position: fixed; inset: 0; background: rgba(10,5,8,.6);
  backdrop-filter: blur(3px); z-index: 90; }
@media (max-width: 760px) {
  .chat-panel { position: fixed; top: 0; left: 0; bottom: 0; width: min(86vw, 380px); z-index: 100;
    transform: translateX(-105%); transition: transform .3s ease;
    box-shadow: 30px 0 80px rgba(0,0,0,.5); min-width: 0; }
  .chat-shell.panel-open .chat-panel { transform: translateX(0); }
  .chat-shell.panel-open .chat-backdrop { display: block; }
  .panel-close { display: block; }
  .chat-identity { cursor: pointer; }

  /* CHAT MOBILE — ripensata: la colonna chat è ANCORATA al viewport con position:fixed
     e inset:0. Così l'altezza è SEMPRE quella dello schermo (top+bottom fissati, niente
     dipendenza da 100vh/100dvh che spingeva il composer fuori vista). Dentro, un flex
     column: header fisso in alto, messaggi che scorrono, composer fisso in fondo. */
  .chat-main { position: fixed; inset: 0; z-index: 10; border-inline-start: 0;
    display: flex; flex-direction: column; }
  .chat-head    { flex: 0 0 auto; }                                   /* in alto, non si comprime */
  .chat-scroll  { flex: 1 1 auto; min-height: 0; overflow-y: auto; }  /* al centro, l'unica parte che scorre */
  .composer-wrap { flex: 0 0 auto; position: relative;
    padding-bottom: env(safe-area-inset-bottom); }  /* in fondo; relative: ancora il cestino flottante */
  .composer { padding-top: 10px; padding-bottom: 10px; }

  /* il pannello ritratto (cassetto) e i modali devono stare SOPRA la colonna chat fissa */
  .chat-panel { z-index: 100; }
  .limit-modal { z-index: 200; }
}

/* ══════════ Modale limite messaggi (prova ospite / cap giornaliero) ══════════ */
.limit-modal {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 4, 8, 0.72); backdrop-filter: blur(4px);
  padding: 20px;
}
.limit-modal .lm-card {
  position: relative;
  background: var(--bg-alt, #1a0f16);
  border: 1px solid var(--line-2, rgba(255,255,255,0.09));
  border-radius: 20px;
  padding: 38px 34px 32px;
  max-width: 420px; width: 100%;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0,0,0,0.55);
}
.limit-modal .lm-emoji { font-size: 40px; margin-bottom: 10px; }
.limit-modal .lm-title { font-family: var(--serif); font-size: 27px; margin: 0 0 10px; color: var(--ink, #f4e9ef); }
.limit-modal .lm-text  { font-size: 14.5px; line-height: 1.55; color: var(--dim, #9c8391); margin: 0 0 24px; }
.limit-modal .lm-actions { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.limit-modal .lm-actions .btn-primary { width: 100%; justify-content: center; text-align: center; cursor: pointer; }
.limit-modal .lm-actions button.btn-primary { border: 0; font: inherit; }
/* conferma distruttiva (elimina chat) + annulla secondario */
.limit-modal .lm-actions .lm-danger { background: linear-gradient(135deg, #d94a4a, #a92727); }
.limit-modal .lm-actions .lm-cancel { width: 100%; padding: 12px 0; border-radius: 999px; cursor: pointer;
  font: inherit; text-align: center; background: transparent;
  border: 1px solid var(--line-2, rgba(255,255,255,0.12)); color: var(--dim, #9c8391); }
.limit-modal .lm-actions .lm-cancel:hover { color: var(--ink, #f4e9ef); border-color: rgba(255,255,255,0.25); }
.limit-modal .lm-close {
  position: absolute; top: 12px; right: 14px;
  background: transparent; border: 0; color: var(--dim, #9c8391);
  font-size: 16px; cursor: pointer; padding: 6px;
}
.limit-modal .lm-close:hover { color: var(--ink, #f4e9ef); }
