/* ==========================================================================
   STYLE UI - VEGAPP (NETTOYÉ & RÉORGANISÉ)
   ==========================================================================
   1. Réinitialisation & Styles Globaux
   2. Modales (Connexion, Notifications)
   3. Header (Barre Supérieure)
   4. Layout Principal (Structure)
   5. Panneaux Latéraux (Gauche/Droite/Settings)
   6. Contrôles de Formulaire (Inputs, Selects, Toggles)
   7. Messagerie (Chat Support)
   8. Barres d'Outils (Toolbar Riche & PDF)
   9. File d'Attente (Grid & Liste)
   10. Utilitaires (Zoom, Progress Overlay)
   11. Modale d'Ajout (Format & Quantité)
   12. Dropdown & Sélecteur Plante
   13. NOUVELLES CARTES DE FORMULAIRE (APP)
   ========================================================================== */

/* --- 1. RÉINITIALISATION & STYLES GLOBAUX --- */

*, *::before, *::after {
  box-sizing: border-box;
  /* Optimisation Firefox pour les barres de défilement sur Windows 8.1 */
  scrollbar-width: thin; 
  scrollbar-color: #b0b0b0 #f0f2f5;
}

/* Webkit (Chrome/Edge) fallback pour les scrollbars */
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-track {
  background: #f0f2f5;
}
*::-webkit-scrollbar-thumb {
  background-color: #b0b0b0;
  border-radius: 4px;
  border: 2px solid #f0f2f5;
}

html {
  font-size: 16px;
  /* Amélioration du lissage des polices sur Windows */
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Roboto', 'Segoe UI', Arial, sans-serif;
  line-height: 1.4;
  color: #333333;
  margin: 0;
  padding: 0;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background-color: #f0f2f5;
  display: flex;
  flex-direction: column;
}

/* Utilitaires globaux */
.hidden { display: none; }


/* --- 2. MODALES (CONNEXION, NOTIFICATIONS) --- */

/* Modale de Connexion */
.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;
}

/* --- MODALE DE CONFIRMATION CUSTOM --- */
.confirm-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9000; /* Juste en dessous du Toast mais au-dessus du reste */
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.confirm-box {
    background: white;
    padding: 25px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    text-align: center;
    transform: scale(0.95);
    animation: scaleIn 0.2s ease-out forwards;
}

.confirm-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 10px;
}

