@media (max-width: 768px) {
  .portal-header {
    padding: 0.5rem 0;
  }

  .navbar-brand img.header-logo {
    width: 80px !important;
  }

  .hex-menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5em;
  }

  .hex-btn {
    width: 100%;
    text-align: center;
    margin-bottom: 1em;
  }

  .hex-btn img {
    max-width: 140px;
    height: auto;
  }

  .hex-btn-label {
    display: block;
    font-size: 0.85em;
    margin-bottom: 0.3em;
  }

  .notif-panel {
    position: static;
    width: 100%;
    border-radius: 0;
    box-shadow: none;
  }

  #notif-count {
    top: -6px;
    right: -6px;
    font-size: 0.8em;
  }
}
/* Chat layout global (mobile-first, ajusté pour petits écrans) */
@media (max-width: 768px) {
  #chat-container {
    flex-direction: column;
    height: auto;
    position: relative;
  }

  /* ----- SIDEBAR ----- */
  #sidebar {
    width: 100%;
    padding: 1em;
    overflow-y: auto;
    border-radius: 0;
    background-color: #1e1e2f;
  }

  .sidebar-panel-header,
  .sidebar-subpanel-header {
    font-size: 1em;
    padding: 0.6em;
  }

  .sidebar-icon-img {
    width: 20px;
    height: 20px;
    margin-right: 6px;
  }

  .sidebar-input,
  .sidebar-action-btn {
    width: 100%;
    font-size: 1em;
    margin-bottom: 0.5em;
  }

  #mini-music-player {
    width: 100%;
    height: 60px;
    margin-top: 0.5em;
  }

  /* ----- MAIN CHAT ----- */
  #main-chat {
    width: 100%;
    padding: 1em;
    overflow-y: auto;
  }

  #chat-header {
    font-size: 1em;
    margin-bottom: 1em;
    display: flex;
    flex-direction: column;
    gap: 0.4em;
  }

  #chat-history-container {
    max-height: 60vh;
    overflow-y: auto;
  }

  #chat-form {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
    margin-top: 1em;
  }

  #editor-toolbar-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5em;
  }

  .editor-btn img {
    width: 28px;
    height: 28px;
  }

  #character-selection-area {
    width: 100%;
    display: flex;
    gap: 0.5em;
    align-items: center;
  }

  #characterSelect {
    flex: 1;
  }

  textarea#message {
    min-height: 60px;
    resize: vertical;
    font-size: 1em;
  }

  /* ----- RIGHT SIDEBAR ----- */
  #right-sidebar {
    width: 100%;
    padding: 1em;
    order: 3;
    background-color: #1e1e2f;
  }

  .authors-avatar-list {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6em;
  }

  .author-avatar {
    width: 40px;
    height: 40px;
  }

  .authors-section-title-rotated {
    font-size: 1em;
    text-align: center;
    margin-bottom: 1em;
  }

  #selected-user-characters-panel {
    padding: 1em;
  }

  #back-to-user-lists-btn {
    font-size: 0.9em;
  }

  /* ----- Slide Button ----- */
  #slide-right-button {
    position: fixed;
    bottom: 1em;
    right: 1em;
    z-index: 10;
    padding: 0.6em 1em;
    font-size: 1.4em;
    background: #007bff;
    color: white;
    border-radius: 50px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    display: block;
  }
}

/* Slide mode pour ultra-mobile (≤576px) */
@media (max-width: 576px) {
  #chat-container {
    flex-direction: row;
    position: relative;
    overflow: hidden;
  }

  #sidebar,
  #main-chat,
  #right-sidebar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    transform: translateX(100%);
    transition: transform 0.4s ease-in-out;
    z-index: 0;
    overflow-y: auto;
  }

  .active-section {
    transform: translateX(0%);
    z-index: 2;
  }

  /* Slide button visible en mode mobile */
  #slide-right-button {
    display: block;
  }
}