/* 2. INTERFACE UTILISATEUR (UI)
   Panneaux, Boutons, Modales, File d'attente, Responsive UI
*/

/* ==========================================================================
   MODALE DE CONNEXION & NOTIFICATION TOAST
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  padding: 30px;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  width: 90%;
  max-width: 400px;
}

.modal-content h2 {
  margin-top: 0;
  color: #386641;
}

#passwordInput {
  width: 100%;
  padding: 10px;
  margin: 15px 0;
  border: 1px solid #ccc;
  border-radius: 5px;
  box-sizing: border-box;
}

#loginButton {
  background-color: #6a994e;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#loginButton:hover {
  background-color: #386641;
}

/* --- Notification Toast --- */
.toast-notification {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) translateY(100px);
  background-color: #386641;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  z-index: 2001;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  will-change: transform, opacity;
}

.toast-notification.error {
  background-color: #c5221f;
}

.toast-notification.show {
  transform: translate(-50%, -50%) translateY(0);
  opacity: 1;
}

/* ==========================================================================
   STRUCTURE PRINCIPALE (LAYOUT)
   ========================================================================== */
.container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 10px;
  gap: 10px;
}

.main-content {
  display: flex;
  flex-direction: row;
  flex-grow: 1;
  gap: 10px;
  overflow: hidden;
  min-height: 0;
}

/* --- Wrapper pour l'aperçu --- */
.preview-wrapper {
  flex: 1;
  display: flex;
  position: relative;
  min-width: 0;
  height: 100%;
  min-height: 0;
}

.printContainer {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  min-width: 0;
  overflow: hidden;
  background-color: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  position: relative; /* Important pour l'overlay message */
}

.preview-area {
  overflow: hidden;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  width: 100%;
  height: 100%;
  padding-left: 3em;
}

/* --- Styles des Panneaux --- */
.panel {
  display: flex;
  flex-direction: column;
  gap: 15px;
  color: #333333;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  height: 100%;
  overflow-y: auto;
  font-family: 'Open Sans', sans-serif;
  min-height: 0;
  position: relative;
}

.config-panel {
  flex: 0 0 224px;
  background-color: #f8f9fa;
  padding-bottom: 90px !important; /* Espace pour les boutons Messages/Logout */
}

/* Bottom Actions dans Config Panel (NOUVEAU) */
.config-bottom-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 15px;
    background: #f8f9fa; /* Meme fond que panel */
    border-top: 1px solid #eee;
    display: flex;
    justify-content: center;
    gap: 15px;
    border-radius: 0 0 12px 12px;
    z-index: 10;
}

.bottom-action-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    position: relative;
}
.bottom-action-btn:hover { transform: scale(1.1); }
.bottom-action-btn.msg { background-color: #D75000; }
.bottom-action-btn.logout { background-color: #c5221f; }
.bottom-action-btn.admin { background-color: #333; border: 1px solid #555; }

.bottom-action-btn .badge-dot { 
    position: absolute; top: 0; right: 0; 
    width: 12px; height: 12px; 
    background: #c5221f; border: 2px solid white; border-radius: 50%; 
}

.input-panel {
  flex: 0 0 400px;
  background-color: #ffffff;
  transition: flex-basis 0.3s ease;
}

/* PANEL PARAMETRES (Remplace Data Panel) */
.settings-panel {
    display: none; /* Caché par défaut */
    flex: 0 0 400px;
    background-color: #fdfdfd;
    border-left: 4px solid #386641;
    overflow-y: auto;
    animation: slideInRight 0.3s ease-out;
}
.settings-panel.active { display: flex; }

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* HEADER SETTINGS */
.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
}
.close-settings-btn {
    background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #666;
}
.close-settings-btn:hover { color: #c5221f; }

/* TITRES AVEC BOUTON REGLAGE */
.panel-group-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: #333333;
  margin: 0 0 12px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mini-settings-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: #888;
    transition: color 0.2s, transform 0.2s;
    padding: 2px 5px;
    border-radius: 4px;
}
.mini-settings-btn:hover {
    color: #386641;
    background-color: #e6f4ea;
    transform: rotate(30deg);
}

/* CONTROLES SETTINGS */
.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 8px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
}
.setting-label { font-size: 0.9rem; font-weight: 600; }
.setting-input-color {
    width: 40px; height: 30px; border: none; padding: 0; background: none; cursor: pointer;
}
.setting-select {
    padding: 5px; border-radius: 4px; border: 1px solid #ccc; font-size: 0.85rem;
}

/* Visibility Toggles List */
.visibility-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.visibility-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    padding: 5px 0;
    border-bottom: 1px dashed #eee;
}