.confirm-text {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 25px;
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.btn-confirm {
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    transition: transform 0.1s;
    min-width: 100px;
}
.btn-confirm:active { transform: scale(0.96); }

.btn-confirm.yes { background: #386641; color: white; box-shadow: 0 4px 10px rgba(56, 102, 65, 0.2); }
.btn-confirm.yes:hover { background: #2e5435; }

.btn-confirm.no { background: #f3f4f6; color: #374151; }
.btn-confirm.no:hover { background: #e5e7eb; }

@keyframes scaleIn { to { transform: scale(1); } }

/* 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: 9999;
  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;
}


/* --- 3. HEADER (BARRE SUPÉRIEURE) --- */

.app-header {
    height: 50px;
    background-color: #fff;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    flex-shrink: 0;
    z-index: 100;
    min-width: 800px;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    color: #386641;
    font-size: 1.1rem;
}

.app-version {
    font-size: 1rem;
    background: #eee;
    padding: 6px 6px;
    border-radius: 12px;
    color: #666;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.header-btn {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    position: relative;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-btn:hover {
    background-color: #f0f2f5;
    color: #386641;
}

.header-btn svg {
    display: block;
}

/* Bouton Admin Spécifique */
.header-btn.admin {
    background-color: #333;
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    gap: 6px;
    padding: 6px 12px;
    margin-right: 10px;
}

.header-btn.admin:hover {
    background-color: #000;
    transform: translateY(-1px);
}

.header-btn.logout {
    color: #c5221f;
}

.header-btn.logout:hover {
    background-color: #fee2e2;
}

.header-sep {
    width: 1px;
    height: 20px;
    background-color: #ddd;
    margin: 0 5px;
}

.badge-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: #c5221f;
    border: 2px solid white;
    border-radius: 50%;
}


/* --- 4. LAYOUT PRINCIPAL (STRUCTURE) --- */

/* --- 4. LAYOUT PRINCIPAL (STRUCTURE) --- */

.container {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding: 0;
    gap: 0;
    min-height: 0;
    background-color: #f0f2f5;
    overflow: hidden; /* Important pour éviter les scrollbars parasites */
    width: 100%;
    height: 100%;
}

/* CORRECTIF : On force l'affichage en LIGNE pour l'application */
#appContainer {
    display: flex;
    flex-direction: row !important; /* Force panneau à gauche, aperçu à droite */
    width: 100%;
    height: 100%;
    overflow: hidden;
    align-items: stretch; /* Les panneaux prennent toute la hauteur */
}

/* Les panneaux latéraux ne doivent pas rétrécir en dessous d'un min */
.data-panel-left {
    flex-shrink: 0;
    overflow-y: auto;
}

.visual-panel-right {
    flex-shrink: 0;
    overflow-y: auto;
    border-left: 1px solid #ddd;
    box-shadow: -2px 0 5px rgba(0,0,0,0.02);
    flex: 0 0 360px;
    min-width: 300px;
    border-left:1px solid #e0e0e0; 
    background-color: 
    #f9fafb !important;
    z-index:10;
}


/* Wrapper de Droite (Aperçu) */
.preview-wrapper-vertical {
    flex: 1; /* Prend tout l'espace restant */
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    position: relative;
    z-index: 1;
}

.preview-area-refined {
    flex-grow: 1;
    background-color: #d1d5db; 
    position: relative;
    overflow: hidden;
    padding: 0;
    display: block;
    border: 1px solid #bbb;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.05);
    z-index: 0;
}

/* Centrage de l'affiche */
.preview-area-refined #affiche-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.main-content {
    display: flex;
    flex-direction: row;
    flex-grow: 1;
    gap: 10px;
    padding: 10px;
    overflow: hidden;
    min-height: 0;
    min-width: 900px; 
}

/* FIX CRITIQUE : Empêcher l'affiche d'être écrasée par Flexbox */
.preview-area-refined #affiche {
    flex-shrink: 0 !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0; /* Centre l'affiche dans le padding */
    transition: transform 0.1s ease-out;
}


/* --- 5. PANNEAUX LATÉRAUX (GAUCHE/DROITE/SETTINGS) --- */

.panel {
  display: flex;
  flex-direction: column;
  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;
  border: 1px solid #eee;
}

.config-panel {
  flex: 0 0 190px;
  background-color: #fdfdfd;
}

.input-panel {
  flex: 0 0 360px;
  background-color: #ffffff;
  transition: flex-basis 0.3s ease;
}

/* Settings Panel (Glissant) */
.settings-panel {
    display: none;
    flex: 0 0 360px;
    background-color: #EBF6FF;
    border-radius: 0;
    flex-direction: column;
    overflow: hidden; 
    animation: slideInRight 0.3s ease-out;
}
.settings-panel.active { display: flex; }

#settingsContent {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
    margin-bottom: 12px;
    flex-shrink: 0;
}
.close-settings-btn {
    background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #666;
}
.close-settings-btn:hover { color: #c5221f; }

/* Titres */
.panel-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: #386641;
  margin: 0 0 10px 0;
  text-align: center;
}

.panel-group-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: #333333;
  margin: 0 0 10px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-group {
  padding-bottom: 12px;
  margin-bottom: 5px;
}
.panel-group:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }

.mini-settings-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 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);
}


/* --- 6. CONTRÔLES DE FORMULAIRE (INPUTS, SELECTS, TOGGLES) --- */

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  margin-bottom: 8px;
}
.control-group:last-child { margin-bottom: 0; }

.panel label {
  font-family: 'Open Sans', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  color: #333333;
}

.label-wrapper { display: flex; justify-content: space-between; align-items: center; margin-bottom: -3px; }

/* Champs */
#plantSearch, #plantSelect, .poster-type-controls input, .poster-type-controls select, .poster-type-controls textarea, .panel input, .panel select, .panel textarea {
  font-family: 'Roboto', sans-serif; font-weight: 400; font-size: 0.95rem; padding: 8px; border-radius: 6px; 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;
}

#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-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: 8px; background: #eee; border: 1px solid #ccc; border-radius: 6px; font-weight: bold; min-width: 60px; text-align: right; font-size: 0.95rem; color: #333333; }
.poster-type-controls { display: flex; flex-direction: column; gap: 10px; }
#promoTypeInputs { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }

