/* src/css/style.css (Restauration V2 + Fix Salle) */

/* --- VARIABLES & RESET --- */
:root {
  --primary: #2271b1;
  /* Bleu WordPress */
  --primary-dark: #135e96;
  --primary-light: #f0f6fc;
  --text: #1d2327;
  --text-light: #646970;
  --bg-body: #f6f7f7;
  --white: #ffffff;
  --border: #c3c4c7;
  --danger: #d63638;
  --success: #00a32a;
  --radius: 8px;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  color: var(--text);
  line-height: 1.5;
  background-color: var(--bg-body);
}

a {
  text-decoration: none;
  color: inherit;
  transition: 0.2s;
}

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

ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* --- BOUTONS --- */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
  border: 2px solid transparent;
  transition: all 0.2s;
}

.btn-fill {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

.btn-fill:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: var(--white);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: var(--white);
}

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

/* --- HEADER --- */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 5%;
  background: var(--white);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo svg {
  fill: var(--primary);
  width: 24px;
  height: 24px;
}

.nav-links {
  display: flex;
  gap: 15px;
  align-items: center;
}

/* --- SECTIONS (Hero, Features, Pricing) --- */
.hero {
  text-align: center;
  padding: 100px 20px;
  background: linear-gradient(180deg, var(--white) 0%, #e8f0fe 100%);
}

.hero h1 {
  font-size: 42px;
  margin: 0 0 20px;
  color: #101010;
  letter-spacing: -0.5px;
}

.hero p {
  font-size: 18px;
  color: var(--text-light);
  max-width: 600px;
  margin: 0 auto 30px;
}

.features {
  padding: 80px 5%;
  background: var(--white);
  text-align: center;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
  margin-top: 50px;
}

.feature-card {
  padding: 30px;
  background: var(--white);
  border: 1px solid #eee;
  border-radius: var(--radius);
  transition: transform 0.3s;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow);
  border-color: transparent;
}

.feature-icon {
  font-size: 32px;
  margin-bottom: 15px;
  display: block;
}

.pricing {
  padding: 80px 5%;
  background: var(--bg-body);
  text-align: center;
}

.pricing-grid {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 40px;
}

.price-card {
  background: var(--white);
  padding: 30px;
  border-radius: var(--radius);
  width: 300px;
  border: 1px solid #e2e4e7;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: 0.3s;
}

.price-card.featured {
  border: 2px solid var(--primary);
  transform: scale(1.05);
  z-index: 2;
  box-shadow: var(--shadow);
}

.price-header h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.price {
  font-size: 40px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 20px;
}

.price span {
  font-size: 16px;
  font-weight: 400;
  color: var(--text-light);
}

.features-list {
  margin: 20px 0;
  text-align: left;
  flex-grow: 1;
}

.features-list li {
  margin-bottom: 10px;
  font-size: 14px;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-icon {
  color: var(--primary);
  font-weight: bold;
}

/* --- PAGES AUTHENTIFICATION (Login / Register) --- */
.auth-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 85vh;
  /* Centre verticalement */
  padding: 20px;
}

.auth-card {
  background: var(--white);
  padding: 40px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 450px;
  border: 1px solid var(--border);
}

.auth-header {
  text-align: center;
  margin-bottom: 30px;
}

.auth-header h2 {
  margin: 0 0 10px;
  color: var(--text);
}

.auth-header p {
  margin: 0;
  color: var(--text-light);
  font-size: 15px;
}

/* Formulaires */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  text-align: left;
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 15px;
  transition: 0.2s;
  background: var(--white);
}

.form-group input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 1px var(--primary);
}

