/* ============================================================
   bewitch.css — Styles communs Bewitch
   ============================================================ */

/* Variables globales */
:root {
  --bg-principal:       #0b141a;
  --bg-surface:         #202c33;
  --bg-elevated:        #2a3942;
  --bg-input:           #2a3942;
  --accent:             #00a884;
  --accent-hover:       #008f6f;
  --texte-principal:    #e9edef;
  --texte-secondaire:   #8696a0;
  --texte-blanc:        #ffffff;
  --border:             #2a3942;
  --border-radius:      12px;
  --border-radius-sm:   8px;
  --font:               'Inter', sans-serif;
  --transition:         0.2s ease;
}

/* ============================================================
   Reset
   ============================================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ============================================================
   Base
   ============================================================ */
body {
  font-family: var(--font);
  background: var(--bg-principal);
  color: var(--texte-principal);
  min-height: 100dvh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
}

/* ============================================================
   Header
   ============================================================ */
.site-header {
  background: var(--bg-surface);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.site-logo {
  font-size: 20px;
  font-weight: 600;
  color: var(--texte-principal);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.site-logo span {
  color: var(--accent);
}

/* ============================================================
   HOME / GENRE
   ============================================================ */
/* Sections genre */
.genre-section { margin-bottom: 48px; }

.genre-seo {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
}

.genre-titre {
    font-size: 22px;
    font-weight: 600;
    color: #e2e8f0;
    padding: 0 20px 20px;
    margin: 0;
}

/* ============================================================
   Boutons
   ============================================================ */
.btn-primary {
  display: inline-block;
  padding: 11px 20px;
  background: var(--accent);
  border: none;
  border-radius: var(--border-radius-sm);
  color: var(--texte-blanc);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition);
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: var(--texte-blanc);
  text-decoration: none;
}

.btn-primary:disabled {
  background: var(--bg-elevated);
  cursor: not-allowed;
}

.btn-block {
  display: block;
  width: 100%;
}

/* Boutons header */
.site-header-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-header-login {
  padding: 7px 7px;
  border-radius: var(--border-radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--texte-secondaire);
  text-decoration: none;
  transition: color var(--transition);
}

.btn-header-login:hover {
  color: var(--texte-principal);
  text-decoration: none;
}

.btn-header-register {
  padding: 7px 14px;
  background: var(--accent);
  border-radius: var(--border-radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--texte-blanc);
  text-decoration: none;
  transition: background var(--transition);
}

.btn-header-register:hover {
  background: var(--accent-hover);
  color: var(--texte-blanc);
  text-decoration: none;
}

/* ============================================================
   Footer (home.php)
   ============================================================ */
.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 40px 32px 24px;
  margin-top: auto;
}

.site-footer-inner {
  display: flex;
  gap: 48px;
  max-width: 1400px;
  margin: 0 auto 32px;
}

.site-footer-logo {
  font-size: 18px;
  font-weight: 600;
  color: var(--texte-principal);
}

.site-footer-logo span {
  color: var(--accent);
}

.site-footer-title {
  font-size: 11px;
  font-weight: bold;
  color: var(--texte-secondaire);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.site-footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.site-footer-links a {
  font-size: 13px;
  color: var(--texte-secondaire);
  text-decoration: none;
  transition: color var(--transition);
}

.site-footer-links a:hover {
  color: var(--texte-principal);
}

.site-footer-copy {
  text-align: center;
  font-size: 12px;
  color: var(--texte-secondaire);
  border-top: 1px solid var(--border);
  padding-top: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

/* ============================================================
   Personnages (home.php)
   ============================================================ */
.personnages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); 
  gap: 16px;
  padding: 24px 32px 60px;
  max-width: 1400px;
  margin: 0 auto;
}

.carte {
  background: var(--bg-surface);
  border-radius: 14px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.carte:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 168, 132, 0.15);
}

.carte-image {
  position: relative;
  width: 100%;
  aspect-ratio: 300 / 378;
  overflow: hidden;
}

.carte-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.carte:hover .carte-image img {
  transform: scale(1.06);
}

.carte-image-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 40px 16px 14px;
  background: linear-gradient(transparent, rgba(0,0,0,0.82));
}