/* Boutons de Configuration (Toggles) */
.toggle-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  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.85rem;
  cursor: pointer;
  transition: all 0.2s;
  background-color: #f0f0f0;
  color: #555;
  user-select: none;
  text-align: center;
  gap: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  height: auto;
  aspect-ratio: 1 / 1;
  padding: 5px;
  min-width: 0;
  overflow: hidden;
}

.toggle-btn:hover { border-color: #888; }
.toggle-btn.selected { border-color: #386641; background-color: #386641; color: #ffffff; font-weight: 700; box-shadow: 0 0 8px 2px rgba(56, 102, 65, 0.4); }

.icon-toggle-btn { flex-direction: column; gap: 4px; }
.icon-toggle-btn .icon-char { font-size: 1.4rem; line-height: 1.1; font-family: 'Montserrat', sans-serif; font-weight: 700; }
.icon-char .icone { height: 35px; width: auto; object-fit: contain; }
.icon-toggle-btn .icon-label { font-size: 0.5rem; line-height: 1; font-weight: 600; text-transform: uppercase; font-family: 'Poppins', sans-serif; word-break: break-word; }
.icon-toggle-btn[data-type="conseil"] .icon-char { font-style: italic; font-family: serif; font-weight: bold; font-size: 1.6rem; }
.icon-orient-port { width: 12px; height: 18px; border: 2px solid currentColor; border-radius: 2px; }
.icon-orient-land { width: 18px; height: 12px; border: 2px solid currentColor; border-radius: 2px; }

.toggle-btn.enseigne-btn { padding: 4px; }
.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; margin-bottom: 15px; }
.horaires-toggle-group .toggle-btn { aspect-ratio: auto; height: 35px; font-size: 0.75rem; }

/* Switch Settings */
.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 6px 8px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
}
.setting-label { font-size: 0.85rem; font-weight: 600; }
.setting-input-color { width: 35px; height: 25px; border: none; padding: 0; background: none; cursor: pointer; }
.setting-select { padding: 4px; border-radius: 4px; border: 1px solid #ccc; font-size: 0.85rem; width: 100%; }

.visibility-list { display: flex; flex-direction: column; gap: 4px; }
.visibility-item { display: flex; align-items: center; justify-content: space-between; font-size: 0.8rem; padding: 4px 0; border-bottom: 1px dashed #eee; }

/* Switch CSS */
.switch { position: relative; display: inline-block; width: 30px; height: 18px; }
.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: 12px; width: 12px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: #386641; }
input:checked + .slider:before { transform: translateX(12px); }

/* Inputs Quantité & Actions */
.quantity-input { display: flex; align-items: center; width: 100%; }
.quantity-input.compact { width: auto; }
.quantity-input input[type="number"] { width: 100%; text-align: center; font-weight: 700; font-size: 1rem; border-radius: 0; border-left: none; border-right: none; padding: 8px 5px; -moz-appearance: textfield; }
.quantity-input.compact input[type="number"] { width: 45px; padding: 4px; font-size: 0.95rem; height: 32px; }
.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 40px; height: 40px; border: 1px solid #ccc; background-color: #f0f0f0; font-size: 1.3rem; font-weight: 600; color: #555; cursor: pointer; transition: background-color 0.2s; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); }
.quantity-input.compact .quantity-btn { flex: 0 0 32px; height: 32px; font-size: 1.1rem; padding: 0; }
.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: 1rem; padding: 10px 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.compact { margin-top: 0; padding: 6px 15px; font-size: 0.85rem; width: auto; height: 32px; }
.action-btn:active { transform: scale(0.98); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); }
/* --- Styles de Base des Boutons (Shared) --- */
.action-btn.compact {
    font-family: 'Poppins', sans-serif; /* Police cohérente */
    font-weight: 600;
    font-size: 0.9rem;
    padding: 8px 16px;
    border-radius: 8px; /* Arrondi moderne */
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); /* Animation fluide "Apple-like" */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px; /* Espace entre icône et texte */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); /* Ombre subtile au repos */
}

/* --- Bouton AJOUTER (Action Positive) --- */
.add-btn {
    background-color: #ffffff;
    color: #1B5E20; /* Vert VegApp */
    border: 1px solid #1B5E20; /* Bordure fine verte */
}

.add-btn:hover {
    background-color: #1B5E20;
    color: #ffffff;
    border-color: #1B5E20;
    box-shadow: 0 6px 15px rgba(27, 94, 32, 0.25); /* Ombre portée verte */
    transform: translateY(-2px); /* Effet de lévitation */
}