/* Plan Summary Box (dans register) */
.plan-summary {
  background: var(--primary-light);
  border: 1px solid #cce5ff;
  padding: 15px;
  border-radius: 6px;
  margin-bottom: 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.plan-name {
  font-weight: 700;
  color: var(--primary-dark);
  display: block;
}

.plan-price {
  font-size: 13px;
  color: var(--text-light);
}

.plan-change {
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
  text-decoration: underline;
}

/* Boutons de login / Auth */
.btn-login {
  width: 100%;
  height: 45px;
  background-color: var(--primary);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
}

.btn-login:hover {
  background-color: var(--primary-dark);
}

/* Messages d'erreur */
.notice-error {
  background: #fbeaea;
  color: var(--danger);
  padding: 12px;
  border-radius: 4px;
  margin-bottom: 20px;
  font-size: 14px;
  border-left: 4px solid var(--danger);
}

.auth-footer {
  margin-top: 25px;
  text-align: center;
  font-size: 14px;
  color: var(--text-light);
  border-top: 1px solid #eee;
  padding-top: 20px;
}

.auth-footer a {
  color: var(--primary);
  font-weight: 600;
}

/* ========================================================= */
/* --- RECONSTRUCTED SALLE.PHP & ROOM CONTEXT LAYOUT ---    */
/* ========================================================= */

body.body-room {
  background-color: #f4f6f9;
}

body.body-login {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background: #f0f0f1;
  margin: 0;
}

.login-card {
  background: white;
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.room-header {
  background: #fff;
  padding: 15px 5%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.room-header .header-left {
  display: flex;
  align-items: center;
}

.room-header .header-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.room-header h1 {
  margin: 0;
  font-size: 1.5rem;
  color: #2c3e50;
  border-bottom: none;
  /* override global if needed */
  padding-bottom: 0;
}

.room-container {
  width: 100%;
  padding: 30px 40px;
  transition: padding-right 0.3s ease;
}

body.chat-is-docked .room-container {
  padding-right: 380px;
  /* Space for docked chat */
}

/* Bandeau minuteur : il est hors de .room-container (sticky en haut de page),
   donc on doit aussi lui réserver la place du chat docké pour que ses contrôles
   (label, boutons pause/stop) ne soient pas masqués. Le fond dégradé continue de
   s'étendre derrière le chat — invisible car le chat a un fond blanc opaque. */
body.chat-is-docked #timerBanner {
  padding-right: 380px !important;
}

/* Mobile (portrait étroit OU téléphone en PAYSAGE) : pas de padding pour faire
   de la place au chat (il passe en overlay plein écran, pas docké). */
@media (max-width: 600px), (orientation: landscape) and (max-height: 600px) {
  body.chat-is-docked .room-container,
  body.chat-is-docked #timerBanner {
    padding-right: 0 !important;
  }
}

/* Mobile : .room-container avait padding 30px 40px (desktop) → trop de marge
   sur smartphone, et le padding-right asymétrique introduit par chat-docked
   pouvait persister. On force ici un padding symétrique compact pour que
   les tuiles dashboard apparaissent CENTRÉES dans la largeur visible. */
@media (max-width: 768px) {
  .room-container {
    padding: 16px 14px !important;
  }
  /* Tuiles : on les rétrécit (max 320px) et on les centre dans la grille.
     L'!important contre les règles inline de salle.php qui mettent
     grid-template-columns: 1fr à 600px. */
  .dashboard-blocks-grid {
    grid-template-columns: minmax(0, 320px) !important;
    justify-content: center !important;
    gap: 14px !important;
  }
  .feature-block {
    padding: 22px 16px !important;
  }
  .feature-block .block-icon {
    font-size: 2.6rem !important;
    margin-bottom: 10px !important;
  }
  .feature-block .block-title {
    font-size: 1.1rem !important;
  }
}
@media (max-width: 380px) {
  /* Très petits écrans : on lâche un peu la contrainte pour utiliser
     toute la largeur visible (sinon trop de marge perdue). */
  .dashboard-blocks-grid {
    grid-template-columns: minmax(0, 280px) !important;
  }
}

.btn-quit {
  background: #e74c3c;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

.btn-quit:hover {
  background: #c0392b;
}

/* ========================================================= */
/* --- ROOM HEADER : MOBILE                                  */
/* ========================================================= */
/* Sur mobile, l'entête de la salle est désastreux par défaut : title qui
   wrap, badge utilisateur tronqué, boutons "Plein écran" + "Config" +
   "Quitter" qui s'empilent en chaos. On stack verticalement et on compacte
   chaque sous-bloc pour rester lisible. */
@media (max-width: 700px) {
  .room-header {
    padding: 10px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .room-header .header-left {
    /* Logo + titre prennent 100% de la largeur ; le titre tronque si trop long */
    min-width: 0;
    overflow: hidden;
  }
  .room-header .header-left img {
    max-height: 32px !important;
    max-width: 80px !important;
    margin-right: 8px !important;
  }
  .room-header h1 {
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
  }
  .room-header .header-right {
    /* Badge + boutons : wrap autorisé pour qu'ils tiennent sur 1-2 lignes */
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
  }
  .room-header .user-badge {
    flex: 1;
    min-width: 0;
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 6px 10px;
  }
  /* Tous les boutons d'action de l'entête : compacts mais cibles 44px conservées */
  .room-header .header-right .btn-quit,
  .room-header .header-right button {
    padding: 8px 11px !important;
    font-size: 0.8rem;
    min-height: 38px;
    margin-right: 0 !important;
  }
}

/* ========================================================= */
/* --- CHAT MESSAGES (rendu enrichi)                       */
/* ========================================================= */
.chat-system-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    border-radius: 6px;
    font-size: 0.82em;
    color: #92400e;
}
.chat-system-notice .csn-icon { font-size: 1rem; }
.chat-system-notice .csn-text { line-height: 1.4; }
.chat-msg {
    background: #fff;
    border-left: 4px solid #cbd5e1;
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 8px;
    font-size: 0.9em;
    word-break: break-word;
}
.chat-msg.admin {
    background: #e0f2fe;
    border-left-color: #2271b1;
}
.chat-msg-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}
.chat-msg-author {
    color: #1e293b;
    font-size: 0.92em;
}
.chat-msg.admin .chat-msg-author { color: #1e40af; }
.chat-msg-time {
    margin-left: auto;
    font-size: 0.72em;
    color: #94a3b8;
}
.chat-msg-del {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 4px;
    border-radius: 50%;
    transition: background .15s, color .15s;
}
.chat-msg-del:hover { background: rgba(239, 68, 68, 0.15); color: #dc2626; }
.chat-msg-body { color: #1e293b; line-height: 1.4; }
.chat-msg-body a { color: #2563eb; word-break: break-all; }
.chat-msg-body a:hover { text-decoration: underline; }
.chat-deleted { color: #94a3b8; font-size: 0.86em; }

.chat-attach-wrap { margin-top: 6px; }
.chat-attach {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-decoration: none;
    color: inherit;
    background: rgba(15, 23, 42, 0.04);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px;
    transition: background .15s;
}
.chat-attach:hover { background: rgba(37, 99, 235, 0.08); }
.chat-attach-img img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 6px;
    display: block;
}
.chat-attach-file {
    flex-direction: row;
    align-items: center;
    gap: 10px;
}
.chat-attach-icon { font-size: 1.4em; }
.chat-attach-meta { font-size: 0.82em; color: #475569; line-height: 1.4; }
.chat-attach-meta .muted { color: #94a3b8; }

/* Boîte d'outils (emoji + trombone) */
.chat-input-area {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
}
.chat-input-area input[type="text"] {
    flex: 1;
    min-width: 0;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 0.92rem;
    background: #f8fafc;
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.chat-input-area input[type="text"]:focus {
    border-color: #2563eb;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    outline: none;
}
.chat-tool-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    line-height: 1;
    transition: background .15s, transform .1s;
}
.chat-tool-btn:hover { background: #eff6ff; }
.chat-tool-btn:active { transform: scale(0.92); }

/* Bouton d'envoi 3D : dégradé multi-stops + reflet glossy + ombres en couches */
.btn-send {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    /* Background = reflet glossy radial superposé sur un dégradé linéaire profond */
    background:
        radial-gradient(ellipse 80% 55% at 50% 8%, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0) 60%),
        linear-gradient(180deg, #3b82f6 0%, #2563eb 55%, #1e40af 100%);
    /* Effet 3D :
       - inset top : trait blanc subtil pour le bord supérieur lumineux
       - inset bottom : trait sombre pour la "lèvre" du bouton
       - outer shadows : 2 niveaux pour profondeur et halo coloré */
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.5),
        inset 0 -2px 3px rgba(0, 0, 0, 0.18),
        0 1px 2px rgba(0, 0, 0, 0.08),
        0 4px 10px rgba(37, 99, 235, 0.35),
        0 10px 20px -4px rgba(37, 99, 235, 0.4);
    transition: transform .15s ease, box-shadow .2s ease;
}
/* Avion en papier style Telegram :
   - 2 paths (corps blanc + voile inférieure sombre) → effet 3D du pli
   - drop-shadow globale → décolle l'icône de la surface du bouton */
.btn-send svg {
    width: 22px;
    height: 22px;
    transform: translate(-1px, 1px);
    filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.3));
}
.btn-send:hover svg {
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}
.btn-send:active svg {
    /* Clic : icône suit l'enfoncement du bouton, ombre réduite. */
    transform: translate(-1px, 2px);
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));
}
.btn-send:hover {
    transform: translateY(-2px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.6),
        inset 0 -2px 3px rgba(0, 0, 0, 0.18),
        0 2px 4px rgba(0, 0, 0, 0.1),
        0 8px 16px rgba(37, 99, 235, 0.45),
        0 14px 28px -6px rgba(37, 99, 235, 0.5);
}
.btn-send:active {
    transform: translateY(1px);
    /* Au clic : ombre interne marquée + ombre externe écrasée → "enfoncé" */
    box-shadow:
        inset 0 2px 5px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        0 1px 2px rgba(37, 99, 235, 0.2);
    background:
        radial-gradient(ellipse 80% 55% at 50% 8%, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0) 60%),
        linear-gradient(180deg, #1d4ed8 0%, #1e40af 55%, #1e3a8a 100%);
}
.btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Boutons d'action dans le header chat (archiver / effacer) */
.chat-icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #ffffff;
    margin-right: 4px;
    transition: background .15s, color .15s, transform .1s;
}
.chat-icon-btn svg {
    width: 18px;
    height: 18px;
}
.chat-icon-btn:hover {
    background: rgba(255, 255, 255, 0.18);
}
.chat-icon-btn:active { transform: scale(0.92); }
.chat-icon-btn-danger:hover {
    background: rgba(239, 68, 68, 0.85);
    color: #fff;
}

/* Aperçu de pièce jointe en attente */
.chat-attachment-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #eff6ff;
    border-top: 1px solid #bfdbfe;
    padding: 6px 10px;
    font-size: 0.85em;
}
.chat-attachment-preview .cap-name { font-weight: 600; color: #1e40af; }
.chat-attachment-preview .cap-size { color: #64748b; font-size: 0.82em; }
.chat-attachment-preview .cap-cancel {
    margin-left: auto;
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 6px;
    border-radius: 50%;
}
.chat-attachment-preview .cap-cancel:hover { background: rgba(220, 38, 38, 0.15); color: #dc2626; }

/* Picker emoji compact */
.chat-emoji-picker {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    padding: 6px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    max-height: 180px;
    overflow-y: auto;
}
.chat-emoji-picker .emoji-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.15rem;
    padding: 4px;
    border-radius: 4px;
    line-height: 1;
}
.chat-emoji-picker .emoji-btn:hover { background: #f1f5f9; }

/* ========================================================= */
/* --- CHAT DOCKED STYLES ---                               */
/* ========================================================= */

#chat-container {
  background: #fff;
  border: 1px solid #ccc;
  box-shadow: -4px 0 15px rgba(0, 0, 0, 0.1);
  border-radius: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 999;
  transition: right 0.3s, top 0.3s, height 0.3s;
  font-family: inherit;
}

.chat-docked {
  position: fixed;
  top: 68px;
  /* Below the header */
  bottom: 0;
  right: 0;
  width: 350px;
  height: calc(100vh - 68px) !important;
}

.chat-floating {
  position: fixed;
  width: 350px;
  height: 450px;
  resize: both;
  border-radius: 8px;
  /* restoring bottom radius for floating */
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.25);
}

.chat-collapsed {
  height: 40px !important;
}

/* Modale responsive : plein écran sur mobile, comportement inchangé sur desktop.
   À appliquer sur le conteneur INTERNE de la modale (le div avec background blanc et max-width). */
@media (max-width: 600px) {
  .responsive-modal {
    width: 100% !important;
    max-width: 100% !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    padding: 16px !important;
    overflow-y: auto;
  }
}

/* FAB chat — masqué par défaut, visible sur mobile uniquement */
#chat-fab {
  display: none;
  position: fixed;
  bottom: 18px;
  right: 18px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2271b1, #1e40af);
  color: white;
  font-size: 1.6rem;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  z-index: 9998;
  align-items: center;
  justify-content: center;
}
#chat-fab:active { transform: scale(0.95); }
#chat-fab-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: #dc2626;
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 20px; height: 20px;
  border-radius: 10px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

/* Bouton fermeture mobile dans le header chat — masqué par défaut */
#btn-close-mobile { display: none; }

/* Mobile (portrait étroit OU téléphone en PAYSAGE) : chat caché par défaut,
   overlay plein écran quand ouvert — comportement identique au portrait. */
@media (max-width: 600px), (orientation: landscape) and (max-height: 600px) {
  /* FAB visible */
  #chat-fab { display: inline-flex; }

  /* Chat masqué par défaut */
  #chat-container.chat-docked,
  #chat-container.chat-floating {
    display: none !important;
  }

  /* Quand on l'ouvre, overlay quasi plein écran au-dessus de tout */
  body.chat-mobile-open #chat-container.chat-docked,
  body.chat-mobile-open #chat-container.chat-floating {
    display: flex !important;
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    z-index: 99100 !important;
  }

  /* Cache aussi le FAB quand le chat est ouvert (pour ne pas se superposer) */
  body.chat-mobile-open #chat-fab { display: none; }

  /* Boutons dock/collapse cachés sur mobile (inutiles avec l'overlay) */
  #btn-dock, #btn-collapse { display: none !important; }
  /* Bouton fermeture mobile visible */
  #btn-close-mobile { display: inline !important; }

  /* Empêche le scroll body quand le chat est ouvert */
  body.chat-mobile-open { overflow: hidden; }
}