.carte-nom {
  font-size: 16px;
  font-weight: 600;
  color: var(--texte-blanc);
  display: flex;
  align-items: baseline;
  gap: 6px;
}

/* Desktop HD : limiter la largeur du contenu */
@media (min-width: 1280px) {
  .page-home .content {
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
  }
}

/* Mobile : une carte visible à la fois */
@media (max-width: 640px) {
  .personnages-grid {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 12px;
    padding: 16px 20px 60px;
  }

  .carte {
    flex-shrink: 0;
    width: 80vw;
    scroll-snap-align: center;
  }

  .carte-description {
    font-size: 14px;
  }

  .carte-nom {
    font-size: 17px;
  }
}

.badge-online {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #e9edef;
  font-weight: 400;
}

.badge-online-dot {
  width: 8px;
  height: 8px;
  background: #00a884;
  border-radius: 50%;
  flex-shrink: 0;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(0,168,132,0.6); }
  70%  { box-shadow: 0 0 0 5px rgba(0,168,132,0); }
  100% { box-shadow: 0 0 0 0 rgba(0,168,132,0); }
}

.carte-body {
  padding: 14px 16px 16px;
}

.carte-description {
  font-size: 13px;
  color: var(--texte-secondaire);
  line-height: 1.6;
  font-weight: 300;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.btn-discuter {
  display: block;
  width: 100%;
  padding: 9px;
  background: var(--accent);
  border: none;
  border-radius: var(--border-radius-sm);
  color: var(--texte-blanc);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition);
}

.btn-discuter:hover {
  background: var(--accent-hover);
  color: var(--texte-blanc);
  text-decoration: none;
}

.btn-modifier-perso {
  display: block;
  width: 100%;
  padding: 9px;
  background: none;
  color: #f4821f;
  border: 1px solid #f4821f;
  border-radius: var(--border-radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  text-align: center;
  text-decoration: none;
  margin-top: 8px;
  transition: background var(--transition), color var(--transition);
}

.btn-modifier-perso:hover {
  background: #f4821f;
  color: var(--texte-blanc);
}

.btn-supprimer-perso {
  display: block;
  width: 100%;
  padding: 9px;
  background: none;
  border: 1px solid #e53935;
  border-radius: var(--border-radius-sm);
  color: #e53935;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  text-align: center;
  cursor: pointer;
  margin-top: 8px;
  transition: background var(--transition), color var(--transition);
}

.btn-supprimer-perso:hover {
  background: #e53935;
  color: var(--texte-blanc);
}

.no-perso {
  text-align: center;
  padding: 80px 24px;
  color: var(--texte-secondaire);
  font-size: 15px;
}

/* ============================================================
   Hero (home.php)
   ============================================================ */
.hero {
  text-align: left;
  padding: 20px 20px 20px;
}

.hero p {
  font-size: 14px;
  color: var(--texte-secondaire);
  font-weight: 300;
  max-width: 700px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ============================================================
   Chat (chat.php)
   ============================================================ */
.chat-body {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Avatar */
.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

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

/* Zone de chat */
#chat-area {
  flex: 1;
  min-height: 0; 
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg-principal);
}

#chat-area::-webkit-scrollbar { width: 5px; }
#chat-area::-webkit-scrollbar-track { background: transparent; }
#chat-area::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 3px; }

/* Messages */
.msg-row {
  display: flex;
  margin-bottom: 2px;
}

.msg-row.claire { justify-content: flex-start; gap: 8px; }
.msg-row.user   { justify-content: flex-end; }

.bubble {
  max-width: 72%;
  padding: 7px 12px;
  border-radius: var(--border-radius-sm);
  font-size: 14px;
  line-height: 1.55;
  position: relative;
  word-wrap: break-word;
}

.msg-row.claire .bubble {
  background: var(--bg-surface);
  color: var(--texte-principal);
  border-top-left-radius: 0;
}

.msg-row.user .bubble {
  background: #005c4b;
  color: var(--texte-principal);
  border-top-right-radius: 0;
}

.bubble .time {
  font-size: 11px;
  color: var(--texte-secondaire);
  float: right;
  margin-left: 10px;
  margin-top: 3px;
  line-height: 1;
}

/* Typing */
.typing-row {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 4px;
}

.typing-bubble {
  background: var(--bg-surface);
  border-radius: var(--border-radius-sm);
  border-top-left-radius: 0;
  padding: 12px 16px;
  display: flex;
  gap: 4px;
  align-items: center;
}

.typing-bubble span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--texte-secondaire);
  animation: bounce 1.2s infinite;
}

