/* Variables globales */
:root {
    --primary-color: #045B62;
    --secondary-color: #f0f9fa;
    --border-color: #e0e0e0;
    --text-color: #333;
    --success-color: #22c55e;
    --error-color: #ef4444;
    --neutral-color: #666666;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
}

/* Reset et styles de base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    max-width: 1200px;
    margin: 0 auto;
    padding: 25px;
    background-color: #f8f9fa;
}

/* Composants utilitaires */
.section {
    background: #ffffff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

/* Section d'alerte pour année antérieure */
.alerte-info {
    background: linear-gradient(to right, #fff3cd, #fefdf7);
    border: 1px solid #ffc107;
    border-left: 4px solid #ffc107;
}

.alerte-info .monitoring-card-header {
    color: #856404;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alerte-info .monitoring-card-header i {
    color: #ffc107;
    font-size: 1.1em;
}

.alerte-content {
    color: #856404;
}

.alerte-content p {
    margin-bottom: 10px;
    line-height: 1.6;
}

.alerte-content p:last-child {
    margin-bottom: 0;
}

/* Loader */
#loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

/* Message d'erreur */
#error {
    background-color: var(--error-color);
    color: white;
    padding: 1.25rem;
    border-radius: 8px;
    margin: 1.25rem 0;
    display: none;
    box-shadow: var(--shadow-sm);
}

/* En-tête avec logo */
.logo-container {
    text-align: center;
    margin: 30px 0;
}

.logo-container img {
    max-width: 180px;
    height: auto;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.1));
}

/* Logo visible uniquement en impression : masqué à l'écran */
.logo-container.print-only {
    display: none;
}

/* Bandeau de titre */
.title-banner {
    background: linear-gradient(to right, var(--primary-color), #067379);
    color: white;
    padding: 25px 30px;
    border-radius: 8px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-sm);
}

/* Liste déroulante années */
.annee-select {
    display: inline-block;
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    padding: 4px 30px 4px 10px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    margin: 0 5px;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='white' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px;
}