.add-btn:active {
    transform: translateY(0); /* Effet d'enfoncement au clic */
    box-shadow: 0 2px 4px rgba(27, 94, 32, 0.2);
}

/* --- Bouton EXPORTER (Action Neutre/Technique) --- */
.queue-btn {
    background-color: #ffffff;
    color: #444444; /* Gris foncé lisible */
    border: 1px solid #cccccc; /* Bordure neutre */
}

.queue-btn:hover {
    background-color: #333333; /* Devient sombre au survol */
    color: #ffffff;
    border-color: #333333;
    box-shadow: 0 6px 15px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.queue-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* --- Petit correctif pour les icônes à l'intérieur --- */
.action-btn svg, 
.action-btn span[class^="icon-"] {
    transition: inherit; /* L'icône change de couleur avec le texte */
}


/* --- 7. MESSAGERIE (CHAT SUPPORT) --- */

.messaging-window { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: #f5f5f5; 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; }
.messaging-body-split { display: flex; height: 100%; overflow: hidden; background-color: #fff; width: 100%; max-width: 1200px; margin: 20px auto; border-radius: 12px; box-shadow: 0 5px 25px rgba(0,0,0,0.1); border: 1px solid #eee; }
.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; }
.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; align-items: center; }
.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; }
.user-msg-bubble.me { margin-left: auto; margin-right: 0; background-color: #dcfce7; border: 1px solid #bbf7d0; }
.user-msg-bubble.admin { margin-right: auto; margin-left: 0; background-color: #E3F2FD; border: 1px solid #BBDEFB; color: #0D47A1; }
.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; }
.bubble-content { color: #333; }
.chat-input-wrapper { padding: 20px 30px; border-top: 1px solid #eee; display: flex; align-items: flex-end; 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); }


/* --- 8. BARRES D'OUTILS (TOOLBAR RICHE & PDF) --- */

.pdf-toolbar {
    flex: 0 0 auto;
    background: white;
    padding: 8px 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    border: 1px solid #eee;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-label {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: #555;
    font-size: 0.85rem;
    white-space: nowrap;
}

.toolbar-actions {
    display: flex;
    gap: 8px;
}

/* Toolbar Riche (Input) */
.control-group {
    position: relative; /* Nécessaire pour le positionnement des popups */
}

.input-toolbar {
    display: flex;
    gap: 5px;
    margin-bottom: 5px;
    padding: 4px;
    background: #f8f9fa;
    width: fit-content;
}
.input-toolbar { position: absolute; top: -7px; right: 0; display: flex; gap: 0px; background: transparent; z-index: 5; }

.toolbar-btn {
    width: 28px;
    height: 28px;
    padding: 4px;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.toolbar-btn:hover, .toolbar-btn.active {
    background-color: #e2e6ea;
    color: #386641;
    border-color: #dbeafe;
}

.toolbar-btn svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

.toolbar-popup {
    position: absolute;
    bottom: 100%; /* Au-dessus de l'input */
    right: 0;
    background: white;
    border: 1px solid #ccc;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    padding: 10px;
    border-radius: 6px;
    z-index: 50;
    display: none;
    min-width: 200px;
    margin-bottom: 8px;
}

.toolbar-popup.show {
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: fadeIn 0.2s ease-out;
}

.popup-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: #666;
}

.popup-slider {
    flex-grow: 1;
    cursor: pointer;
}

.popup-value {
    font-weight: bold;
    color: #386641;
    min-width: 30px;
    text-align: right;
}

/* Grille Caractères Spéciaux */
.char-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
}

.char-btn {
    width: 24px;
    height: 24px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 3px;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.char-btn:hover {
    background: #386641;
    color: white;
    border-color: #386641;
}

.color-picker-input {
    border: none;
    width: 40px;
    height: 30px;
    cursor: pointer;
    background: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.toolbar-popup::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 15px;
    border-width: 6px;
    border-style: solid;
    border-color: white transparent transparent transparent;
}


/* --- 9. FILE D'ATTENTE (GRID & LISTE) --- */

.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; }
.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; }

/* Mode Grille pour la file */
.queue-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    padding: 15px;
    background-color: #f5f7fa;
}

.queue-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #eee;
}

.queue-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-color: #386641;
}

.queue-card.editing-highlight {
    border: 2px solid #D75000 !important;
    box-shadow: 0 0 10px rgba(215, 80, 0, 0.2);
}