.typing-bubble span:nth-child(2) { animation-delay: 0.2s; }
.typing-bubble span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30%           { transform: translateY(-4px); opacity: 1; }
}

/* Footer chat */
/*
.chat-footer {
  background: var(--bg-surface);
  padding: 10px 12px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-shrink: 0;
  min-height: 0;
}
*/

#user-input {
  flex: 1;
  background: var(--bg-input);
  border: none;
  border-radius: 10px;
  color: var(--texte-principal);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 300;
  padding: 10px 14px;
  outline: none;
  resize: none;
  min-height: 42px;
  max-height: 120px;
  line-height: 1.5;
}

#user-input::placeholder { color: var(--texte-secondaire); }

#send-btn {
  width: 42px;
  height: 42px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition);
}

#send-btn:hover    { background: var(--accent-hover); }
#send-btn:disabled { background: var(--bg-elevated); cursor: not-allowed; }
#send-btn svg      { width: 20px; height: 20px; fill: white; }

/* Animations */
.fade-in {
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
  .site-footer-inner {
    flex-wrap: wrap;
    gap: 24px;
  }

  .site-footer-col {
    flex: 1 1 140px;
  }
}

@media (max-width: 600px) {
  .personnages-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 16px;
  }

  .hero h1 { font-size: 24px; }
  .hero     { padding: 40px 16px 24px; }

  .site-footer {
    padding: 24px 16px 20px;
  }

  .site-footer-inner {
    flex-direction: column;
    gap: 24px;
  }

  .site-footer-col {
    flex: none;
    width: 100%;
  }

}