/* --- Toggle Switch CSS --- */
.switch { position: relative; display: inline-block; width: 34px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc; transition: .4s; border-radius: 20px;
}
.slider:before {
  position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px;
  background-color: white; transition: .4s; border-radius: 50%;
}
input:checked + .slider { background-color: #386641; }
input:checked + .slider:before { transform: translateX(14px); }

/* ==========================================================================
   ÉLÉMENTS DE PANNEAU (TITRES, CHAMPS)
   ========================================================================== */
.panel-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #386641;
  margin: 0 0 10px 0;
  text-align: center;
}

.panel-group {
  border-bottom: 1px solid #eee;
  padding-bottom: 15px;
  margin-bottom: 5px;
}

.panel-group:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  margin-bottom: 10px;
}

.control-group:last-child {
  margin-bottom: 0;
}

.panel label {
  font-family: 'Open Sans', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  color: #333333;
}

.label-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: -5px;
}

/* --- Champs de Saisie (Inputs, Textarea) --- */
#plantSearch, 
#plantSelect, 
.poster-type-controls input[type="text"], 
.poster-type-controls input[type="number"], 
.poster-type-controls select, 
.poster-type-controls textarea, 
.panel input[type="text"], 
.panel input[type="number"], 
.panel select, 
.panel textarea {
  font-family: 'Roboto', sans-serif;
  font-weight: 400;
  font-size: 1rem;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s, padding-left 0.2s;
  -moz-appearance: none; 
  appearance: none;
}

.panel select, .poster-type-controls select {
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23333%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7em top 50%;
  background-size: 0.65em auto;
  padding-right: 1.5em;
}

.input-panel input[type="text"], 
.input-panel textarea {
  text-transform: uppercase;
}

.input-panel #plantSearch {
  text-transform: none;
}

::-webkit-input-placeholder { opacity: 0.55; }
::-moz-placeholder { opacity: 0.55; }
:-ms-input-placeholder { opacity: 0.55; }
::placeholder { opacity: 0.55; }

#plantSearch:focus, 
#plantSelect:focus, 
.poster-type-controls input:focus, 
.poster-type-controls select:focus, 
.poster-type-controls textarea:focus, 
.panel input:focus, 
.panel select:focus, 
.panel textarea:focus {
  outline: none;
  border-color: #386641;
  box-shadow: 0 0 0 2px rgba(56, 102, 65, 0.2);
}

input:invalid, textarea:invalid {
    box-shadow: none;
}

.input-error {
  border-color: #e53e3e !important;
  box-shadow: 0 0 0 2px rgba(229, 62, 62, 0.4) !important;
  padding-left: 28px !important;
}

.control-group .input-error::before {
  content: '?';
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(2px);
  font-size: 1.3rem;
  font-weight: bold;
  color: #e53e3e;
  z-index: 2;
  line-height: 1;
}

.control-group textarea.input-error::before {
  top: 18px;
  transform: translateY(0);
}

.control-group select.input-error::before {
  top: 50%;
  transform: translateY(2px);
}

.calculated-price-display {
  display: inline-block;
  padding: 10px;
  background: #eee;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-weight: bold;
  min-width: 60px;
  text-align: right;
  font-size: 1rem;
  color: #333333;
}

.poster-type-controls {
  border: 1px solid #eee;
  padding: 10px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

#promoTypeInputs {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 8px;
}

/* ==========================================================================
   BOUTONS DE CONFIGURATION (TOGGLES)
   ========================================================================== */
.toggle-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.toggle-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-weight: 600;
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;


  cursor: pointer;
  transition: all 0.2s;
  background-color: #f0f0f0;
  color: #555;
  user-select: none;
  text-align: center;
  gap: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  height: auto;
  aspect-ratio: 1 / 1;
  padding: 8px;
}

.toggle-btn:hover {
  border-color: #888;
}

.toggle-btn.selected {
  border-color: #386641;
  background-color: #386641;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 0 10px 2px rgba(56, 102, 65, 0.4);
}

.icon-toggle-btn {
  flex-direction: column;
  gap: 4px;
}

.icon-toggle-btn .icon-char {
  font-size: 1.6rem;
  line-height: 1.1;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
}

.icon-char .icone {
  height: 40px;
  width: auto;
  object-fit: contain;
}

.icon-toggle-btn .icon-label {
  font-size: 0.65rem;
  line-height: 1;
  font-weight: 600;
  text-transform: uppercase;
  font-family: 'Poppins', sans-serif;
}

.icon-toggle-btn[data-type="conseil"] .icon-char {
  font-style: italic;
  font-family: serif;
  font-weight: bold;
  font-size: 1.8rem;
}