.queue-card-preview {
    height: 240px;
    background-color: #e5e7eb;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

.queue-card-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: white;
}

.queue-card-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.queue-card-preview:hover .queue-card-overlay { opacity: 1; }

.queue-card-overlay span {
    color: white;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    background: #386641;
    padding: 8px 16px;
    border-radius: 20px;
    transform: scale(0.9);
    transition: transform 0.2s;
}

.queue-card-preview:hover .queue-card-overlay span { transform: scale(1); }

.queue-card-body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    border-top: 1px solid #eee;
}

.queue-card-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.queue-card-info {
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 5px;
}

.queue-card-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto; 
    background: #f9f9f9;
    padding: 5px;
    border-radius: 6px;
}

.queue-card-controls .queue-item-quantity {
    font-size: 0.9rem;
    min-width: 20px;
}

.queue-card-controls .modal-queue-btn {
    width: 24px;
    height: 24px;
    font-size: 1rem;
    padding: 0;
}

.queue-card-controls .modal-queue-btn.delete {
    background: white;
    border: 1px solid #fee2e2;
    color: #c5221f;
    font-size: 0.8rem;
}

.edit-mode-active {
    background-color: #2e7d32 !important;
    box-shadow: 0 0 10px rgba(46, 125, 50, 0.4);
}


/* --- 10. UTILITAIRES --- */

/* Zoom Control */
#previewZoom { width: 80px; cursor: pointer; }

/* Progress Overlay */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #386641;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px auto;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.progress-box {
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 5px 25px rgba(0,0,0,0.3);
    width: 300px;
}

.progress-bar-bg {
    width: 100%;
    height: 10px;
    background-color: #eee;
    border-radius: 5px;
    overflow: hidden;
    margin-top: 15px;
}

.progress-bar-fill {
    height: 100%;
    background-color: #386641;
    width: 0%;
    transition: width 0.3s ease;
}


/* --- 11. MODALE D'AJOUT (FORMAT & QUANTITÉ) - RESTAURÉ --- */

/* Grille de sélection des formats */
.format-grid-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); /* Responsive */
    gap: 12px;
    margin-top: 10px;
}

/* La Carte Format (Le conteneur cliquable) */
.format-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px 10px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    user-select: none;
}

/* On cache le bouton radio natif */
.format-option input[type="radio"] { display: none; }

/* État survol */
.format-option:hover {
    border-color: #a5d6a7; 
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

/* État Sélectionné */
.format-option.selected {
    border-color: #1B5E20; 
    background-color: #f0fdf4; 
    color: #1B5E20;
    box-shadow: 0 0 0 1px #1B5E20 inset;
}

/* Représentation Visuelle du Papier (Miniature CSS) */
.format-visual {
    width: 40px;
    height: 56px; 
    background: #fff;
    border: 1px solid #ccc;
    margin-bottom: 10px;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.15);
    display: grid;
    gap: 1px;
    background-color: #e0e0e0; 
    padding: 1px; 
}

.format-visual div { background-color: white; }

.format-visual.a4 { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.format-visual.a5 { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
.format-visual.a6 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.format-visual.a7 { grid-template-columns: 1fr 1fr; grid-template-rows: repeat(4, 1fr); }
.format-visual.a8 { grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, 1fr); }

.format-option span {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1;
}

.format-option small {
    font-family: 'Open Sans', sans-serif;
    font-size: 0.7rem;
    color: #888;
    margin-top: 4px;
}
.format-option.selected small { color: #386641; font-weight: 600; }

/* Input Quantité Modale */
#addToQueueModal .quantity-input {
    justify-content: center; 
    margin-top: 5px;
}

#addToQueueModal .quantity-btn {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    border-radius: 8px; 
}

#addToQueueModal input[type="number"] {
    height: 50px;
    font-size: 1.5rem;
    width: 80px;
    border-top: 1px solid #ccc;
    border-bottom: 1px solid #ccc;
}


/* --- 12. DROPDOWN & SÉLECTEUR PLANTE --- */

#plantSelect { display: block; } 
#plantSelectList { display: none; }

.input-panel.conseil-list-active #plantControls { flex-direction: column; min-height: 5.5em; overflow: hidden;}
.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; padding: 5px; margin-top: 5px; overflow: hidden; background-color:white;}

