.messages-card,
.chat-card {
  background: rgba(255, 255, 255, 0.98);
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  padding: 0.9rem 1.1rem; /* KEVESEBB belső tér → alacsonyabb kártya */
  width: 100%;
  max-width: 650px;
  margin: 0.75rem auto; /* KEVESEBB hely fölötte/alatta */
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

/* === Messages / Conversations list === */
.conv-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.conv-item {
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  background: #ffffff;
  overflow: hidden;
}

.conv-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 0.9rem;
  transition: background 120ms ease, transform 120ms ease;
}

.conv-link:hover {
  background: #f8fafc;
  text-decoration: none;
}

.conv-link:hover * {
  text-decoration: none;
}

.conv-avatar {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid #e5e7eb;
}

.conv-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.conv-main {
  flex: 1;
  min-width: 0;
}

.conv-name {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-snippet {
  font-size: 0.85rem;
  color: #6b7280;
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-time {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-left: 0.5rem;
  text-align: right;
  flex-shrink: 0;
  white-space: nowrap;
}

.conv-time {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  justify-content: flex-end;
}

.conv-unread {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent-strong);
  flex-shrink: 0;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Olvasatlan beszélgetés kiemelése */
.conv-link.is-unread {
  background: var(--accent-soft);
}

.conv-link.is-unread .conv-name {
  font-weight: 800;
}

.conv-link.is-unread .conv-snippet {
  font-weight: 600;
  color: #374151;
}

/* === Chat modern buborékok === */

.chat-messages {
  max-height: 260px; /* EZ SZABJA MEG, MENNYIRE LEGYEN MAGAS A CHAT RÉSZ */
  min-height: 180px; /* ne essen össze túl kicsire, ha kevés üzenet van */
  overflow-y: auto;
  padding: 0.6rem 0.6rem 0.4rem;
  background: #f3f4f6;
  border-radius: 0.9rem;
  border: 1px solid #e5e7eb;
}

/* sorok igazítása */
.chat-row {
  display: flex;
  margin-bottom: 0.6rem;
}

.chat-row--other {
  justify-content: flex-start;
}

.chat-row--mine {
  justify-content: flex-end;
}

/* buborék + idő együtt, max 80% szélesség */
.chat-bubble-wrapper {
  max-width: 100%;
  display: flex;
  flex-direction: column;
}

/* ALAP buborék – farok nélkül */
.chat-bubble {
  padding: 0.4rem 0.9rem;
  border-radius: 18px;
  font-size: 0.9rem;
  line-height: 1.45;
  word-wrap: break-word;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.14);
}

/* Másik fél – világos, jól látható */
.chat-bubble--other {
  background: #ffffff;
  color: #111827;
  border: 1px solid #e5e7eb;
}

/* Saját – InLove gradiens, erős kontraszt */
.chat-bubble--mine {
  background: linear-gradient(135deg, #ec4899, #db2777);
  color: #fdf2f8;
  border: none;
}

/* Idő a buborék alatt */
.chat-meta {
  font-size: 0.7rem;
  color: #9ca3af;
  margin-top: 0.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
}

.chat-meta-text {
  white-space: nowrap;
}

/* Bal oldali üzeneteknél a szöveg legyen balról */
.chat-row--other .chat-meta {
  justify-content: flex-start;
}

/* Saját üzeneteknél a szöveg + pipák húzódjanak jobbra */
.chat-row--mine .chat-meta {
  justify-content: flex-end;
}

/* Pipák stílusa */
.chat-ticks {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
}

/* Elküldve – halványabb */
.chat-ticks--sent {
  color: #9ca3af;
}

/* Elolvasva – kiemelve InLove akcentussal */
.chat-ticks--read {
  color: var(--accent-strong);
}

/* === Chat buborék animációk – csak az utolsó buborékra === */

@keyframes chat-in-left {
  0% {
    opacity: 0;
    transform: translateX(-32px) translateY(8px) scale(0.9);
  }
  60% {
    opacity: 1;
    transform: translateX(4px) translateY(0) scale(1.03);
  }
  100% {
    opacity: 1;
    transform: translateX(0) translateY(0) scale(1);
  }
}

@keyframes chat-in-right {
  0% {
    opacity: 0;
    transform: translateX(32px) translateY(8px) scale(0.9);
  }
  60% {
    opacity: 1;
    transform: translateX(-4px) translateY(0) scale(1.03);
  }
  100% {
    opacity: 1;
    transform: translateX(0) translateY(0) scale(1);
  }
}

/* balról beúszás (másik fél) */
.chat-bubble--animate-left {
  animation: chat-in-left 0.32s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

/* jobbról beúszás (te) */
.chat-bubble--animate-right {
  animation: chat-in-right 0.32s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

/* === Chat – üzenet input + emoji picker === */

.chat-input-wrapper {
  position: relative;
  margin-top: 0.35rem;
}

.chat-input-row {
  display: flex;
  align-items: center; /* ikon + emoji + textarea egy vonalban */
  gap: 0.5rem;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem; /* nem óriás kapszula */
  padding: 0.4rem 0.6rem;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.05);
}

.chat-textarea {
  border: none;
  outline: none;
  resize: none;
  width: 100%;
  min-height: 2.4rem;
  max-height: 7rem;
  padding: 0.35rem 0.2rem;
  font-size: 0.8rem;
  line-height: 1.4;
  background: transparent;
}

.chat-textarea:focus {
  outline: none;
  box-shadow: none;
}

/* Emoji gomb a textarea mellett */
.emoji-button {
  flex: 0 0 auto;
  border: none;
  background: var(--accent-soft);
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.08s ease, box-shadow 0.15s ease;
}

.emoji-button:hover {
  background: var(--accent);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(236, 72, 153, 0.35);
}

.emoji-button:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.15);
}

/* Lebegő emoji-ablak (nem nyomja le az inputot, hanem fölé „úszik”) */
.emoji-picker {
  position: absolute;
  bottom: 110%;

  /* KÖZÉPRE igazítás a chat-input fölött */
  left: 50%;
  transform: translateX(-50%);

  width: 420px;
  max-width: min(420px, calc(100vw - 3rem));
  padding: 0.6rem;
  border-radius: 0.75rem;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: none;
  overflow-y: visible;

  /* ha akarod, ezt is igazíthatod középre, de nem kötelező */
  transform-origin: bottom center;

  animation: emoji-pop 0.12s ease-out;
  z-index: 30;
}

.emoji-picker[hidden] {
  display: none;
}

/* Egyes emoji gombok */
.emoji-item {
  border: none;
  background: transparent;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.65rem;
  font-size: 1.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.08s ease, box-shadow 0.12s ease;
}

.emoji-item:hover {
  background: var(--accent-soft);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.12);
}

