/* =========================================================================
   CSS POUR LE FORMULAIRE DE SAISIE D'ACTIONS
   À ajouter dans votre fichier CSS principal ou dans une balise <style>
   ========================================================================= */

/* Conteneur principal du formulaire */
#form-container {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 10000;
    max-width: 450px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

/* Overlay de fond */
#form-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
}

/* En-tête du formulaire */
.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.form-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
}

/* Bouton de fermeture */
.close-btn {
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
}

.close-btn:hover {
    background: #cc0000;
}

/* Groupes de champs */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

/* Champs de saisie */
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.form-group textarea {
    height: 80px;
    resize: vertical;
}

.form-group select {
    height: 40px;
}

/* Champs en lecture seule */
.readonly-field {
    background-color: #f5f5f5;
    color: #666;
}

/* Zone d'actions (boutons) */
.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
}

/* Styles des boutons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #545b62;
}

/* Indicateur de champ obligatoire */
.required {
    color: red;
}

/* Zone d'information */
.form-info {
    background-color: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 15px;
    font-size: 14px;
}

/* Styles spécifiques pour les types d'actions */
.action-item {
    padding: 8px;
    border-radius: 4px;
    margin: 2px 0;
}

.action-recolte { 
    background-color: #ffeaa7; 
}

.action-taille { 
    background-color: #fab1a0; 
}

.action-traitement { 
    background-color: #74b9ff; 
}

.action-autre { 
    background-color: #ddd; 
}

/* Responsive - Mobile */
@media (max-width: 600px) {
    #form-container {
        width: 95%;
        padding: 15px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

/* =========================================================================
   CSS POUR LE SELECTEUR DE DONNEES
   À ajouter dans votre fichier CSS principal
   ========================================================================= */

/* Conteneur du sélecteur de données */
#selector-viewData {
    display: none;
    position: fixed;
    top: 60px;
    right: 10px;
    background: white;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 9000;
    min-width: 250px;
    max-width: 300px;
}

/* Titre du sélecteur */
#selector-viewData h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 16px;
    text-align: center;
    border-bottom: 1px solid #ddd;
    padding-bottom: 8px;
}

/* Label pour la liste */
#lbl_viewArboids {
    font-weight: bold;
    color: #333;
    font-size: 14px;
    margin-bottom: 5px;
    display: block;
}

/* Liste de sélection des arboids */
const correctCSS = `
#viewArboidsSelect {
    /* Dimensions critiques */
    width: 100% !important;
    height: 200px !important;
    min-height: 200px !important;
    max-height: 200px !important;
    
    /* Scroll obligatoire */
    overflow-y: scroll !important;  /* SCROLL au lieu de AUTO */
    overflow-x: hidden !important;
    
    /* Affichage */
    display: block !important;
    box-sizing: border-box !important;
    
    /* Apparence */
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    padding: 2px !important;
    font-size: 13px !important;
    background-color: #fff !important;
    
    /* CRITIQUE pour les selects multiples */
    size: 15 !important;
}

#viewArboidsSelect option {
    padding: 4px 8px !important;
    border-bottom: 1px solid #eee !important;
    display: list-item !important;  /* CRITIQUE pour les options */
    white-space: nowrap !important;
    cursor: pointer !important;
    line-height: 1.2 !important;
}

#viewArboidsSelect option:hover {
    background-color: #f0f0f0 !important;
}

#viewArboidsSelect option:selected {
    background-color: #2c5aa0 !important;
    color: white !important;
}

/* Scrollbar personnalisée */
#viewArboidsSelect::-webkit-scrollbar {
    width: 12px !important;
}

#viewArboidsSelect::-webkit-scrollbar-track {
    background: #f1f1f1 !important;
    border-radius: 3px !important;
}

#viewArboidsSelect::-webkit-scrollbar-thumb {
    background: #888 !important;
    border-radius: 3px !important;
}

#viewArboidsSelect::-webkit-scrollbar-thumb:hover {
    background: #555 !important;
}
`;
/* Bouton d'affichage */
#btn_displayData {
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    background-color: #2c5aa0;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

#btn_displayData:hover {
    background-color: #1e3d6f;
}

#btn_displayData:active {
    background-color: #16324a;
}

/* Instructions */
.view-instructions {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
    text-align: center;
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    #selector-viewData {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 90%;
        max-width: 350px;
    }
}
/* Bouton de fermeture du sélecteur */
#btn_closeViewData {
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background-color 0.3s;
}

#btn_closeViewData:hover {
    background: #cc0000;
}

/* Header du sélecteur avec bouton fermer */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 8px;
}

.view-header h4 {
    margin: 0;
    color: #333;
    font-size: 16px;
}