.icon-orient-port, .icon-orient-land {
  border: 2px solid currentColor;
  border-radius: 2px;
}
.icon-orient-port { width: 14px; height: 20px; }
.icon-orient-land { width: 20px; height: 14px; }

.toggle-btn.enseigne-btn {
  padding: 5px;
}

.enseigne-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 4px;
  display: block;
}

.toggle-btn.enseigne-btn.selected {
  background-color: #fff;
}

.horaires-toggle-group {
  grid-template-columns: 1fr 1fr 1fr;
}

.horaires-toggle-group .toggle-btn {
  aspect-ratio: auto;
  height: 40px;
  font-size: 0.8rem;
}

/* ==========================================================================
   PANNEAU D'EXPORT PDF & FILE D'ATTENTE
   ========================================================================== */
#pdfBtnGroup {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 224px;
  z-index: 10;
  gap: 15px;
  background: #f8f9fa;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  overflow-y: auto;
  min-height: 0;
}

#pdfBtnGroup .panel-group-title {
  margin: 0 0 12px 0;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: #333333;
}

.quantity-input {
  display: flex;
  align-items: center;
  width: 100%;
}

.quantity-input input[type="number"] {
  width: 100%;
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
  border-radius: 0;
  border-left: none;
  border-right: none;
  padding: 10px 5px;
  -moz-appearance: textfield; /* Standard Firefox */
}