.plant-select-item { padding: 8px 10px; cursor: pointer; border-radius: 4px; font-size: 0.95rem; }
.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; }

/* Styles Dropdown Recherche (Amélioré) */
.plant-select-wrapper { position: relative; width: 100%; }

.plant-select-list {
    display: none; 
    flex-direction: column;
    max-height: 75vh;
    overflow-y: auto;
    border: 1px solid #386641; 
    border-radius: 4px;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-top: 2px;
}

.plant-select-list.dropdown-mode.open { display: flex !important; }

.rich-dropdown-trigger {
    border: 1px solid #ccc;
    padding: 8px 12px;
    background: #fff;
    cursor: pointer;
    border-radius: 4px;
    display: none; 
    justify-content: space-between;
    align-items: center;
    min-height: 42px;
    margin-bottom: 5px;
    transition: all 0.2s;
    font-size: 0.95rem;
    color: #333;
}

.rich-dropdown-trigger:hover {
    border-color: #386641;
    background-color: #f9fdf9;
}

.rich-dropdown-trigger:after {
    content: '▼';
    font-size: 0.7em;
    color: #666;
    margin-left: 10px;
}

/* Diamètre / Taille font */
.font-size-toggle { display: flex; align-items: center; gap: 4px; }
.diameter-btn { width: 22px; height: 22px; 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); }
.font-size-btn { width: 22px; height: 22px; 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: 9px; } .font-size-btn.medium { font-size: 12px; } .font-size-btn.large { font-size: 15px; }
.font-size-btn.selected { background-color: #386641; color: white; border-color: #386641; }

/* 13. NOUVELLES CARTES DE FORMULAIRE (APP) */
.app-form-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
    border-left-width: 4px; /* La couleur est injectée via JS */
    border-left-style: solid;
}

.app-form-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.app-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: default;
}

.app-card-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* La couleur de l'icône hérite de la bordure */
}

.app-card-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #555;
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-card-body {
    padding: 8px 10px;
}

/* On écrase le style par défaut des .control-group à l'intérieur des cartes */
.app-form-card .control-group {
    margin-bottom: 0;
}
.app-form-card .control-group label {
    display: none; /* On cache le label standard car on a le header */
}
.app-form-card input, 
.app-form-card select, 
.app-form-card textarea {
    border: 1px solid #ddd;
    background: #fff;
    font-size: 0.9rem;
    padding: 6px 8px;
}
.app-form-card input:focus, 
.app-form-card select:focus, 
.app-form-card textarea:focus {
    border-color: inherit; /* Prend la couleur de la bordure gauche */
    box-shadow: none;
    background: #fff;
}

/* 2. CORRECTION LISTE PLANTES (DROPDOWN) */
/* On supprime l'affichage forcé "block" qui était dans la V2.1 */
.input-panel.conseil-list-active #plantSelectList {
    display: none; /* Caché par défaut */
    margin-top: 0;
    border-top: none;
    max-height: 300px;
    overflow-y: auto;
    transition: all 0.2s;
    background: white;
    border: 1px solid #386641;
    border-radius: 0 0 4px 4px;
    position: absolute;
    width: 100%;
    z-index: 100;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* Classe pour l'ouverture explicite */
.input-panel.conseil-list-active #plantSelectList.show-list {
    display: block;
}

/* Style du champ recherche plantes "Card Style" */
.plant-search-card {
    background: white;
    border: 1px solid #386641;
    border-radius: 6px;
    margin-bottom: 10px;
    position: relative; /* Pour le positionnement absolu de la liste */
}

.plant-search-header {
    background: #e6f4ea;
    padding: 8px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #cce3d4;
    cursor: pointer;
}

.plant-search-body {
    padding: 10px;
}

.toggle-arrow {
    transition: transform 0.2s;
    font-size: 0.8rem;
    color: #1B5E20;
}
.plant-search-card.open .toggle-arrow {
    transform: rotate(180deg);
}
/* --- STYLE UI - REFONTE DATA PANEL (CLEAN & CARDS) --- */