.chat-header {
  background: #2271b1;
  color: white;
  padding: 10px 15px;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  /* Reste TOUJOURS visible en haut : ne se compresse jamais et ne défile pas
     (header + zone de saisie sont fixes, seul #chat-messages défile). */
  flex: 0 0 auto;
}

.chat-header-handle {
  cursor: grab;
}

.chat-header-handle:active {
  cursor: grabbing;
}

#chat-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  /* min-height:0 est INDISPENSABLE : sans lui, un enfant flex en overflow:auto
     ne se contracte pas (min-height:auto par défaut) → il s'étend à la taille
     de son contenu et fait déborder/défiler tout le conteneur, ce qui poussait
     l'entête (et le ✕) hors de l'écran sur mobile. */
  min-height: 0;
}

#chat-messages {
  flex: 1 1 auto;
  min-height: 0;        /* idem : c'est CE bloc, et lui seul, qui doit défiler */
  overflow-y: auto;
  padding: 10px;
  background: #f9f9f9;
}

.chat-input-area {
  display: flex;
  border-top: 1px solid #eee;
  background: #fff;
  /* Reste collée en bas (ne défile pas avec les messages). */
  flex: 0 0 auto;
}

#chat-input {
  flex: 1;
  border: none;
  padding: 12px;
  outline: none;
  font-size: 14px;
}