.emoji-item:active {
  transform: translateY(0);
  box-shadow: 0 3px 7px rgba(15, 23, 42, 0.2);
}

/* Finom felugró animáció az ablakra */
@keyframes emoji-pop {
  from {
    opacity: 0;
    transform: translateX(-50%) scale(0.96) translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) scale(1) translateY(0);
  }
}

/* Mobilon teljes szélesség-közeli, ne lógjon ki, ne legyen pici */
@media (max-width: 640px) {
  .emoji-picker {
    bottom: 115%;
    right: auto;
    left: 50%;
    transform: translateX(-50%);

    /* majdnem teljes képernyő szélesség, de maradjon egy kis margó */
    width: calc(100vw - 1.8rem);
    max-width: calc(100vw - 1.8rem);

    /* ha valakinek brutál nagy betűméret van beállítva, itt engedünk kis scrollt */
    max-height: 260px;
    overflow-y: auto;
  }

  /* mobilon kicsit kisebb emojik, hogy több férjen egy sorba */
  .emoji-item {
    width: 2rem;
    height: 2rem;
    font-size: 1.2rem;
  }

  .emoji-tabs {
    gap: 0.25rem;
  }

  .emoji-tab {
    padding: 0.2rem 0.35rem;
    font-size: 0.75rem;
  }
}

/* Mobilon ne zoomoljon rá az inputra – legyen min. 16px a betű */
@media (max-width: 640px) {
  .chat-textarea {
    font-size: 1rem;   /* kb. 16px */
    line-height: 1.5;  /* kicsit szellősebb, könnyebb gépelni */
  }
}

/* === Emoji-only üzenetek – buborék nélkül === */

.chat-emoji-only {
  display: inline-block;
  font-size: 2rem;
  line-height: 1.2;
  padding: 0.1rem 0.15rem;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.chat-row--mine .chat-emoji-only {
  text-align: right;
}

.chat-row--other .chat-emoji-only {
  text-align: left;
}

/* === Emoji picker fülek (kategóriák) === */

.emoji-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}

.emoji-tab {
  flex: 1 1 auto;
  border: none;
  background: #f3f4f6;
  border-radius: 999px;
  padding: 0.25rem 0.45rem;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease,
    transform 0.08s ease;
}

.emoji-tab-icon {
  font-size: 1rem;
}

.emoji-tab-label {
  font-size: 0.78rem;
}

.emoji-tab--active {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(236, 72, 153, 0.4);
  transform: translateY(-1px);
}

.emoji-tab:not(.emoji-tab--active):hover {
  background: #e5e7eb;
}

/* A kategóriák közül csak az aktív látszódjon */

.emoji-category {
  display: none;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.emoji-category--active {
  display: flex;
}

/* === „... gépel” státusz – animált pöttyökkel === */

.chat-typing-indicator {
  margin-top: 0.3rem;
  margin-bottom: 0.4rem;
  font-size: 0.8rem;
  color: #6b7280;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.chat-typing-name {
  font-weight: 500;
}

.chat-typing-text {
  opacity: 0.9;
}

/* három ugráló pötty */
.chat-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 0.18rem;
}

.chat-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  opacity: 0.6;
  animation: typing-dot 1s infinite ease-in-out;
}

/* kis fáziseltolás, hogy szépen hullámozzon */
.chat-typing-dots span:nth-child(1) {
  animation-delay: 0s;
}
.chat-typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}
.chat-typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