.annee-select:hover {
    background-color: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

.annee-select:focus {
    outline: none;
    background-color: rgba(255, 255, 255, 0.3);
    border-color: white;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.annee-select:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.annee-select option {
    background-color: var(--primary-color);
    color: white;
    padding: 8px;
}

/* Année sans données - affichage en rouge */
.annee-select.annee-sans-donnees {
    color: #ff4444;
    font-weight: bold;
}

.title-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Section Méthode de suivi collapsible */
.monitoring-card-header.collapsible {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: background-color 0.2s ease;
}

.monitoring-card-header.collapsible:hover {
    background-color: rgba(4, 91, 98, 0.05);
}

.methode-toggle {
    transition: transform 0.3s ease;
    color: var(--primary-color);
    font-size: 0.9em;
}

.monitoring-description {
    transition: all 0.3s ease;
    overflow: hidden;
}

/* Card sans données */
.no-data-card {
    background-color: #f8f9fa;
    border-left: 4px solid #6c757d;
}

.no-data-message {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    color: #6c757d;
    font-size: 1em;
}

.no-data-message i {
    font-size: 1.5em;
    color: #adb5bd;
}

.title-content h1 {
    margin: 0;
    font-size: 1.6em;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.title-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.title-icon {
    background: none;
    border: none;
    color: white;
    font-size: 1.2em;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    text-decoration: none;
}

.title-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

/* Menu déroulant paramètres */
.settings-dropdown {
    position: relative;
    display: inline-block;
}

.settings-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    margin-top: 8px;
}

.settings-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.settings-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    color: var(--text-color);
    text-align: left;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    border-radius: 0;
}

.settings-menu-item:first-child {
    border-radius: 7px 7px 0 0;
}

.settings-menu-item:last-child {
    border-radius: 0 0 7px 7px;
}

.settings-menu-item:hover {
    background: var(--secondary-color);
    color: var(--primary-color);
}

.settings-menu-item i {
    font-size: 1rem;
    width: 16px;
    text-align: center;
}

.settings-menu-item span {
    font-weight: 500;
}

/* Conteneur d'informations */
.info-container {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
}

.info-container > .section {
    flex: 1;
    margin-bottom: 0;
    max-width: 50%;
}

/* Titres */
h2, .monitoring-card-header {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1.2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    display: block;
    white-space: normal;
}

.monitoring-card-header .espece-icone {
    margin-right: 0;
}

.monitoring-card-header span {
    display: inline !important;
}

/* Section Méthode */
.methode-info {
    margin-bottom: 25px;
}

.monitoring-description {
    padding: 5px 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.monitoring-description p {
    margin-bottom: 10px;
    line-height: 1.6;
    text-align: justify;
    -webkit-hyphens: auto;
    -ms-hyphens: auto;
    hyphens: auto;
}

/* Bannière photos méthode de suivi */
.methode-photos-banner {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.methode-photo-item {
    display: flex;
    flex-direction: column;
}

.methode-photo-item img {
    width: 100%;
    height: 220px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    object-fit: cover;
    cursor: zoom-in;
    transition: all 0.9s cubic-bezier(0.25, 0.1, 0.25, 1);
    position: relative;
}

/* Effet agrandissement au clic (toggle) */
.methode-photo-item img.enlarged {
    height: 350px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
    transform: translateY(-4px);
    z-index: 10;
    cursor: zoom-out;
}

.methode-photo-caption {
    margin-top: 6px;
    font-size: 0.75rem;
    color: #666;
    font-style: italic;
    text-align: center;
    line-height: 1.3;
}

/* Statistiques */
.monitoring-stat {
    display: grid;
    grid-template-columns: auto 180px;
    gap: 2rem;
    margin-bottom: 0.25rem;
    align-items: baseline;
}

.contact-info .monitoring-stat,
.equipments-info .monitoring-stat {
    grid-template-columns: auto 1fr;
    gap: 1rem;
}

.synthese-info .monitoring-stat {
    grid-template-columns: auto 600px;
}

.monitoring-stat-label {
    color: var(--text-color);
    font-size: 0.9rem;
    min-width: 150px;
}

.monitoring-stat-number {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1rem;
}

.monitoring-stat-value {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Section Impact */
.impact-info .monitoring-stat {
    grid-template-columns: auto 600px;
}

.references {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    font-size: 0.9em;
    color: var(--neutral-color);
}

/* === Styles section impact - panels dépliables === */

/* Conteneur d'un item impact (espèce) */
.impact-item {
    margin-bottom: 15px;
}

/* Ligne cliquable */
.impact-stat-clickable {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    padding: 10px 50px 10px 55px;
    border: 1px solid #e1e4e8;
    border-radius: 4px;
}

.impact-stat-clickable:hover {
    background-color: rgba(4, 91, 98, 0.09);
    border-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
    transform: translateX(3px);
}

.impact-stat-clickable:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(4, 91, 98, 0.15);
}

/* Chevron indicateur d'état (ouvert/fermé) */
.impact-stat-clickable::after {
    content: '';
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    transition: transform 0.3s ease;
}

.impact-stat-clickable[aria-expanded="true"]::after {
    transform: translateY(-50%) rotate(-135deg);
}

/* Icône espèce (SVG) */
.impact-info-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.3s ease;
    line-height: 0;
    display: inline-flex;
    align-items: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
}

.impact-info-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

.impact-stat-clickable:hover .impact-info-icon {
    transform: translateY(-50%) scale(1.15);
}

/* Panel détail (état fermé par défaut) */
.impact-detail-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    margin-top: 0;
}

.impact-detail-panel[style*="max-height: 1000px"],
.impact-detail-panel[style*="max-height:1000px"] {
    margin-top: 10px;
}

/* Contenu du panel */
.impact-detail-content {
    background: #fafbfc;
    border-top: 1px solid #e1e4e8;
    padding: 15px 20px;
    font-size: 0.9rem;
    line-height: 1.6;
}

.impact-detail-content h4 {
    color: var(--primary-color);
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 12px 0;
}

.impact-detail-content h5 {
    color: var(--primary-color);
    font-size: 0.88rem;
    font-weight: 600;
    margin: 18px 0 10px 0;
}

.impact-detail-content > p {
    margin: 10px 0;
    line-height: 1.6;
}

/* Formule de calcul */
.impact-formula {
    background: rgba(4, 91, 98, 0.05);
    padding: 10px 15px;
    margin-bottom: 15px;
    border-left: 3px solid var(--primary-color);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Liste méthodologie */
.impact-methodo-list {
    list-style: disc;
    padding-left: 20px;
    margin: 10px 0 15px 0;
}

.impact-methodo-list li {
    margin-bottom: 6px;
    line-height: 1.5;
}

/* Références */
.impact-reference {
    border-top: 1px solid #e1e4e8;
    padding-top: 12px;
    margin-top: 15px;
    font-size: 0.85rem;
    line-height: 1.5;
    color: #586069;
}

.impact-reference strong {
    display: block;
    color: var(--text-color);
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.impact-reference a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

.impact-reference a:hover {
    color: #056a75;
    text-decoration: underline;
}

/* Disclaimer (rapaces uniquement) */
.impact-disclaimer {
    background-color: #fffbf0;
    border-left: 3px solid #ffc107;
    padding: 10px 12px;
    margin: 12px 0;
    font-size: 0.85rem;
    color: #856404;
    line-height: 1.5;
}

.impact-disclaimer strong {
    display: inline;
}

/* Bannière panoramique espèces - Section Impact */
.impact-thumbnails-banner {
    margin: 20px 0 25px 0;
    text-align: center;
    background-color: #fafbfc;
    border-radius: 8px;
    border: 1px solid #e1e4e8;
    padding: 15px;
    overflow: hidden;
}

.impact-thumbnails-banner img {
    width: 85%;
    height: auto;
    max-width: 100%;
    display: block;
    margin: 0 auto;
    border-radius: 6px;
}

/* Section parcelles */
.section-parcelles {
    margin-bottom: 25px;
}

.parcelle-section {
    margin-bottom: 1.5rem;
    background: white;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.parcelle-header {
    background: var(--primary-color);
    color: white;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 8px 8px 0 0;
}

.parcelle-header .espece-icone {
    width: 28px !important;
    height: 28px !important;
}

.parcelle-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.parcelle-header-tags {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Icône commentaire pour ajouter un commentaire parcelle dans le header */
.parcelle-comment-add-icon {
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 4px;
    border-radius: 50%;
}

.parcelle-comment-add-icon:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.15);
}

.parcelle-comment-add-icon:active {
    transform: scale(1.05);
}

.parcelle-tag {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.9rem;
    white-space: nowrap;
}

.parcelle-content {
    padding: 20px;
    background: var(--secondary-color);
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
}

/* Logique adaptative selon nombre de cards */
.parcelle-content.one-card {
    grid-template-columns: 1fr;
}

.parcelle-content.one-card .monitoring-card:not(.comments-card) {
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
}

.parcelle-content.two-cards {
    grid-template-columns: 1fr 1fr;
}

.parcelle-content.three-plus-cards {
    grid-template-columns: 1fr 1fr;
}

/* Commentaires sur toute la largeur */
.monitoring-card.comments-card {
    grid-column: 1 / -1;
    width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* === Styles spécifiques commentaires ferme === */
.ferme-comment-wrapper {
    grid-column: 1 / -1;
    margin-top: 30px;
}

/* Icône comment-medical (bulle + croix) pour ajouter un commentaire ferme dans le header synthèse */
.ferme-comment-add-icon {
    color: var(--primary-color);
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 5px;
    border-radius: 50%;
}

.ferme-comment-add-icon:hover {
    color: #02575f;
    background-color: rgba(4, 91, 98, 0.1);
    transform: scale(1.15);
}

.ferme-comment-add-icon:active {
    transform: scale(1.05);
}

/* Conteneur centré pour le bouton "Ajouter un commentaire" */
.add-comment-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
}

/* Bouton "Ajouter un commentaire" (admin) */
.add-comment-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background-color: rgba(4, 91, 98, 0.1);
    color: var(--primary-color);
    border: 1px solid rgba(4, 91, 98, 0.3);
    border-radius: 5px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    font-family: inherit;
}

.add-comment-button:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.add-comment-button i {
    font-size: 1em;
}

/* Formulaire de commentaire inline */
.monitoring-card.comments-card {
    transition: opacity 0.3s ease, max-height 0.3s ease, margin 0.3s ease;
    overflow: hidden;
}

.monitoring-card.comments-card.hiding {
    opacity: 0;
    max-height: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.comment-form-body {
    padding: 20px;
}

.comment-textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
    background-color: #fafafa;
    transition: all 0.3s ease;
    min-height: 120px;
    max-height: 400px;
    box-sizing: border-box;
}

.comment-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(4, 91, 98, 0.1);
}

.comment-password-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    box-sizing: border-box;
    background-color: #fafafa;
    transition: all 0.3s ease;
}