@media (max-width: 360px) {
  .personnages-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Chat — layout global
   ============================================================ */
body.page-chat {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.page-chat .site-header {
  flex-shrink: 0;
}

.page-body {
  display: flex;
  flex-direction: row;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ============================================================
   Menu latéral
   ============================================================ */
.side-nav {
  width: 220px;
  min-width: 220px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
/*  overflow-y: auto; */
  flex-shrink: 0;
  z-index: 100;
}

.side-nav-logo {
  padding: 14px 16px;
  min-height: 63px;        /* à ajuster selon la hauteur réelle du header chat */
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.side-nav-logo a {
  font-size: 18px;
  font-weight: 600;
  color: var(--texte-principal);
  text-decoration: none;
}

.side-nav-logo span {
  color: var(--accent);
}

.side-nav-section {
  padding: 8px 0;
  overflow-y: auto;
}


.side-nav-section--bottom {
  flex: none;
  border-top: 1px solid var(--border);
  padding: 8px 0 8px 0;
  margin-top: 16px;
}


.side-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--texte-secondaire);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  position: relative;
  user-select: none;
  border: none;
  background: none;
  width: 100%;
}

.side-nav-item:hover {
  background: var(--bg-elevated);
  color: var(--texte-principal);
  text-decoration: none;
}

.side-nav-item.active {
  color: var(--accent);
  background: rgba(0, 168, 132, 0.08);
}

.side-nav-item--jetons { color: #e06090; }
.side-nav-item--jetons svg { fill: #e06090; }
.side-nav-item--jetons:hover { color: #e06090; background: rgba(224,96,144,0.08); }

/* Sélecteur de langue */
.lang-menu {
  display: none;
  position: absolute;
  left: 224px;
  bottom: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--border-radius-sm);
  min-width: 180px;
  z-index: 200;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.lang-menu.open { display: block; }

.lang-menu-item {
  display: block;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--texte-secondaire);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}

.lang-menu-item:hover { background: var(--bg-surface); color: var(--texte-principal); }
.lang-menu-item.active { color: var(--accent); }

/* ============================================================
   Chat — contenu (colonne droite du layout)
   ============================================================ */
.chat-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}

/* Header chat */
body.page-chat header {
  background: var(--bg-surface);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.header-info h1 { font-size: 16px; font-weight: 500; color: var(--texte-principal); }
.header-info p  { font-size: 12px; color: var(--texte-secondaire); margin-top: 1px; }

/* Footer chat */
body.page-chat footer {
  background: var(--bg-surface);
  padding: 10px 12px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-shrink: 0;
  min-height: 0;
}

/* Sous-header chat : avatar + nom du personnage */
.chat-header {
  background: var(--bg-principal);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-header .header-info {
  flex: 1;
  min-width: 0;
}

.chat-header .header-info h1 { font-size: 16px; font-weight: 500; color: var(--texte-principal);  margin-left: auto; flex: 1; }
.chat-header .header-info p  { font-size: 12px; color: var(--texte-secondaire); margin-top: 1px; }

/* Bouton hamburger — caché sur desktop */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--texte-principal);
  padding: 2px;
  flex-shrink: 0;
}

/* Overlay mobile */
#nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

#nav-overlay.open { display: block; }

/* ============================================================
   Responsive — tablette et mobile (side-nav en drawer)
   ============================================================ */
@media (max-width: 1024px) {
  .side-nav {
    position: fixed;
    top: 0;
    left: -220px;
    height: 100dvh;
    transition: left 0.25s ease;
  }

  .side-nav.open {
    left: 0;
  }

  .hamburger {
    display: flex;
  }
}

/* ============================================================
   Responsive chat — mobile uniquement
   ============================================================ */
@media (max-width: 1024px) {
  body.page-chat {
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom);
  }
  
/*
  .site-header {
  padding-top: calc(10px + env(safe-area-inset-top) + 20px);
  }
*/

  body.page-chat footer {
    padding-bottom: calc(10px + env(safe-area-inset-bottom) + 20px);
  }

  #user-input {
    font-size: 16px;
  }
}
/* ============================================================
   Layout home.php
   ============================================================ */
body.page-home {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

body.page-home .page-body {
  display: flex;
  flex-direction: row;
  flex: 1;
}

.content {
  flex: 1;
  overflow-y: auto;
  min-width: 0;
}
/* ============================================================
   Chat — panneau Discussions + panneau Chat
   ============================================================ */

/* chat-content devient un flex row */
.chat-content {
  flex: 1;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  min-width: 0;
}

/* Panneau Discussions */
.discussions-panel {
  width: 280px;
  min-width: 280px;
  background: var(--bg-principal);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.discussions-header {
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 600;
  color: var(--texte-principal);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.discussions-list {
  flex: 1;
  overflow-y: auto;
}

.discussions-empty {
  padding: 24px 16px;
  font-size: 13px;
  color: var(--texte-secondaire);
  text-align: center;
}

.discussion-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  text-decoration: none;
  transition: background var(--transition);
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.discussion-item:hover {
  background: var(--bg-elevated);
  text-decoration: none;
}

.discussion-item.active {
  background: rgba(0, 168, 132, 0.08);
}

.discussion-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.discussion-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.discussion-avatar-placeholder {
  width: 100%;
  height: 100%;
  background: var(--bg-elevated);
}

.discussion-info {
  flex: 1;
  min-width: 0;
}

.discussion-nom {
  font-size: 14px;
  font-weight: 500;
  color: var(--texte-principal);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.discussion-extrait {
  font-size: 12px;
  color: var(--texte-secondaire);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.discussion-heure {
  font-size: 11px;
  color: var(--texte-secondaire);
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 2px;
}

/* Panneau Chat */
.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}

/* Bouton retour (mobile uniquement) */
.chat-back-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--texte-principal);
  padding: 2px;
  flex-shrink: 0;
}

/* ============================================================
   Responsive — mobile
   ============================================================ */
@media (max-width: 768px) {

  .chat-content {
    flex-direction: column;
    min-height: 0;
  }

  /* Sur mobile, discussions et chat prennent toute la largeur */
  .discussions-panel,
  .chat-panel {
    width: 100%;
    min-width: 0;
    flex: 1;
    min-height: 0;
  }

  /* Cache via JS */
  .mobile-hidden {
    display: none !important;
  }

  .chat-back-btn {
    display: flex;
  }
}
/* ============================================================
   Message scénario
   ============================================================ */
.scenario-message {
  display: flex;
  justify-content: center;
  padding: 16px 12px;
}

.scenario-inner {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--bg-elevated);
  border-radius: 10px;  /* plus arrondi = bulle */
  padding: 8px 14px;
  font-size: 13px;
  max-width: 75%;
}

.scenario-icon {
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 1px;
}

.scenario-text {
  font-size: 13px;
  color: var(--texte-secondaire);
  line-height: 1.6;
  font-style: italic;
}
/* ============================================================
   Chat — zone principale (messages + info-area)
   ============================================================ */
.chat-main-body {
  flex: 1;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  min-height: 0;
}

.chat-messages-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
/*  min-height: 0; */
}

/* Info area */
.info-area {
  width: 300px;
  min-width: 300px;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
  transition: width 0.25s ease, min-width 0.25s ease;
}

.info-area.hidden {
  width: 0;
  min-width: 0;
  overflow: hidden;
  border-left: none;
}

.info-area-photo {
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  flex-shrink: 0;
}

.info-area-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.info-area-content {
  padding: 16px;
}

.info-area-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--texte-secondaire);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.info-area-row {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
  align-items: baseline;
}