/* 1. SUPPRESSION DES TITRES (PANNEAU DROITE) */
/* Titre Principal "Données" */
.input-panel .panel-title {
    display: none !important;
}
/* Sous-titres de section "Végétal", "Détails", "Données Affiche" */
.input-panel .panel-group-title {
    display: none !important;
}
/* Réajustement du padding global du panneau */
.input-panel {
    padding: 15px !important;
    background-color: #f4f6f8; /* Fond légèrement gris pour détacher les cartes */
    overflow-x: hidden;
}
#plantControls, #contextControls {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* 2. COMPOSANT SÉLECTEUR DE PLANTE (Style Unifié) */
/* Conteneur global qui remplace le style par défaut */
#plantControls {
    background: white;
    border: 1px solid #1B5E20; /* Bordure verte pour marquer l'importance */
    border-radius: 8px;
    padding: 0 !important;
    margin-bottom: 15px;
    overflow: visible; /* Important pour le dropdown absolu */
    position: relative;
    z-index: 20; /* Au-dessus des autres champs */
    box-shadow: 0 2px 5px rgba(27, 94, 32, 0.1);
}

/* Champ Recherche (Haut du bloc) */
#plantControls .control-group:first-of-type {
    margin: 0;
}
#plantControls label {
    display: none; /* On cache les labels textuels */
}
#plantSearch {
    border: none !important;
    box-shadow: none !important;
    border-radius: 8px 8px 0 0 !important;
    padding: 12px !important;
    font-weight: 500;
    /* Icône loupe à droite */
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231B5E20' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") no-repeat right 12px center;
    background-color: #fff !important;
}
#plantSearch:focus {
    background-color: #f9fdf9 !important;
}

/* Trigger Dropdown (Bas du bloc - Généré par JS) */
.rich-dropdown-trigger {
    margin: 0 !important;
    border: none !important;
    background: #fcfcfc !important;
    border-radius: 0 0 8px 8px !important;
    padding: 10px 12px !important;
    font-size: 0.9rem;
    color: #333;
    min-height: auto !important;
    display: flex !important;
}
.rich-dropdown-trigger:hover {
    background: #f0fdf4 !important;
    color: #1B5E20;
}

/* Liste déroulante (Absolue et cachée par défaut) */
#plantSelectList {
    display: none; /* Caché par défaut */
    position: absolute;
    top: 100%; /* Juste en dessous du bloc */
    left: 0;
    width: 100%;
    z-index: 5000;
    background: white;
    border: 1px solid #1B5E20;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
    margin-top: -2px; /* Léger chevauchement pour l'esthétique */
    max-height: 300px;
    overflow-y: auto;
}
/* Classe d'ouverture gérée par JS */
#plantSelectList.open {
    display: block !important;
}

/* 3. DESIGN DES CARTES DE FORMULAIRE (APP) */
#customInputsWrapper {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Petits titres de section dans le formulaire custom (ex: "Tarifs") */
#customInputsWrapper h4 {
    margin: 15px 0 8px 0 !important;
    font-size: 0.7rem !important;
    font-weight: 800 !important;
    color: #999 !important;
    border-bottom: none !important;
    padding-left: 5px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.app-form-card {
    margin-bottom: 8px;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    border: 1px solid #e0e0e0; /* Bordure légère */
    border-left-width: 4px !important; /* Couleur type sur la gauche */
}
.app-card-header {
    background: #fff;
    padding: 8px 12px;
    font-size: 0.8rem;
}
.app-card-body {
    padding: 0 12px 10px 12px;
    background: #fff;
}
.app-form-card input, .app-form-card select, .app-form-card textarea {
    background: #f9f9f9;
    border: 1px solid #eee;
    transition: all 0.2s;
}
.app-form-card input:focus, .app-form-card select:focus, .app-form-card textarea:focus {
    background: #fff;
    border-color: #ccc;
    box-shadow: none;
}

/* --- OVERLAY DE CAPTURE (Masque le redimensionnement) --- */
.capture-mask {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: #ffffff;
    z-index: 10000; /* Au-dessus de l'affiche */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out;
}

.capture-mask.active {
    opacity: 1;
    pointer-events: all;
}

/* L'effet "Flash" : Une disparition rapide du blanc */
.capture-mask.flash-out {
    opacity: 0 !important;
    transition: opacity 0.4s ease-out; /* Durée du flash */
}

.capture-loader {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #1B5E20; /* Vert VegApp */
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 10px;
}

.capture-text {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: #1B5E20;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* --- VIEWPORT TOOLBAR --- */
.viewport-toolbar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 5px 10px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 100;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    color: #555;
    border: 1px solid #ddd;
}

.viewport-toolbar button {
    background: transparent;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
    color: #333;
}

.viewport-toolbar button:hover {
    background: #f0f0f0;
    color: #1B5E20;
}