.comment-password-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(4, 91, 98, 0.1);
}

.comment-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: flex-end;
}

/* Icône groupe SVG dans header - style inline dans nichoirIcons.js */

/* Monitoring groups */
.monitoring-group {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}



.monitoring-group-title {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.monitoring-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
    gap: 15px;
}

.stat-label {
    color: var(--text-color);
    font-size: 0.9rem;
}

.stat-value {
    font-weight: 500;
    color: var(--primary-color);
}

.monitoring-comment {
    width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.monitoring-comment p {
    border-left: 4px solid var(--primary-color);
    padding-left: 15px;
    padding-right: 25px;
    margin: 0;
    text-align: justify;
    -webkit-hyphens: auto;
    -ms-hyphens: auto;
    hyphens: auto;
}

/* Commentaire éditable avec effet hover */
.monitoring-comment.editable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.monitoring-comment.editable:hover {
    background-color: rgba(4, 91, 98, 0.05);
    border-radius: 4px;
}

.monitoring-comment.editable p:hover {
    border-left-color: var(--success-color);
    color: var(--primary-color);
}

.monitoring-comment.editable::after {
    content: '\f044';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    right: 0;
    bottom: 0;
    margin-right: 2px;
    margin-bottom: 2px;
    color: transparent;
    font-size: 1.2em;
    transition: color 0.2s ease;
    pointer-events: none;
}

.monitoring-comment.editable:hover::after {
    color: var(--primary-color);
    opacity: 0.6;
}

/* Card de commentaire avec position relative pour l'icône */
.monitoring-card.comments-card {
    position: relative;
}

/* Animation de surbrillance pour nouveau commentaire */
.monitoring-card.comments-card.highlight {
    animation: highlightComment 3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes highlightComment {
    0% {
        background-color: rgba(34, 197, 94, 0.2);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
    }
    40% {
        background-color: rgba(34, 197, 94, 0.15);
        box-shadow: 0 0 20px 5px rgba(34, 197, 94, 0.3);
    }
    70% {
        background-color: rgba(34, 197, 94, 0.08);
        box-shadow: 0 0 10px 2px rgba(34, 197, 94, 0.15);
    }
    100% {
        background-color: transparent;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }
}

/* Évolutions */
.evolution {
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    white-space: nowrap;
}

.evolution.positive {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success-color);
}

.evolution.negative {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
}

.evolution.neutral {
    background: rgba(102, 102, 102, 0.1);
    color: var(--neutral-color);
}

/* Boutons d'action */
.button-container {
    text-align: center;
    padding: 20px 0 30px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.map-button, .print-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.1em;
    text-decoration: none;
    border: none;
    min-width: 220px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.map-button {
    background: linear-gradient(to right, var(--primary-color), #067379);
    color: white;
}

.print-button {
    background: linear-gradient(to right, #666666, #777777);
    color: white;
}

.map-button i, .print-button i {
    margin-right: 10px;
    font-size: 1.2em;
}

.map-button:hover, .print-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Pied de page */
.footer {
    text-align: center;
    color: var(--neutral-color);
    margin: 30px 0;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    font-size: 0.9em;
}

/* Media Queries - Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }

    /* Layout */
    .info-container {
        flex-direction: column;
    }

    .info-container > .section {
        width: 100%;
        max-width: 100%;
    }

    /* Titre */
    .title-banner {
        padding: 10px 15px;
    }  
    
    .title-content {
        flex-direction: column;
    }

    .title-content h1 {
        font-size: 1.3em;
        text-align: center;
    }

    /* Stats - général */
    .synthese-info .monitoring-stat,
    .impact-info .monitoring-stat {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    /* Garder le layout desktop pour Coordonnées et Équipements en mobile */
    .contact-info .monitoring-stat,
    .equipments-info .monitoring-stat {
        display: grid;
        grid-template-columns: auto 1fr;
        gap: 1rem;
        align-items: baseline;
    }

    .contact-info .monitoring-stat-label,
    .equipments-info .monitoring-stat-label {
        font-size: 0.85rem;
    }

    .contact-info .monitoring-stat-number,
    .equipments-info .monitoring-stat-number {
        font-size: 0.9rem;
        overflow-x: auto;
        white-space: nowrap;
        max-width: 100%;
    }

    .monitoring-stat-label {
        font-size: 0.95rem;
    }

    .monitoring-stat-number {
        padding-left: 10px;
    }

    /* Parcelles */
    .parcelle-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px;
        font-size: 0.85rem;
        gap: 10px;
    }

    .parcelle-header .espece-icone {
        width: 20px !important;
        height: 20px !important;
    }

    .parcelle-header-left {
        gap: 8px;
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
        justify-content: space-between;
        width: 100%;
    }

    .parcelle-header-left > span {
        white-space: nowrap;
    }

    .parcelle-header-tags {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        justify-content: flex-end;
    }

    /* Ajustement icône commentaire parcelle sur mobile */
    .parcelle-comment-add-icon {
        font-size: 1.1rem;
        padding: 3px;
    }

    .parcelle-tag {
        padding: 3px 8px;
        font-size: 0.75rem;
    }

    /* Titre section parcelles responsive */
    .section-parcelles h2 {
        font-size: 1.1rem;
        line-height: 1.4;
        word-wrap: break-word;
    }

    /* Forcer 1 colonne pour toutes les cards parcelles */
    .parcelle-content {
        grid-template-columns: 1fr !important;
        display: flex;
        flex-direction: column;
        padding: 15px;
        gap: 15px;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    /* Forcer toutes les variantes de layout à 1 colonne */
    .parcelle-content.one-card,
    .parcelle-content.two-cards,
    .parcelle-content.three-plus-cards {
        grid-template-columns: 1fr !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .monitoring-card {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        box-sizing: border-box;
    }

    .monitoring-card.comments-card {
        width: 100%;
        padding: 10px;
    }

    /* Stats dans les cards parcelles - même layout que Coordonnées */
    .monitoring-card .monitoring-stat {
        display: grid;
        grid-template-columns: minmax(auto, 45%) 1fr;
        gap: 0.5rem;
        align-items: baseline;
        margin-bottom: 10px;
    }

    .monitoring-card .monitoring-stat-label {
        font-size: 0.8rem;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }

    .monitoring-card .monitoring-stat-value {
        display: flex;
        flex-wrap: nowrap;
        gap: 6px;
        align-items: center;
        justify-content: flex-start;
        overflow-x: auto;
        max-width: 100%;
    }

    .monitoring-card .monitoring-stat-number {
        font-size: 0.85rem;
    }

    /* Réduire légèrement les badges dans les cards parcelles */
    .monitoring-card .taux-suivi-badge,
    .monitoring-card .taux-occupation-inline,
    .monitoring-card .evolution-badge {
        font-size: 0.75rem !important;
        padding: 3px 8px !important;
    }

    /* Les badges sont déjà harmonisés au niveau global pour .monitoring-card */

    .monitoring-description {
        padding: 5px 0;
    }
    
    .monitoring-description p {
        font-size: 0.9rem;
        line-height: 1.5;
        margin-bottom: 8px;
    }

    /* Bannière photos méthode - responsive mobile 2x2 */
    .methode-photos-banner {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-bottom: 15px;
    }

    .methode-photo-item img {
        height: 160px;
    }

    /* Effet agrandissement au clic sur mobile */
    .methode-photo-item img.enlarged {
        height: 280px;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
        z-index: 10;
        transform: none; /* Pas de translateY sur mobile pour éviter débordement */
    }

    .methode-photo-caption {
        font-size: 0.7rem;
        margin-top: 4px;
    }

    .monitoring-card-header {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
    
    .monitoring-group {
        padding: 15px;
    }
    
    .monitoring-group-title {
        font-size: 1rem;
        margin-bottom: 12px;
    }
    
    .monitoring-stat-row:last-child {
        border-bottom: none;
    }
    
    .stat-label {
        color: var(--text-color);
    }
    
    .stat-value {
        padding-left: 10px;
        font-size: 0.95rem;
    }

    .monitoring-comment {
        width: 100%;
        padding: 0;
    }
    
    .monitoring-comment p {
        width: 100%;
        box-sizing: border-box;
        font-size: 0.9rem;
        line-height: 1.5;
        margin: 5px 0;  /* Simplifier les marges */
        padding: 0 5px 0 8px;  /* Réduire les paddings */
        text-align: justify;
        -webkit-hyphens: auto;
        -ms-hyphens: auto;
        hyphens: auto;
        border-left: 2px solid var(--primary-color);
    }

    .comment-form-body {
        padding: 0;
    }

    .comment-textarea {
        font-size: 0.85rem;
    }

    /* Boutons */
    .button-container {
        flex-direction: column;
        align-items: center;
        padding: 15px 0;
    }

    .map-button, .print-button {
        width: 100%;
        max-width: 300px;
        padding: 12px 20px;
        font-size: 1rem;
    }

    /* Bannière panoramique - Tablette */
    .impact-thumbnails-banner {
        padding: 12px;
        margin: 15px 0 20px 0;
    }
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0);
    overflow-y: auto;
    transition: background-color 0.3s ease;
}

.modal.modal-open {
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 50px auto;
    padding: 0;
    border: 1px solid #888;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    transform: scale(0.7);
    opacity: 0;
    transition: all 0.3s ease;
}

/* Modale commentaire plus large */
#commentModal .modal-content {
    max-width: 650px;
}

.modal.modal-open .modal-content {
    transform: scale(1);
    opacity: 1;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 600;
}

/* Titre plus petit pour la modale commentaire */
#commentModal .modal-header h2 {
    font-size: 1.2rem;
    line-height: 1.4;
}

.modal-header h2 i {
    margin-right: 10px;
    color: var(--primary-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    line-height: 20px;
    padding: 0;
    width: 30px;
    height: 30px;
}

.modal-close:hover,
.modal-close:focus {
    color: #000;
}

.modal-body {
    padding: 20px;
}

.modal-body p {
    margin-bottom: 15px;
    color: #333;
}

.modal-body input[type="email"],
.modal-body input[type="text"],
.modal-body input[type="password"] {
    width: 100%;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    box-sizing: border-box;
    background-color: #fafafa;
    transition: all 0.3s ease;
}

.modal-body input[type="email"]:focus,
.modal-body input[type="text"]:focus,
.modal-body input[type="password"]:focus,
.modal-body textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(4, 91, 98, 0.1);
}

/* Style pour le textarea commentaire avec poignée de redimensionnement */
#comment-input {
    resize: vertical;
    min-height: 120px;
    max-height: 400px;
}

.modal-message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 4px;
    display: none;
    align-items: center;
    gap: 10px;
}

.modal-message i {
    font-size: 1.2em;
}

.modal-message.success,
.modal-message.error,
.modal-message.loading {
    display: flex;
}

.modal-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.modal-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.modal-message.loading {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.modal-message.loading::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #0c5460;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Styles pour le chronomètre */
.modal-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 10px 0;
    padding: 8px 12px;
    background-color: #f0f9fa;
    border-radius: 4px;
    font-size: 14px;
    color: var(--primary-color);
    font-weight: 500;
}

.modal-timer i {
    font-size: 16px;
}

.modal-body .admin-info {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 12px;
    margin: 15px 0;
    font-size: 14px;
    color: #856404;
}

.modal-body .admin-info i {
    margin-right: 8px;
    color: #f39c12;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.btn-primary {
    background-color: #39825a;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #2d6648;
}

.btn-primary:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

/* Media query pour mobile - Modal responsive */
@media (max-width: 768px) {
    .modal-content {
        margin: 20px auto;
        width: 95%;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-header h2 {
        font-size: 1.2rem;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .modal-close {
        font-size: 24px;
    }
}

/* Très petits écrans */
@media (max-width: 480px) {
    .parcelle-tag {
        padding: 3px 8px;
        font-size: 0.7rem;
    }
 
    .parcelle-content {
        padding: 10px;
        gap: 10px;
        font-size: 0.7rem;
    }
 
    .references {
        font-size: 0.6rem;
    }
    
    .monitoring-group {
        padding: 12px;
    }
 
    .monitoring-description p {
        font-size: 0.8rem;
    }    
 
    .title-content h1 {
        font-size: 1.1em;
    }
 
    .monitoring-stat-label,
    .monitoring-stat-number {
        font-size: 0.8rem;
    }
 
    .monitoring-card-header {
        font-size: 1rem;
    }

    .monitoring-card.comments-card {
        padding: 8px;
    }
 
    .monitoring-comment p {
        font-size: 0.7rem;
        padding: 0 3px 0 6px; 
    }
 
    .footer {
        font-size: 0.7rem;
    }

    /* Bannière panoramique - Mobile */
    .impact-thumbnails-banner {
        padding: 10px;
        margin: 12px 0 18px 0;
    }

    .impact-thumbnails-banner img {
        width: 100%;
    }

    /* Lignes cliquables impact - Mobile */
    .impact-stat-clickable {
        padding: 8px 40px 8px 42px;
    }

    .impact-stat-clickable::after {
        right: 12px;
        width: 6px;
        height: 6px;
    }

    /* Icônes espèces impact - Mobile */
    .impact-info-icon {
        left: 12px;
        width: 24px;
        height: 24px;
        min-width: 24px;
        min-height: 24px;
    }
}

/* ===========================================
   NOUVEAU V2 UPGRADED : CSS TABLEAU GROUPES ESPÈCES
   =========================================== */

@media screen {
.table-responsive {
    overflow-x: auto;
    margin-top: 20px;
}

.especes-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 700px;
    background: white;
}

.especes-table th,
.especes-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.especes-table tbody tr {
    height: 56px;
}

.especes-table tbody tr:not(.total-exploitation-row) {
    height: 56px;
}

.especes-table tbody td {
    height: 56px;
    line-height: 1.5;
}

.especes-table tbody tr:not(.total-exploitation-row) td {
    height: 56px;
}

/* Colonne Espèce (1ère colonne) */
.especes-table th:nth-child(1),
.especes-table td:nth-child(1) {
    padding-left: 16px;
}

/* Colonnes Suivis (Nb et %) */
.especes-table td:nth-child(3),
.especes-table td:nth-child(4) {
    text-align: center;
    white-space: nowrap;
    padding: 12px 4px;
    width: 70px;
}

/* Colonnes Occupés (Nb et %) */
.especes-table td:nth-child(5),
.especes-table td:nth-child(6) {
    text-align: center;
    white-space: nowrap;
    padding: 12px 4px;
    width: 70px;
}

/* Espace supplémentaire entre Suivis et Occupés */
.especes-table td:nth-child(5),
.especes-table th:nth-child(5) {
    padding-left: 12px;
}

/* Colonne Nb individus */
.especes-table td:nth-child(7) {
    text-align: center;
}

/* Colonne Évolution */
.especes-table td:nth-child(8) {
    text-align: center;
}

/* Headers des colonnes Suivis et Occupés */
.especes-table th:nth-child(3),
.especes-table th:nth-child(4) {
    padding: 8px 4px;
}

.especes-table th {
    background-color: #045B62;
    font-weight: 600;
    color: white;
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 8px 12px;
    border: none;
    border-right: 1px solid #045B62;
}

.especes-table thead tr th:first-child {
    border-left: 4px solid #045B62;
}

.especes-table th:last-child {
    border-right: none;
}

.especes-table tr:hover {
    background-color: #f8f9fa;
}

.especes-table .espece-nom {
    font-weight: 600;
    color: var(--primary-color);
}

/* Styles pour les groupes d'espèces */
.especes-table .groupe-espece-row {
    background-color: #f0f9fa;
    font-weight: 600;
}

.especes-table .groupe-espece-row:hover {
    background-color: #e1f4f6;
}

/* Désactiver les styles de lien dans les lignes de groupe */
.especes-table .groupe-espece-row td {
    cursor: default;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 600;
}

/* Bordure gauche colorée uniquement sur la première cellule */
.especes-table .groupe-espece-row td:first-child {
    border-left: 4px solid var(--primary-color);
}

/* Ligne de total de l'exploitation */
.especes-table .total-exploitation-row {
    background: #e8f4f5;
    color: var(--text-color);
    font-weight: 600;
    border-bottom: 10px solid #ffffff;
    transition: background-color 0.2s ease;
}

.especes-table .total-exploitation-row:hover {
    background: #d8eef0;
}

/* Styles des cellules du total */
.especes-table .total-exploitation-row td {
    padding: 12px;
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.95em;
    border-bottom: none;
    height: 56px;
    border-top: 10px solid #ffffff;
}

.especes-table .total-exploitation-row td:first-child {
    border-left: none;
    padding-left: 15px;
}

.especes-table .total-exploitation-row .total-label {
    font-size: 0.9em;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--primary-color);
}

/* Groupe avec sous-espèces (cliquable) */
.especes-table .groupe-nom {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-color);
    padding-left: 0px;
    font-weight: 600;
    width: 100%;
}

.especes-table .groupe-toggle {
    font-size: 0.9em;
    transition: transform 0.2s ease;
    color: var(--primary-color);
}

/* Groupe simple (non cliquable) */
.especes-table .groupe-nom-simple {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-color);
    padding-left: 0px;
    font-weight: 600;
    width: 100%;
}