/* Note : la règle .btn-send "ronde + dégradé + flèche SVG" est définie plus
   haut dans ce fichier (cf. lignes ~620). On garde cette ancienne règle vide
   pour ne pas casser d'autres usages de la classe ailleurs. */

/* ============================================= */
/* POST-IT BOARD STYLES                          */
/* ============================================= */

.body-postit {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f1f5f9;
  overflow: auto;
}

#postit-controls {
  position: sticky;
  top: 0;
  z-index: 9000;
  background: white;
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border-bottom: 1px solid #e2e8f0;
}

.controls-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.controls-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* === Mobile : entête du tableau post-it ===
   En desktop : palette + titre à gauche, contrôles à droite sur 1 ligne.
   En mobile : tout ça ne tient pas → on stack en 2 lignes, on compacte
   les pastilles couleur, on autorise le wrap des boutons de droite. */
@media (max-width: 768px) {
  #postit-controls {
    flex-direction: column;
    align-items: stretch;
    padding: 8px 12px;
    gap: 8px;
  }
  .controls-left {
    gap: 6px;
    flex-wrap: wrap;
  }
  .controls-left > span {
    font-size: 1rem !important;
    padding-left: 10px !important;
    line-height: 1.2;
  }
  .palette { gap: 4px; }
  .color-option {
    width: 22px !important;
    height: 22px !important;
    border-width: 2px !important;
  }
  .controls-right {
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-start;
  }
  .controls-right .btn-control,
  .controls-right .btn-export-all {
    font-size: 0.8rem !important;
    padding: 6px 11px !important;
  }
  .postit-search {
    margin-left: 0 !important;
    flex: 1;
    min-width: 140px;
  }
  .postit-search input {
    font-size: 0.85rem;
    width: 100%;
  }
  .postit-toggle, .postit-mode-select {
    font-size: 0.82rem;
  }
}