.info-area-label {
  font-size: 12px;
  color: var(--texte-secondaire);
  flex-shrink: 0;
}

.info-area-value {
  font-size: 13px;
  color: var(--texte-principal);
}

.info-area-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

.info-area-description {
  font-size: 12px;
  color: var(--texte-secondaire);
  line-height: 1.65;
}

/* Bouton toggle */
.info-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--texte-secondaire);
  padding: 4px;
  border-radius: 6px;
  transition: color var(--transition), background var(--transition);
  flex-shrink: 0;
}

.info-toggle-btn:hover {
  color: var(--texte-principal);
  background: var(--bg-elevated);
}

.info-toggle-btn.active {
  color: var(--accent);
}

/* Masquer sur tablette et mobile */
@media (max-width: 1024px) {
  .info-area {
    display: none !important;
  }
  .info-toggle-btn {
    display: none;
  }
}
/* ============================================================
   Bouton suppression conversation
   ============================================================ */
.chat-delete-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--texte-secondaire);
  padding: 4px;
  border-radius: 6px;
  transition: color var(--transition), background var(--transition);
  flex-shrink: 0;
}

.chat-delete-btn:hover {
  color: #e53935;
  background: rgba(229, 57, 53, 0.1);
}

/* Popup confirmation suppression */
.delete-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.delete-overlay.open {
  display: flex;
}
/* ============================================================
   Popup Contact
   ============================================================ */
.contact-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.contact-overlay.open {
  display: flex;
}

.contact-popup {
  background: var(--bg-surface);
  border-radius: var(--border-radius);
  max-width: 420px;
  width: 100%;
  overflow: hidden;
}

.contact-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.contact-popup-header span {
  font-size: 16px;
  font-weight: 600;
  color: var(--texte-principal);
}

.contact-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--texte-secondaire);
  padding: 2px;
  display: flex;
  transition: color var(--transition);
}

.contact-close-btn:hover {
  color: var(--texte-principal);
}

.contact-popup-body {
  padding: 20px;
}

.contact-intro {
  font-size: 13px;
  color: var(--texte-secondaire);
  margin-bottom: 14px;
  line-height: 1.6;
}

.contact-intro a {
  color: var(--accent);
}

.contact-textarea {
  width: 100%;
  background: var(--bg-input);
  border: none;
  border-radius: var(--border-radius-sm);
  color: var(--texte-principal);
  font-family: var(--font);
  font-size: 14px;
  padding: 12px 14px;
  outline: none;
  resize: vertical;
  min-height: 120px;
  line-height: 1.5;
  margin-bottom: 12px;
}

.contact-textarea::placeholder {
  color: var(--texte-secondaire);
}

.contact-feedback {
  font-size: 13px;
  margin-bottom: 12px;
  min-height: 18px;
}

