/* ═══════════════════════════════════════════════════════════════════════
   chat-panel.css — Styles du Livechat Replay Games (Bulle bas-gauche & Tiroir)
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── BOUTON BULLE FLOTTANTE (BOTTOM-LEFT) ────────────────────────────── */
.chat-bubble-wrapper {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 100;
}

.chat-bubble-btn {
  position: relative;
  background: rgba(255, 255, 255, 0.12);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  outline: none;
}

.chat-bubble-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: scale(1.08);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.chat-bubble-btn:active {
  transform: scale(0.96);
}

.chat-bubble-btn:disabled,
.chat-bubble-btn.is-offline {
  opacity: 0.35;
  cursor: not-allowed;
  filter: grayscale(100%);
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  transform: none !important;
  box-shadow: none !important;
}

.chat-bubble-btn:disabled:hover,
.chat-bubble-btn.is-offline:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: none !important;
  box-shadow: none !important;
}

.chat-bubble-btn:disabled .chat-bubble-badge,
.chat-bubble-btn.is-offline .chat-bubble-badge {
  opacity: 0.5;
  filter: grayscale(100%);
}

.chat-bubble-btn svg {
  width: 22px;
  height: 22px;
  transition: transform 0.25s ease;
}

.chat-bubble-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--primary, #667eea);
  color: #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  min-width: 18px;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  animation: popIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popIn {
  from {
    transform: scale(0);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* ─── PANNEAU CHAT (DRAWER LATÉRAL GAUCHE) ───────────────────────────── */
.chat-panel {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
}

.chat-panel.hidden {
  display: none;
}

.chat-panel.open {
  pointer-events: auto;
}

.chat-panel-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.chat-panel.open .chat-panel-backdrop {
  opacity: 1;
}

.chat-panel-inner {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: min(420px, 94vw);
  background: linear-gradient(165deg, rgba(20, 20, 42, 0.98), rgba(12, 12, 28, 0.99));
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 10px 0 45px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: contain;
  transform: translateX(-105%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.chat-panel.open .chat-panel-inner {
  transform: translateX(0);
}

/* ─── HEADER DU CHAT ─────────────────────────────────────────────────── */
.chat-panel-header {
  padding: 18px 20px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  flex-shrink: 0;
}

.chat-header-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-header-icon {
  font-size: 1.4rem;
}

.chat-header-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.02em;
  font-family: 'DM Sans', sans-serif;
}

.chat-online-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #4cd137;
  background: rgba(76, 209, 55, 0.12);
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid rgba(76, 209, 55, 0.25);
}

.chat-online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4cd137;
  box-shadow: 0 0 8px #4cd137;
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.4;
    transform: scale(0.85);
  }
}

.chat-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.chat-close-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: rotate(90deg);
}

/* ─── ONGLETS DE SALON (ROOM TABS) ──────────────────────────────────── */
.chat-tabs-bar {
  display: flex;
  padding: 10px 16px;
  gap: 8px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.chat-tab-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  font-family: 'DM Sans', sans-serif;
}

.chat-tab-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.chat-tab-btn.active {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.4) 0%, rgba(118, 75, 162, 0.4) 100%);
  border-color: rgba(102, 126, 234, 0.6);
  color: #fff;
  box-shadow: 0 2px 10px rgba(102, 126, 234, 0.25);
}

/* ─── CORPS DES MESSAGES ────────────────────────────────────────────── */
.chat-messages-container {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.chat-messages-container::-webkit-scrollbar {
  width: 6px;
}

.chat-messages-container::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.chat-empty-state {
  margin: auto;
  text-align: center;
  color: rgba(255, 255, 255, 0.45);
  padding: 30px 10px;
}

.chat-empty-state-icon {
  font-size: 2.2rem;
  margin-bottom: 8px;
}

.chat-empty-state-text {
  font-size: 0.9rem;
  line-height: 1.4;
}

/* ─── BULLES DE MESSAGES ────────────────────────────────────────────── */
.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  animation: fadeInMsg 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInMsg {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-msg.is-other {
  align-self: flex-start;
}

.chat-msg.is-me {
  align-self: flex-end;
}

.chat-msg-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 0.74rem;
}

.chat-msg.is-other .chat-msg-header {
  padding-left: 4px;
}

.chat-msg.is-me .chat-msg-header {
  justify-content: flex-end;
  padding-right: 4px;
}

.chat-msg-author {
  font-weight: 700;
  color: #a4b0be;
}

.chat-msg.is-me .chat-msg-author {
  color: #74b9ff;
}

.chat-msg-time {
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.68rem;
}

.chat-msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.4;
  word-break: break-word;
  position: relative;
}

.chat-msg.is-other .chat-msg-bubble {
  background: rgba(255, 255, 255, 0.08);
  color: #f1f2f6;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 4px;
}

.chat-msg.is-me .chat-msg-bubble {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

/* Carte invitation Défi 2J */
.chat-challenge-card {
  margin-top: 6px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chat-challenge-btn {
  background: linear-gradient(135deg, #2ed573 0%, #10ac84 100%);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.chat-challenge-btn:hover {
  transform: scale(1.05);
}

/* ─── NOTIFICATION D'AVERTISSEMENT / TOAST ───────────────────────────── */
.chat-warning-toast {
  background: rgba(235, 77, 75, 0.95);
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  margin: 0 16px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(235, 77, 75, 0.4);
  animation: shake 0.35s ease;
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-6px);
  }

  75% {
    transform: translateX(6px);
  }
}

/* ─── PIED DE PAGE & SAISIE (FOOTER) ────────────────────────────────── */
.chat-panel-footer {
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  flex-shrink: 0;
}

.chat-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 25px;
  padding: 4px 6px 4px 16px;
  transition: all 0.25s ease;
}

.chat-input-row:focus-within {
  border-color: var(--primary, #667eea);
  box-shadow: 0 0 12px rgba(102, 126, 234, 0.35);
  background: rgba(255, 255, 255, 0.09);
}

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 0.92rem;
  font-family: 'DM Sans', sans-serif;
}

.chat-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

.chat-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.chat-footer-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.4);
  padding: 0 4px;
}

.chat-char-counter {
  font-variant-numeric: tabular-nums;
}

.chat-cooldown-bar {
  height: 3px;
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}

.chat-cooldown-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #667eea, #764ba2);
  transition: width 0.1s linear;
}

/* ─── RESPONSIVE ─────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .chat-bubble-wrapper {
    bottom: 18px;
    left: 18px;
  }

  .chat-panel-inner {
    width: 100vw;
    border-right: none;
  }
}