/* Barre de recherche post-its */
.postit-search {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: 12px;
}

.postit-search input {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 30px 6px 32px;
  font-size: 0.88rem;
  width: 220px;
  background: #f8fafc;
  transition: border-color 0.2s, background 0.2s;
}

.postit-search input:focus {
  outline: none;
  border-color: #0ea5e9;
  background: white;
}

.postit-search::before {
  content: "🔍";
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  pointer-events: none;
  opacity: 0.6;
}

.postit-search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  color: #64748b;
  font-size: 1.1rem;
  line-height: 1;
  padding: 2px 6px;
  display: none;
}

.postit-search.has-value .postit-search-clear {
  display: block;
}

.postit-search-count {
  margin-left: 10px;
  font-size: 0.8rem;
  color: #64748b;
  white-space: nowrap;
}

/* Modale de détail d'un post-it */
#note-detail-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

#note-detail-overlay.visible {
  display: flex;
}

.note-detail-box {
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.note-detail-header {
  padding: 18px 22px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.note-detail-header h3 {
  margin: 0;
  font-size: 1.2rem;
  color: #0f172a;
  word-break: break-word;
}

.note-detail-close {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  color: #64748b;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
}

.note-detail-close:hover {
  color: #0f172a;
}

.note-detail-body {
  padding: 18px 22px;
  overflow-y: auto;
  flex: 1;
}

.note-detail-content {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 14px 16px;
  white-space: pre-wrap;
  -webkit-user-select: text;
  user-select: text;
  font-size: 0.95rem;
  line-height: 1.55;
  color: #1e293b;
  word-break: break-word;
}

.note-detail-meta {
  margin-top: 12px;
  font-size: 0.82rem;
  color: #64748b;
  font-style: italic;
}

.note-detail-actions {
  display: flex;
  gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  flex-wrap: wrap;
}

.note-detail-actions a,
.note-detail-actions button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: white;
  color: #1e293b;
  cursor: pointer;
  font-size: 0.85rem;
  text-decoration: none;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
}

.note-detail-actions a:hover,
.note-detail-actions button:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.note-detail-actions .primary {
  background: #0ea5e9;
  color: white;
  border-color: #0ea5e9;
}

.note-detail-actions .primary:hover {
  background: #0284c7;
  border-color: #0284c7;
}

.palette {
  display: flex;
  gap: 6px;
}

.color-option {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: transform 0.2s, border-color 0.2s;
}

.color-option:hover {
  transform: scale(1.15);
}

.color-option.selected {
  border-color: #334155;
  transform: scale(1.15);
}

/* Couleurs des post-its */
.bg-yellow {
  background-color: #fef9c3;
  border-left-color: #eab308;
}

.bg-blue {
  background-color: #dbeafe;
  border-left-color: #3b82f6;
}

.bg-green {
  background-color: #dcfce7;
  border-left-color: #22c55e;
}

.bg-pink {
  background-color: #fce7f3;
  border-left-color: #ec4899;
}

.bg-orange {
  background-color: #fed7aa;
  border-left-color: #f97316;
}

.bg-purple {
  background-color: #e9d5ff;
  border-left-color: #9333ea;
}

.bg-cyan {
  background-color: #cffafe;
  border-left-color: #06b6d4;
}

.bg-gray {
  background-color: #e5e7eb;
  border-left-color: #6b7280;
}

/* Board */
#board {
  position: relative;
  min-height: calc(100vh - 60px);
  padding: 20px;
}

/* =====================================================================
   VUE KANBAN
   ===================================================================== */
#kanban-board {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
  min-height: calc(100vh - 60px);
  overflow-x: auto;
  overflow-y: hidden;
}

.kanban-empty {
  width: 100%;
  text-align: center;
  padding: 60px 20px;
  font-style: italic;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.4);
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
}

.kanban-column {
  flex: 0 0 auto;
  width: 340px;
  max-height: calc(100vh - 100px);
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.kanban-column-unsorted {
  background: rgba(254, 243, 199, 0.55);
  border-color: rgba(202, 138, 4, 0.25);
}

.kanban-column-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.7);
  border-radius: 10px 10px 0 0;
  flex-shrink: 0;
}
.kanban-column-name {
  flex: 1 1 auto;
  font-weight: 700;
  color: #0f172a;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kanban-column-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
  background: #e2e8f0;
  border-radius: 11px;
}
.kanban-column-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.kanban-column:hover .kanban-column-actions {
  opacity: 1;
}
.kanban-col-action {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.kanban-col-action:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #0f172a;
}

.kanban-column-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 60px;
  transition: background 0.15s;
}
.kanban-column-body.is-dragover {
  background: rgba(59, 130, 246, 0.08);
  outline: 2px dashed #3b82f6;
  outline-offset: -4px;
  border-radius: 6px;
}