/* Styles pour les espèces détaillées */
.especes-table .espece-detail-row {
    background-color: #fafafa;
}

.especes-table .espece-detail-row:hover {
    background-color: #f0f0f0;
}

/* Bordure gauche uniquement sur la première cellule des lignes de détail */
.especes-table .espece-detail-row td:first-child {
    border-left: 2px solid #ccc;
}

.especes-table .espece-detail {
    font-weight: 400;
    color: #666;
    font-size: 0.95em;
    padding-left: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.especes-table .espece-detail > span {
    margin-left: 0 !important;
}

.especes-table .equipement-clickable {
    cursor: pointer;
    color: var(--primary-color);
    text-decoration: underline;
    font-weight: 500;
}

.especes-table .equipement-clickable:hover {
    color: #005cbf;
}

/* Badge pour le taux de suivi */
.taux-suivi-badge {
    display: inline-block;
    padding: 4px 10px;
    background-color: rgba(4, 91, 98, 0.1);
    color: #045B62;
    border: 1px dashed rgba(4, 91, 98, 0.3);
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    cursor: help;
}

/* Taux de suivi faible (< 50%) */
.taux-suivi-badge.low {
    background-color: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px dashed rgba(239, 68, 68, 0.3);
}

/* Badges cliquables sur mobile */
@media (hover: none) and (pointer: coarse) {
    .taux-suivi-badge,
    .taux-occupation-inline,
    .evolution-badge {
        cursor: pointer;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }

    .taux-suivi-badge:active,
    .taux-occupation-inline:active,
    .evolution-badge:active {
        transform: scale(0.95);
        transition: transform 0.1s;
    }
}

/* Badge pour le pourcentage d'occupation */
.taux-occupation-inline {
    display: inline-block;
    padding: 4px 10px;
    background-color: rgba(4, 91, 98, 0.1);
    color: #045B62;
    border: 1px dashed rgba(4, 91, 98, 0.3);
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    cursor: help;
}

/* Badge pour taux d'occupation élevé (≥ 25%) - Fond vert uni avec bordure pointillée */
.taux-occupation-inline.high {
    background: #f0fdf4;
    color: #15803d;
    border: 1px dashed #86efac;
    transition: all 0.3s ease;
}

.especes-table .evolution {
    font-weight: 500;
}

/* Tooltips modernes */
.tooltip-wrapper {
    position: relative;
    display: inline-block;
    z-index: 1;
}

.tooltip-wrapper[data-tooltip]::before,
.tooltip-wrapper[data-tooltip]::after {
    position: fixed;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 100000;
}

/* Bulle du tooltip */
.tooltip-wrapper[data-tooltip]::before {
    content: attr(data-tooltip);
    left: var(--tooltip-left, 50%);
    top: var(--tooltip-top, 0);
    transform: translateX(-50%);
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    font-size: 0.85rem;
    font-weight: 400;
    line-height: 1.4;
    border-radius: 6px;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Flèche du tooltip */
.tooltip-wrapper[data-tooltip]::after {
    content: '';
    left: var(--arrow-left, 50%);
    top: var(--arrow-top, 0);
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
}

/* Affichage au survol */
.tooltip-wrapper[data-tooltip]:hover::before,
.tooltip-wrapper[data-tooltip]:hover::after {
    opacity: 1;
}

/* Tooltip multiligne pour textes longs */
.tooltip-wrapper[data-tooltip-long]::before {
    content: attr(data-tooltip-long);
    white-space: normal;
    max-width: 250px;
    text-align: center;
}

/* Badges d'évolution - Style moderne avec icône en couleur */
.evolution-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    background: white;
    border: 1.5px solid;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Badges d'évolution dans les cards parcelles : même taille que badges de taux */
.monitoring-card .evolution-badge {
    padding: 4px 10px;
    font-size: 0.85rem;
    font-weight: 600;
    gap: 4px;
}

.evolution-badge.positive {
    background: linear-gradient(to bottom, #ffffff, #f0fdf4);
    color: #15803d;
    border-color: #86efac;
}

.evolution-badge.negative {
    background: linear-gradient(to bottom, #ffffff, #fef2f2);
    color: #b91c1c;
    border-color: #fca5a5;
}

.evolution-badge.stable {
    background: linear-gradient(to bottom, #ffffff, #f9fafb);
    color: #6b7280;
    border-color: #d1d5db;
}

.evolution-badge.no-data {
    background: transparent;
    color: #9ca3af;
    border: none;
    font-weight: 400;
    box-shadow: none;
}

/* Anciens styles pour compatibilité */
.especes-table .evolution.positive {
    color: #28a745;
}

.especes-table .evolution.negative {
    color: #dc3545;
}

.especes-table .evolution.neutral {
    color: #6c757d;
}

/* Espacement global des icônes d'espèces */
.espece-icone {
    vertical-align: middle;
}

/* Desktop - Taille des icônes */
.especes-table .espece-icone {
    width: 28px;
    height: 28px;
}

/* Mobile : Désactiver les tooltips en mode tactile */
@media (hover: none) and (pointer: coarse) {
    .tooltip-wrapper[data-tooltip]::before,
    .tooltip-wrapper[data-tooltip]::after,
    .tooltip-wrapper[data-tooltip-long]::before {
        display: none;
    }
}

/* Tooltip mobile au clic - affiché au-dessus du badge */
.badge-mobile-tooltip {
    position: fixed;
    left: var(--tooltip-left, 50%);
    bottom: var(--tooltip-bottom, auto);
    transform: translateX(-50%) translateY(10px);
    background: rgba(0, 0, 0, 0.92);
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.8rem;
    line-height: 1.4;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-width: 180px;
    max-width: min(320px, calc(100vw - 32px));
    width: max-content;
    text-align: center;
    z-index: 100001;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Flèche du tooltip mobile */
.badge-mobile-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.92);
}

/* Animation d'apparition */
.badge-mobile-tooltip.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Animation de disparition */
.badge-mobile-tooltip.hide {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
}

/* Wrapper pour positionner le tooltip */
.tooltip-wrapper {
    position: relative;
    display: inline-block;
}

/* Mobile */
@media screen and (max-width: 768px) {
    /* Ajustement icône commentaire ferme sur mobile */
    .ferme-comment-add-icon {
        font-size: 1.2rem;
        padding: 4px;
    }

    /* Ajuster le header synthèse pour éviter débordement */
    #synthese-header-container {
        gap: 8px;
        flex-wrap: nowrap;
    }

    .especes-table {
        font-size: 0.9em;
        min-width: 650px;
    }

    .especes-table th,
    .especes-table td {
        padding: 8px 4px;
    }

    /* Réduire la taille des icônes d'espèces en mode mobile */
    .especes-table .espece-icone {
        width: 20px;
        height: 20px;
    }

    .especes-table .groupe-nom,
    .especes-table .groupe-nom-simple {
        font-size: 0.95em;
        gap: 6px;
    }

    /* Tooltips plus compacts sur mobile */
    .tooltip-wrapper[data-tooltip]::before,
    .tooltip-wrapper[data-tooltip-long]::before {
        font-size: 0.75rem;
        padding: 6px 10px;
        max-width: 200px;
    }

    /* Responsive section rapaces mobile */
    .estimation-disclaimer {
        font-size: 0.8rem;
        padding: 6px 10px;
    }

    .btn-methodology {
        font-size: 0.85rem;
        padding: 8px 12px;
    }

    .methodology-panel {
        padding: 15px;
    }

    .methodology-panel h4 {
        font-size: 0.95rem;
    }
}

/* Tablette */
@media screen and (max-width: 992px) {
    .table-responsive {
        box-shadow: inset -5px 0 5px -5px rgba(0,0,0,0.1);
    }
}
} /* Fin @media screen */