.quantity-input input[type="number"]::-webkit-outer-spin-button, 
.quantity-input input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.quantity-btn {
  flex: 0 0 44px;
  height: 44px;
  border: 1px solid #ccc;
  background-color: #f0f0f0;
  font-size: 1.5rem;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  transition: background-color 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.quantity-btn:hover {
  background-color: #e0e0e0;
}

#quantityDecrease { border-radius: 8px 0 0 8px; }
#quantityIncrease { border-radius: 0 8px 8px 0; }

.action-btn {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 12px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  margin-top: 10px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.action-btn:active {
  transform: scale(0.98);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.add-btn {
  background-color: #D75000;
  color: white;
}
.add-btn:hover { background-color: #b34200; }

.queue-btn {
  background-color: #386641;
  color: white;
}
.queue-btn:hover { background-color: #6a994e; }

/* --- Modale de la File d'attente --- */
.queue-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.queue-modal-content {
  background: white;
  border-radius: 12px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.25);
  width: 90%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}

.queue-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #eee;
}

.queue-modal-header .panel-group-title {
  border-bottom: none;
  margin: 0;
  padding: 0;
}

.queue-modal-body {
  overflow-y: auto;
  padding: 10px;
  background: #fdfdfd;
  flex-grow: 1;
  min-height: 0;
}

.queue-modal-footer {
  padding: 15px 20px;
  border-top: 1px solid #eee;
  background: #f9f9f9;
  border-radius: 0 0 12px 12px;
}

.queue-empty-msg {
  text-align: center;
  color: #888;
  padding: 20px;
  font-size: 0.9rem;
}

.queue-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid #eee;
}

.queue-item:last-child {
  border-bottom: none;
}

.queue-item-details {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  gap: 2px;
}

.queue-item-format {
  font-size: 0.75rem;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
}

.queue-item-name {
  font-size: 0.95rem;
  font-weight: 600;
}

.queue-item-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-queue-btn {
  font-family: 'Poppins', sans-serif;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.modal-queue-btn.quantity-btn {
  background-color: #f0f0f0;
  color: #333;
  font-weight: bold;
  width: 28px;
  height: 28px;
  font-size: 1.2rem;
  padding-bottom: 2px;
}

.modal-queue-btn.quantity-btn:hover {
  background-color: #ddd;
}

.queue-item-quantity {
  font-size: 1rem;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}

.modal-queue-btn.delete {
  background-color: #fce8e6;
  color: #c5221f;
  font-weight: bold;
  width: 30px;
  height: 30px;
  margin-left: 10px;
}

.modal-queue-btn.delete:hover {
  background-color: #e53e3e;
  color: white;
}

.queue-actions {
  display: flex;
  gap: 10px;
}


.modal-queue-btn.generate, .modal-queue-btn.clear {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 10px;
}

.modal-queue-btn.generate {
  background-color: #386641;
  color: white;
}
.modal-queue-btn.generate:hover { background-color: #6a994e; }

.modal-queue-btn.clear {
  background-color: #eee;
  color: #555;
}
.modal-queue-btn.clear:hover { background-color: #ddd; }

/* ==========================================================================
   CONTROLES SPÉCIFIQUES (LISTE, POLICE)
   ========================================================================== */
/* --- Liste de plantes custom --- */
#plantSelect { display: block; }
#plantSelectList { display: none; }

.input-panel.conseil-list-active {
  overflow: hidden;
}

.input-panel.conseil-list-active #plantControls {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.input-panel.conseil-list-active #plantControls .control-group:last-child {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.input-panel.conseil-list-active #plantSelect {
  display: none; 
}

.input-panel.conseil-list-active #plantSelectList {
  display: block;
  flex-grow: 1;
  overflow-x: scroll;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 5px;
  margin-top: 5px;
}

.plant-select-item {
  padding: 8px 10px;
  cursor: pointer;
  border-radius: 4px;
  font-size: 1rem;
}

.plant-select-item:hover {
  background-color: #f0f0f0;
}

.plant-select-item.selected {
  background-color: #386641;
  color: white;
  font-weight: 600;
}

.plant-select-item strong {
  font-weight: 700;
  color: inherit;
}

.plant-select-item em {
  font-style: italic;
  font-size: 1em;
  color: #386641; 
}

.plant-select-item.selected em {
  color: white;
  opacity: 0.8;
}

/* --- Contrôles de police --- */
.font-size-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
}

.diameter-btn {
  width: 24px;
  height: 24px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #f9f9f9;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  user-select: none;
  margin-right: 5px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.diameter-btn:hover { background: #eee; }

.font-size-btn {
  width: 24px;
  height: 24px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #f9f9f9;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  padding-bottom: 2px;
  user-select: none;
  transition: all 0.2s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.font-size-btn:hover { background: #eee; }

.font-size-btn.small { font-size: 10px; }
.font-size-btn.medium { font-size: 13px; }
.font-size-btn.large { font-size: 16px; }

.font-size-btn.selected {
  background-color: #386641;
  color: white;
  border-color: #386641;
}

/* --- FENÊTRE MESSAGERIE (FULLSCREEN OVERLAY) --- */
.messaging-window {
    position: fixed; 
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #f5f5f5; /* Gris très clair pour fond */
    z-index: 5000;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.messaging-window.active {
    transform: translateY(0);
}

.messaging-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: #fff;
    border-bottom: 1px solid #eee;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.messaging-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 1.4rem;
    color: #333;
    margin: 0;
}

.close-messaging-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #666;
    transition: color 0.2s;
}
.close-messaging-btn:hover { color: #c5221f; }

/* LAYOUT MESSAGERIE USER (SPLIT & CENTERED) */

.messaging-body-split {
    display: flex;
    height: 100%;
    overflow: hidden;
    background-color: #fff;
    
    /* CENTRAGE ET MAX WIDTH */
    width: 100%;
    max-width: 1200px; /* Largeur max confortable */
    margin: 20px auto; /* Centré horizontalement avec marge haut/bas */
    border-radius: 12px; /* Coins arrondis */
    box-shadow: 0 5px 25px rgba(0,0,0,0.1); /* Ombre portée */
    border: 1px solid #eee;
}

/* Sidebar Gauche (Sujets) */
.msg-sidebar {
    width: 300px;
    border-right: 1px solid #eee;
    background-color: #fbfbfb;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.msg-sidebar-header {
    padding: 20px;
    font-size: 0.85rem;
    color: #666;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
    background-color: #f5f5f5;
    border-bottom: 1px solid #eee;
}

.msg-subjects-list {
    flex-grow: 1;
    overflow-y: auto;
}

.msg-subject-item {
    padding: 15px 20px;
    cursor: pointer;
    font-size: 1rem;
    color: #444;
    border-left: 4px solid transparent;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f0f0f0;
}

.msg-subject-item:hover {
    background-color: #fff;
}

.msg-subject-item.active {
    background-color: #fff;
    border-left-color: #386641;
    color: #386641;
    font-weight: 700;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.msg-unread-badge {
    width: 10px;
    height: 10px;
    background-color: #c5221f;
    border-radius: 50%;
    display: inline-block;
}

/* Zone Chat Droite */
.msg-chat-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background-color: white;
    position: relative;
}

.chat-header-subject {
    padding: 15px 30px;
    border-bottom: 1px solid #eee;
    font-weight: 700;
    font-size: 1.1rem;
    color: #333;
    font-family: 'Poppins', sans-serif;
    background-color: #fff;
}

.chat-history {
    flex-grow: 1;
    overflow-y: auto;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background-color: #fff;
    /* Centrage du contenu large */
    align-items: center; 
}

/* Conteneur de message */
.user-msg-bubble {
    width: 100%;
    max-width: 700px;
    padding: 20px;
    border-radius: 12px;
    font-family: 'Open Sans', sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    position: relative;
}

/* Messages CLIENT (Moi) */
.user-msg-bubble.me {
    margin-left: auto; /* Pousse à droite */
    margin-right: 0;
    background-color: #dcfce7; /* Vert très clair */
    border: 1px solid #bbf7d0;
}

/* Messages ADMIN (Support) - BLEUTÉ */
.user-msg-bubble.admin {
    margin-right: auto; /* Pousse à gauche */
    margin-left: 0;
    background-color: #E3F2FD; /* Bleu très clair */
    border: 1px solid #BBDEFB; /* Bleu 100 */
    color: #0D47A1; /* Bleu Foncé */
}

.bubble-meta {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    opacity: 0.9;
    display: block;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding-bottom: 5px;
}

.user-msg-bubble.admin .bubble-meta {
    color: #1565C0; /* Bleu pour le meta admin */
}

.bubble-content {
    color: #333;
}

/* Barre de saisie chat */
.chat-input-wrapper {
    padding: 20px 30px;
    border-top: 1px solid #eee;
    display: flex;
    align-items: flex-end; /* Alignement bas */
    gap: 15px;
    background: #fcfcfc;
    justify-content: center;
}

.chat-input-wrapper textarea {
    flex-grow: 1;
    max-width: 800px;
    border: 1px solid #ccc;
    border-radius: 24px;
    padding: 12px 20px;
    font-family: inherit;
    resize: none;
    min-height: 45px;
    max-height: 120px;
    line-height: 1.4;
    outline: none;
    font-size: 1rem;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

.chat-input-wrapper textarea:focus {
    border-color: #386641;
    box-shadow: 0 0 0 2px rgba(56, 102, 65, 0.1);
}

.chat-send-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: #386641;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s, background-color 0.2s;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.chat-send-btn:hover {
    background-color: #2e5235;
    transform: scale(1.05);
}

/* ==========================================================================
   RESPONSIVE (MOBILE) - UI ONLY
   ========================================================================== */
@media (max-width: 1350px) {
  body {
    overflow: auto;
    height: auto;
  }
  .container {
    flex-direction: column;
    height: auto;
    padding: 10px;
    gap: 10px;
  }
  .main-content {
    flex-direction: column;
  }
  .panel, .printContainer {
    flex: 1 1 auto;
    width: 100%;
    height: auto;
    max-height: none;
    overflow-y: visible;
  }
  .preview-wrapper {
    display: contents;
  }
  .printContainer {
    order: 1;
    height: 500px;
    min-height: 500px;
    overflow: auto;
    visibility: visible;
  }
  .config-panel { order: 2; padding-bottom: 20px !important; }
  .input-panel { order: 3; }
  
  #pdfBtnGroup {
    order: 4;
    position: static;
    width: 100%;
    height: auto;
    max-height: none;
    margin-top: 10px;
  }
  .preview-area {
    width: auto;
    justify-content: center;
    align-items: center;
    overflow: visible;
  }
  .toggle-group { flex-wrap: wrap; }
  .toggle-btn {
    flex-basis: 40%;
    flex-grow: 1;
    font-size: 0.8rem;
    height: 40px;
    aspect-ratio: auto;
  }
  .icon-toggle-btn {
    flex-direction: row;
    height: 40px;
  }
  .icon-toggle-btn .icon-char {
    font-size: 1rem;
    line-height: 1;
  }
  .icon-toggle-btn .icon-label {
    font-size: 0.8rem;
    line-height: 1;
    text-transform: none;
  }
  .icon-toggle-btn[data-type="conseil"] .icon-char {
    font-size: 1.2rem;
  }
  .queue-modal-content {
    width: 95%;
    max-height: 90vh;
  }
  .queue-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .queue-item-controls {
    width: 100%;
    justify-content: space-between;
  }
  .modal-queue-btn.delete {
    margin-left: 0;
  }
  .queue-actions {
    flex-direction: column;
  }
  
  .config-bottom-actions { position: static; margin-top: 20px; border-radius: 8px; }
  .settings-panel { position: fixed; top: 0; right: 0; height: 100%; z-index: 3000; box-shadow: -5px 0 15px rgba(0,0,0,0.2); }
  
  /* Responsive Messaging Split View */
  .messaging-body-split {
      flex-direction: column;
  }
  .msg-sidebar {
      width: 100%;
      height: 150px;
      border-right: none;
      border-bottom: 1px solid #eee;
  }
  .chat-input-wrapper {
      padding-right: 15px; 
  }
}