/* Carte post-it en mode kanban : flow normal, pas d'absolute, largeur plein conteneur */
.note.note-kanban {
  position: relative;
  width: 100%;
  min-height: 0;
  max-height: none;
  padding: 16px 50px 12px 18px;
  cursor: grab;
}
.note.note-kanban.is-dragging {
  opacity: 0.4;
  cursor: grabbing;
}
.note.note-kanban:active { cursor: grabbing; }

/* En kanban, on n'a pas besoin du gradient de masquage (pas de hauteur fixe) */
.note.note-kanban.note--overflow .note-content-text {
  -webkit-mask-image: none;
  mask-image: none;
}

/* Sélecteur de mode dans la barre de contrôle */
.postit-mode-select {
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  font-size: 0.85rem;
  color: #334155;
  cursor: pointer;
}
.postit-mode-select:hover {
  border-color: #94a3b8;
}

.btn-add-column {
  background: #8b5cf6;
  color: white;
}
.btn-add-column:hover { background: #7c3aed; }

/* Notes (Post-its) */
.note {
  position: absolute;
  width: 320px;
  min-height: 220px;
  max-height: 400px;
  padding: 18px 50px 14px 36px; /* +16px à gauche pour la poignée de drag */
  border-radius: 3px;
  box-shadow:
    3px 3px 10px rgba(0, 0, 0, 0.12),
    1px 1px 4px rgba(0, 0, 0, 0.06);
  /* cursor:grab retiré du note entier → seul .note-drag-handle est attrapable.
     Ça libère le scroll au doigt sur mobile : taper sur le titre/contenu fait
     défiler la page, on ne déplace QUE quand on saisit la poignée. */
  cursor: default;
  -webkit-user-select: none;
  user-select: none;
  transition: box-shadow 0.2s, transform 0.15s;
  display: flex;
  flex-direction: column;
  word-wrap: break-word;
  overflow-wrap: break-word;
  border-left: 4px solid rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.note--hidden {
  display: none !important;
}

/* Poignée de drag — seul élément qui déclenche le déplacement du post-it.
   Sans poignée explicite, taper sur la note déclenchait le drag → impossible
   de scroller la page au doigt. Avec la poignée : taper sur le titre/contenu
   scrolle normalement, et seule la saisie de la poignée bouge la note. */
.note-drag-handle {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  color: rgba(0, 0, 0, 0.35);
  font-size: 1.1rem;
  line-height: 1;
  border-radius: 5px;
  transition: background 0.15s, color 0.15s;
  /* Empêche la sélection / la callout iOS lors du long-press */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  /* touch-action:none : indique au navigateur de NE PAS scroller quand le
     doigt commence sur la poignée (sinon le navigateur prend le contrôle
     dès le touchstart et empêche le drag custom). */
  touch-action: none;
  z-index: 2;
}
.note-drag-handle:hover {
  background: rgba(0, 0, 0, 0.08);
  color: rgba(0, 0, 0, 0.6);
}
.note-drag-handle:active {
  cursor: grabbing;
  background: rgba(0, 0, 0, 0.12);
}

/* .note-expand-btn : styles dans le bloc .note-icon-btn (pictogramme « voir ») */

.note--overflow .note-content-text {
  -webkit-mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
  mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
}

.note:hover {
  box-shadow:
    5px 8px 20px rgba(0, 0, 0, 0.16),
    2px 3px 6px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.note:active {
  box-shadow:
    8px 12px 26px rgba(0, 0, 0, 0.22),
    3px 4px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-3px);
}

.note h3 {
  margin: 0 0 6px 0;
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.3;
}

/* Liens cliquables dans les post-its et la modale détail : couleur bleue
   ouverte dans un nouvel onglet (cf. linkifyEscaped() dans tableau_postit.php) */
.postit-link {
  color: #0369a1;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}
.postit-link:hover {
  color: #075985;
  background: rgba(3, 105, 161, 0.08);
}

/* =====================================================================
   POST-ITS : IMAGE ATTACHÉE
   ===================================================================== */
.note-image-wrap {
  margin: 8px 0;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.04);
  flex-shrink: 0;
}
.note-image {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  cursor: zoom-in;
  transition: transform 0.18s ease;
}
.note-image:hover { transform: scale(1.02); }

/* Champ d'upload d'image dans la modale de création */
.postit-image-field {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #e2e8f0;
}
.postit-image-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 0.9em;
  color: #475569;
  background: #f1f5f9;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.postit-image-label:hover { background: #e2e8f0; border-color: #94a3b8; }
.postit-image-hint { font-size: 0.75em; color: #94a3b8; margin-top: 4px; }
.postit-image-preview {
  position: relative;
  display: inline-block;
  margin-top: 10px;
  max-width: 200px;
}
.postit-image-preview img {
  display: block;
  max-width: 100%;
  max-height: 140px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}
.postit-image-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: #dc2626;
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
.postit-image-remove:hover { background: #b91c1c; }

/* Image dans la modale de détail */
.note-detail-image {
  margin-bottom: 12px;
  text-align: center;
}
.note-detail-image img {
  max-width: 100%;
  max-height: 60vh;
  border-radius: 6px;
  cursor: zoom-in;
}

/* =====================================================================
   LIGHTBOX IMAGE PLEIN ÉCRAN
   ===================================================================== */
#image-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 40px;
  cursor: zoom-out;
}
#image-lightbox.visible { display: flex; }
#image-lightbox img {
  max-width: 95vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.image-lightbox-close {
  position: absolute;
  top: 20px;
  right: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  z-index: 1;
  transition: background 0.15s;
}
.image-lightbox-close:hover { background: rgba(255, 255, 255, 0.3); }

/* =====================================================================
   RÉACTIONS EMOJI — déclencheur sur la bordure droite + panneau flottant
   ===================================================================== */
.note-reactions-wrap {
  position: absolute;
  top: 40px;
  right: 6px;
  z-index: 3;
}
.note-reactions-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 1.1em;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.18s ease;
  -webkit-user-select: none;
  user-select: none;
  line-height: 1;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.note-reactions-trigger:hover {
  background: rgba(255, 255, 255, 1);
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.note-reactions-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  background: #ef4444;
  color: #fff;
  border-radius: 9px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Panneau flottant : déplié au survol (ou focus) du wrapper */
.note-reactions-panel {
  position: absolute;
  top: 50%;
  right: 100%;
  margin-right: 8px;
  transform: translateY(-50%) translateX(8px);
  display: flex;
  gap: 4px;
  padding: 6px 8px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  white-space: nowrap;
}
/* Petite flèche pointant vers le déclencheur */
.note-reactions-panel::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 100%;
  width: 8px;
  height: 8px;
  background: #fff;
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  transform: translate(-50%, -50%) rotate(45deg);
}
.note-reactions-wrap.is-open .note-reactions-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) translateX(0);
}
.note-reactions-panel .reaction {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  font-size: 1.05em;
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
  -webkit-user-select: none;
  user-select: none;
  line-height: 1;
}
.note-reactions-panel .reaction:hover {
  transform: scale(1.25);
  background: #f1f5f9;
}
.note-reactions-panel .reaction.is-mine {
  background: #dbeafe;
}
.note-reactions-panel .reaction .r-count {
  position: absolute;
  bottom: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  background: #ef4444;
  color: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.note-reactions-panel .reaction.is-mine .r-count {
  background: #1e40af;
}

/* =====================================================================
   POST-IT FOOTER : pictogrammes (commentaires + voir)
   ===================================================================== */
.note-footer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.note-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 6px;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}
.note-icon-btn:hover {
  background: #fff;
  color: #0f172a;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}
.note-icon-btn svg {
  width: 16px;
  height: 16px;
}
.note-comments-btn .comments-bubble {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  background: #3b82f6;
  color: #fff;
  border-radius: 9px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* =====================================================================
   MENU EXPORT (dropdown à côté du bouton Copier)
   ===================================================================== */
.postit-menu {
  position: relative;
  display: inline-flex;
}
.postit-menu-trigger svg {
  width: 14px;
  height: 14px;
  color: #334155;
}
.postit-menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 120px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
  padding: 4px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 10;
}
/* Pont invisible entre le déclencheur et le menu : évite que le hover se rompe
   quand la souris traverse les quelques pixels qui séparent les deux. */
.postit-menu-dropdown::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 12px;
  background: transparent;
}
.postit-menu:hover .postit-menu-dropdown,
.postit-menu:focus-within .postit-menu-dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.postit-menu-dropdown a {
  display: block;
  padding: 6px 10px;
  font-size: 0.85rem;
  color: #334155;
  text-decoration: none;
  border-radius: 4px;
  transition: background 0.12s;
}
.postit-menu-dropdown a:hover {
  background: #f1f5f9;
  color: #0f172a;
}
/* Séparateur visuel entre Modifier et les exports */
.postit-menu-dropdown a + a {
  border-top: 1px solid #f1f5f9;
}

/* Badge « modifiable par tous » dans le titre du post-it */
.note-shared-badge {
  display: inline-block;
  margin-right: 6px;
  font-size: 0.85em;
  vertical-align: middle;
  opacity: 0.85;
  filter: hue-rotate(0deg);
}

/* Palette de couleurs dans la modale d'édition */
#modal-color-palette .palette {
  display: flex;
  gap: 4px;
}
#modal-color-palette .modal-color-option {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.12s, border-color 0.12s;
}
#modal-color-palette .modal-color-option:hover {
  transform: scale(1.15);
}
#modal-color-palette .modal-color-option.selected {
  border-color: #0f172a;
  transform: scale(1.1);
}