.contact-feedback.success { color: var(--accent); }
.contact-feedback.error   { color: #e53935; }

.contact-submit-btn {
  width: 100%;
  padding: 11px;
  background: var(--accent);
  border: none;
  border-radius: var(--border-radius-sm);
  color: var(--texte-blanc);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: background var(--transition);
}

.contact-submit-btn:hover {
  background: var(--accent-hover);
}
/* ============================================================
   Mon compte
   ============================================================ */
.compte-wrap {
  max-width: 640px;
  margin: 40px auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@media (min-width: 1200px) {
  .compte-wrap {
    max-width: 900px;  /* desktop HD */
  }
}

@media (min-width: 1600px) {
  .compte-wrap {
    max-width: 1100px;  /* très grand écran */
  }
}

.compte-carte {
  background: var(--bg-surface);
  border-radius: var(--border-radius);
  padding: 28px;
}

.compte-carte-titre {
  font-size: 18px;
  font-weight: 600;
  color: var(--texte-principal);
  margin-bottom: 8px;
}

.compte-carte-intro {
  font-size: 13px;
  color: var(--texte-secondaire);
  line-height: 1.6;
  margin-bottom: 24px;
}

.compte-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.compte-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.langue-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.langue-option {
  padding: 8px 18px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border);
  color: var(--texte-secondaire);
  text-decoration: none;
  font-size: 14px;
  transition: all var(--transition);
}
.langue-option:hover { border-color: var(--accent); color: var(--texte-principal); }
.langue-option.active { border-color: var(--accent); color: var(--accent); font-weight: 500; }

.compte-field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--texte-secondaire);
}

/* APRÈS */
.compte-field input[type="number"],
.compte-field input[type="text"],
.compte-field input[type="date"],
.compte-field input[type="email"],
.compte-field input[type="url"],
.compte-field textarea {
  background: var(--bg-input);
  border: 1px solid transparent;
  border-radius: var(--border-radius-sm);
  color: var(--texte-principal);
  font-family: var(--font);
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  transition: border-color var(--transition);
}

.compte-field input[type="number"]:focus,
.compte-field input[type="text"]:focus,
.compte-field input[type="date"]:focus,
.compte-field input[type="email"]:focus,
.compte-field input[type="url"]:focus,
.compte-field textarea:focus {
  border-color: var(--accent);
}

.compte-field input::placeholder,
.compte-field textarea::placeholder {
  color: var(--texte-secondaire);
}

.compte-radio-group {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.compte-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--texte-principal);
}

.compte-radio input[type="radio"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.compte-feedback {
  font-size: 13px;
  padding: 10px 14px;
  border-radius: var(--border-radius-sm);
  margin-bottom: 4px;
}

.compte-feedback.success {
  background: rgba(0, 168, 132, 0.12);
  color: var(--accent);
}

.compte-feedback.error {
  background: rgba(229, 57, 53, 0.12);
  color: #e53935;
}

@media (max-width: 600px) {
  .compte-wrap {
    margin: 24px auto;
    padding: 0 16px;
  }
  .compte-carte {
    padding: 20px;
  }
}

/* ============================================================
   Créer mon IA
   ============================================================ */
.creer-section-titre {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.creer-fields-row {
  display: flex;
  gap: 16px;
}

.creer-fields-row .compte-field {
  flex: 1;
}

.creer-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid transparent;
  border-radius: var(--border-radius-sm);
  color: var(--texte-principal);
  font-family: var(--font);
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  resize: vertical;
  line-height: 1.5;
  transition: border-color var(--transition);
}

.creer-textarea:focus {
  border-color: var(--accent);
}

.creer-textarea::placeholder {
  color: var(--texte-secondaire);
  font-style: italic;
}

.creer-count {
  font-size: 11px;
  color: var(--texte-secondaire);
  text-align: right;
}

/* Carousel avatar */
.creer-avatar-wrap {
  overflow: hidden;
}

.creer-avatar-carousel {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.creer-avatar-carousel::-webkit-scrollbar { height: 4px; }
.creer-avatar-carousel::-webkit-scrollbar-track { background: transparent; }
.creer-avatar-carousel::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 2px; }

.creer-avatar-item {
  flex-shrink: 0;
  width: 120px;
  height: 150px;
  border-radius: var(--border-radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  scroll-snap-align: start;
  transition: border-color var(--transition);
}

.creer-avatar-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.creer-avatar-item.selected {
  border-color: var(--accent);
}

/* ============================================================
   Mes personnages
   ============================================================ */
.mes-perso-wrap {
  padding: 32px;
}

.mes-perso-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.mes-perso-header h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--texte-principal);
}