/* animáció: fel-le, halványabb-erősebb */
@keyframes typing-dot {
  0% {
    transform: translateY(0);
    opacity: 0.4;
  }
  40% {
    transform: translateY(-2px);
    opacity: 1;
  }
  80% {
    transform: translateY(0);
    opacity: 0.5;
  }
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
}

/* elrejtve: hidden attribútumra figyel */
.chat-typing-indicator[hidden] {
  display: none;
}

.conv-item {
  display: flex;
  align-items: stretch;
  overflow: visible;
}
.conv-link {
  flex: 1;
}

.conv-menu {
  position: relative;
  display: flex;
  align-items: center;
  padding-right: 0.35rem;
}
.conv-menu-btn {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0.32rem 0.45rem;
  border-radius: 0.55rem;
  color: rgba(15, 23, 42, 0.55);
  font-size: 1.15rem;
  line-height: 1;
}
.conv-menu-btn:hover {
  background: rgba(15, 23, 42, 0.06);
  color: rgba(15, 23, 42, 0.9);
}

/* Beszélgetés menü – „profile menu” stílus */
/* Beszélgetés menü – letisztult dropdown */
.conv-menu-pop {
  position: absolute;
  right: 0.35rem;
  top: calc(100% + 0.4rem);
  background: #ffffff;
  z-index: 50;
  border-radius: 0.75rem;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.18);
  padding: 0.25rem 0;
  min-width: 180px;
}

/* Alap menüelem (span) */
.conv-menu-pop .conv-menu-item {
  display: block;
  width: 100%;
  padding: 0.55rem 0.95rem; /* kicsit több tér a szöveg körül */
  text-align: left;
  border: none;
  background: transparent;
  font-size: 0.85rem; /* picit kisebb betű */
  font-weight: 500;
  line-height: 1.4; /* szellősebb sorok */
  letter-spacing: 0.01em; /* minimális betűköz */
  cursor: pointer;
  color: #111827;
}

/* Hover háttér */
.conv-menu-pop .conv-menu-item:hover {
  background: #f9fafb;
}

/* Veszélyes (törlés) elem – piros szöveg */
.conv-menu-pop .conv-menu-item--danger {
  color: #b91c1c;
}

.conv-menu-pop .conv-menu-item--danger:hover {
  background: rgba(185, 28, 28, 0.05);
}

.messages-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

/* Cím + avatar egységesen, ne inline style-ból */
.messages-card-header .settings-card-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.1rem;
}

/* Chat avatar */
.chat-partner-avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid #e5e7eb;
}

/* Elegáns, ghost-style close gomb */
.chat-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: none;
  background: transparent;
  text-decoration: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted, #6b7280);
  transition: background 140ms ease, color 140ms ease, transform 120ms ease;
}

.chat-close-btn:hover {
  background: var(--accent-soft, rgba(236, 72, 153, 0.12));
  color: var(--accent-strong, #db2777);
  transform: translateY(-1px);
}

.messages-card .chat-close-btn,
.messages-card .chat-close-btn:visited,
.messages-card .chat-close-btn:hover,
.messages-card .chat-close-btn:focus {
  text-decoration: none;
}

/* Fotó ikon gomb – Messenger-szerű kerek ikon */
.chat-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: none;
  background: var(--accent-soft, rgba(236, 72, 153, 0.12));
  color: var(--accent, #ec4899);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background 140ms ease, color 140ms ease, transform 120ms ease;
}

.chat-icon-btn:hover {
  background: var(--accent, #ec4899);
  color: #ffffff;
  transform: translateY(-1px);
}

.chat-icon-svg {
  display: block;
}

/* A natív file input teljesen rejtve – EGYETLEN definíció maradjon */
.chat-attach-input {
  display: none;
}

/* Chat képek – nem buborék, külön kártya, Messenger-szerű */
.chat-image {
  max-width: 65%;
  border-radius: 0.9rem;
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.28);
  margin-bottom: 0.25rem;
}

/* Saját képek jobbra húzva */
.chat-row--mine .chat-image {
  margin-left: auto;
}

/* Másik fél képei balra húzva */
.chat-row--other .chat-image {
  margin-right: auto;
}

.chat-image img {
  display: block;
  width: 100%;
  height: auto;
}

/* Chat – csatolt kép előnézet a szövegmező alatt */
.chat-image-preview {
  position: relative;
  display: inline-block;
  margin-top: 0.45rem;
  max-width: 180px;
  border-radius: 12px;
  overflow: hidden; /* a gomb és a kép ne lógjon ki */
}

.chat-image-preview[hidden] {
  display: none;
}

.chat-image-preview-img {
  display: block;
  max-width: 150px;
  max-height: 150px;
  width: auto;
  height: auto;
  border-radius: inherit;
  border: 1px solid #e5e7eb;
  object-fit: cover;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
}

/* ✕ gomb a jobb felső sarokban */
.chat-image-preview-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.85);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.4);
  padding: 0;
}

.chat-image-preview-remove:hover {
  background: rgba(15, 23, 42, 1);
}

.chat-image-thumb {
  cursor: pointer;
}