/* Toggle « Commentaires » dans la barre de contrôle (admin) */
.postit-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9em;
  color: #475569;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.postit-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* =====================================================================
   COMMENTAIRES (modale)
   ===================================================================== */
#comments-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9500;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#comments-overlay.visible { display: flex; }
.comments-box {
  background: #fff;
  border-radius: 10px;
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.comments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}
.comments-header h3 {
  margin: 0;
  font-size: 1.1em;
  color: #0f172a;
}
.comments-close {
  background: transparent;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #64748b;
  padding: 4px 8px;
  border-radius: 6px;
}
.comments-close:hover { background: #e2e8f0; }
.comments-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.comments-empty {
  text-align: center;
  color: #94a3b8;
  padding: 30px 10px;
  font-style: italic;
  font-size: 0.9em;
}
.comment-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
}
.comment-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 0.82em;
}
.comment-head strong { color: #0f172a; }
.comment-date {
  color: #94a3b8;
  flex: 1 1 auto;
}
.comment-del {
  background: transparent;
  border: none;
  color: #dc2626;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.comment-del:hover { background: #fee2e2; }
.comment-body {
  font-size: 0.92em;
  color: #334155;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.comments-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}
.comments-form textarea {
  flex: 1 1 auto;
  resize: vertical;
  min-height: 40px;
  max-height: 120px;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.9em;
  font-family: inherit;
}
.comments-form textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.note-content-text {
  margin: 0;
  font-size: 0.9rem;
  color: #334155;
  line-height: 1.5;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  white-space: pre-wrap;
}

/* Footer du post-it : export à gauche, auteur à droite */
.note-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
  margin-top: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding-top: 8px;
}

.note-author {
  font-size: 0.72rem;
  color: #64748b;
  font-style: italic;
  text-align: right;
  white-space: nowrap;
}

/* Actions sur les notes */
.postit-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.note:hover .postit-actions {
  opacity: 1;
}

.btn-icon {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.7);
  transition: background 0.2s;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 1);
}