.mes-perso-empty {
  text-align: center;
  padding: 80px 24px;
  color: var(--texte-secondaire);
  font-size: 15px;
}

@media (max-width: 600px) {
  .creer-fields-row {
    flex-direction: column;
  }
  .mes-perso-wrap {
    padding: 16px;
  }
  .mes-perso-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

/* ============================================================
   Bottom navigation — mobile/tablette uniquement
   ============================================================ */
.bottom-nav {
  display: none;
}

@media (max-width: 1024px) {
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    z-index: 90;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .bottom-nav-item--upgrade {
    color: #e06090;
  }

  .bottom-nav-item--upgrade svg {
    fill: #e06090;
   }

  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 4px;
    color: var(--texte-secondaire);
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    transition: color var(--transition);
  }

  .bottom-nav-item:hover,
  .bottom-nav-item.active {
    color: var(--accent);
    text-decoration: none;
  }

  .bottom-nav-item svg {
    flex-shrink: 0;
  }

  /* Ajouter du padding en bas du contenu pour ne pas être masqué par la bottom nav */
  body.page-home .content {
    padding-bottom: 70px;
  }
}

/* ============================================================
   Page Abonnement (subscription.php)
   ============================================================ */

.sub-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 60px;
}

.sub-header {
  text-align: center;
  margin-bottom: 40px;
}

.sub-titre {
  font-size: 26px;
  font-weight: 700;
  color: var(--texte-principal);
  margin-bottom: 10px;
  line-height: 1.3;
}

.sub-intro {
  font-size: 14px;
  color: var(--texte-secondaire);
}

/* ── Layout 2 colonnes ────────────────────────────────────── */
.sub-body {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 32px;
  align-items: start;
}

/* ── Colonne offres ───────────────────────────────────────── */
.sub-col-offres {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sub-offre {
  background: var(--bg-surface);
  border: 2px solid transparent;
  border-radius: var(--border-radius);
  padding: 20px 22px;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
  position: relative;
}

.sub-offre:hover {
  border-color: var(--accent);
}

.sub-offre--best {
  border-color: rgba(0, 168, 132, 0.35);
  background: linear-gradient(135deg, rgba(0, 168, 132, 0.08) 0%, var(--bg-surface) 100%);
}

.sub-offre--selected {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(0, 168, 132, 0.18);
}

.sub-offre-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.sub-offre-duree {
  font-size: 16px;
  font-weight: 600;
  color: var(--texte-principal);
}

.sub-badge-best {
  font-size: 11px;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sub-badge-promo {
  font-size: 12px;
  font-weight: 600;
  color: #f97316;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.sub-offre-prix {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 16px;
}

.sub-offre-prix--no-promo {
  margin-top: 22px; /* compense l'absence du badge promo */
}

.sub-prix-barre {
  font-size: 16px;
  color: var(--texte-secondaire);
  text-decoration: line-through;
}

.sub-prix-actuel {
  font-size: 28px;
  font-weight: 700;
  color: var(--texte-principal);
  line-height: 1;
}

.sub-prix-unite {
  font-size: 13px;
  color: var(--texte-secondaire);
}

.sub-btn-choisir {
  font-size: 14px;
  padding: 10px 20px;
}

/* ── Colonne droite ───────────────────────────────────────── */
.sub-col-droite {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 24px;
}

/* Avantages */
.sub-avantages {
  background: var(--bg-surface);
  border-radius: var(--border-radius);
  padding: 22px;
}

.sub-avantages-titre {
  font-size: 15px;
  font-weight: 600;
  color: var(--texte-principal);
  margin-bottom: 16px;
}

.sub-avantages-liste {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sub-avantages-liste li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--texte-principal);
  line-height: 1.4;
}

.sub-check {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Paiement */
.sub-paiement {
  background: var(--bg-surface);
  border-radius: var(--border-radius);
  padding: 22px;
}

.sub-paiement-titre {
  font-size: 15px;
  font-weight: 600;
  color: var(--texte-principal);
  margin-bottom: 16px;
}

.sub-feedback {
  font-size: 13px;
  padding: 10px 14px;
  border-radius: var(--border-radius-sm);
  margin-bottom: 14px;
}

.sub-feedback.error {
  background: rgba(229, 57, 53, 0.12);
  color: #e53935;
}

.sub-feedback.success {
  background: rgba(0, 168, 132, 0.12);
  color: var(--accent);
}

#payment-element {
  margin-bottom: 16px;
}

.sub-pay-btn {
  font-size: 15px;
  font-weight: 600;
  padding: 13px;
}

.sub-pay-btn:disabled {
  background: var(--bg-elevated);
  cursor: not-allowed;
}

/* Mentions légales */
.sub-mentions {
  background: var(--bg-elevated);
  border-radius: var(--border-radius-sm);
  padding: 14px 16px;
}

.sub-mentions p {
  font-size: 11px;
  color: var(--texte-secondaire);
  line-height: 1.6;
}

/* ── Responsive mobile ────────────────────────────────────── */
@media (max-width: 860px) {
  .sub-body {
    grid-template-columns: 1fr;
  }

  .sub-col-droite {
    position: static;
  }

  .sub-wrap {
    padding: 24px 16px 80px;
  }

  .sub-titre {
    font-size: 20px;
  }
}

/* ── Ajouts subscription.php (à coller à la fin de la section Page Abonnement) ── */
 
/* Bouton secondaire (gris) */
.btn-secondary {
  display: inline-block;
  padding: 11px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--border-radius-sm);
  color: var(--texte-secondaire);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  text-align: center;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
 
.btn-secondary:hover {
  background: #3a4a54;
  color: var(--texte-principal);
}
 
/* Bandeau succès post-paiement */
.sub-success-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 168, 132, 0.12);
  border: 1px solid rgba(0, 168, 132, 0.3);
  color: var(--accent);
  border-radius: var(--border-radius-sm);
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 28px;
}
 