.btn-delete {
  color: #ef4444;
}

/* .postit-export-bar : remplacé par .postit-menu-dropdown (menu déroulant à côté de Copier) */

/* Boutons de contrôle */
.btn-control {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-range {
  background: #e2e8f0;
  color: #475569;
}

.btn-range:hover {
  background: #cbd5e1;
}

.btn-save-layout {
  background: #0ea5e9;
  color: white;
}
.btn-save-layout:hover { background: #0284c7; }

.btn-reset-layout {
  background: #fbbf24;
  color: #78350f;
}
.btn-reset-layout:hover { background: #f59e0b; color: #fff; }

.btn-add {
  background: #3b82f6;
  color: white;
}

.btn-add:hover {
  background: #2563eb;
}

.btn-export-all {
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  background: #f1f5f9;
  color: #475569;
  text-decoration: none;
  border: 1px solid #e2e8f0;
  transition: all 0.2s;
}

.btn-export-all:hover {
  background: #e2e8f0;
  color: #334155;
}

/* Modal nouveau post-it */
#modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  justify-content: center;
  /* flex-start (et NON center) : sur petit écran (mobile, clavier ouvert), le
     contenu de la modale dépasse la hauteur du viewport. Avec align-items:center
     le HAUT de la boîte (titre + textarea) était poussé hors écran et devenait
     inaccessible (l'overlay ne défilait pas) → impossible d'écrire dans la note.
     flex-start + overflow:auto + margin:auto sur la boîte = centré quand ça
     tient, défilable et haut accessible quand ça dépasse. */
  align-items: flex-start;
  overflow-y: auto;
  padding: 24px 12px;
  box-sizing: border-box;
}

#modal-box {
  background: white;
  padding: 30px;
  border-radius: 12px;
  width: 90%;
  max-width: 450px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
  /* Recentre verticalement quand le contenu tient dans l'overlay ; quand il
     dépasse, laisse le scroll de l'overlay atteindre le haut comme le bas. */
  margin: auto;
}

#modal-box h3 {
  margin: 0 0 10px 0;
  font-size: 1.2rem;
}

#modal-box input[type="text"],
#modal-box textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.95rem;
  margin-bottom: 12px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

#modal-box input[type="text"]:focus,
#modal-box textarea:focus {
  border-color: #3b82f6;
}

#modal-box textarea {
  min-height: 100px;
  resize: vertical;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 5px;
}

/* ========================================================= */
/* ÉCRANS LARGES (≥ 1921px / 4K)                              */
/* ========================================================= */
/* Évite l'étirement infini du contenu sur écrans très larges.
   On garde une largeur de lecture confortable + baseline font légèrement augmentée. */
@media (min-width: 1921px) {
  html { font-size: 17px; }
  .room-container,
  .qna-container,
  .ask-form,
  .feature-block-grid,
  .dashboard-blocks-grid {
    max-width: 1800px;
    margin-left: auto;
    margin-right: auto;
  }
  /* Chat docké : on conserve sa largeur de 350px (pas besoin de 4K) */
}

/* ========================================================= */
/* CIBLES TACTILES — boutons & inputs sur mobile             */
/* ========================================================= */
@media (max-width: 768px) {
  /* Anti-zoom iOS : tout input qui prend le focus doit être ≥16px */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="search"],
  input[type="date"],
  input[type="time"],
  input[type="tel"],
  input[type="url"],
  textarea,
  select {
    font-size: 16px !important;
  }

  /* Boutons d'action principaux : 44px de hauteur minimum */
  .btn-primary,
  .btn-secondary,
  .btn-success,
  .btn-danger,
  button[type="submit"],
  .btn-quit,
  .btn-send,
  .btn-ask {
    min-height: 44px;
    padding: 10px 16px;
  }

  /* Q&A : boutons de vote & d'action plus accessibles */
  .vote-btn {
    width: 48px !important;
    height: 48px !important;
  }
  .q-action-btn {
    min-height: 36px;
    padding: 8px 14px !important;
  }

  /* Feedback bar (PEDA-4 + ANIM-4) : icônes plus grandes */
  #feedbackBar .fb-btn {
    min-width: 40px;
    min-height: 40px;
    font-size: 1.1rem;
  }
}