/* Card abonnement actif */
.sub-actif-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: 28px;
  max-width: 540px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sub-error {
  display: inline-block;
  background: rgba(220, 53, 69, 0.15);
  color: #dc3545;
  border: 1px solid rgba(220, 53, 69, 0.4);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
}

.sub-actif-plan {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
 
.sub-actif-plan:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}
 
.sub-actif-label {
  font-size: 13px;
  color: var(--texte-secondaire);
}
 
.sub-actif-valeur {
  font-size: 15px;
  font-weight: 600;
  color: var(--texte-principal);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sub-actif-resilie-info {
  font-size: 0.85rem;
  color: #8696a0;
  margin-bottom: 16px;
}
 
.sub-badge-canceling {
  font-size: 11px;
  font-weight: 600;
  background: rgba(249, 115, 22, 0.15);
  color: #f97316;
  padding: 2px 8px;
  border-radius: 20px;
}
 
.sub-actif-actions {
  padding-top: 4px;
  text-align: center;
}
 
.sub-btn-resilier {
  font-size: 13px;
  padding: 9px 18px;
}
 
.sub-actif-canceling-info {
  font-size: 13px;
  color: var(--texte-secondaire);
  line-height: 1.6;
  padding-top: 4px;
}
 
/* Modale résiliation */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
 
.modal-box {
  background: var(--bg-surface);
  border-radius: var(--border-radius);
  padding: 32px 28px;
  max-width: 460px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
 
.modal-titre {
  font-size: 18px;
  font-weight: 700;
  color: var(--texte-principal);
  line-height: 1.3;
}
 
.modal-contenu {
  font-size: 14px;
  color: var(--texte-secondaire);
  line-height: 1.6;
}
 
.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
 
.modal-actions .btn-primary,
.modal-actions .btn-secondary {
  width: 100%;
  text-align: center;
  padding: 12px;
  font-size: 14px;
}
/* ============================================================
   SEO
   ============================================================ */
.seo-blocs {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 40px;
}

.seo-bloc {
  background: var(--bg-surface);
  border-radius: var(--border-radius);
  padding: 28px;
}

.seo-bloc-titre {
  font-size: 18px;
  font-weight: 600;
  color: var(--texte-principal);
  margin-bottom: 12px;
}

.seo-bloc-texte {
  font-size: 14px;
  color: var(--texte-secondaire);
  line-height: 1.6;
}

.seo-bloc-texte ul {
  list-style: disc;
  padding-left: 20px;
  margin-top: 8px;
}

.seo-bloc-texte li {
  margin-bottom: 4px;
}