@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap');

/* Variables CSS */
:root {
    --spygen-green: #11a37b;
    --spygen-teal: #1dac78;
    --spygen-blue: #003994;
    --spygen-lightblue: #e3f2fd;
    --spygen-yellow: #bfcf2b;
    --spygen-dark: #093948;
    --spygen-grey: #f4f4f4;
    --spygen-lightgrey: #e9ecef;
    --spygen-violet: #ede7f6;
    --spygen-orange: #fff3e0;
    --spygen-pink: #fce4ec;
    --spygen-beige: #f8f6f2;
}

/* Reset et styles de base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'DM Sans', Arial, sans-serif;
    background-color: var(--spygen-grey);
    margin: 0;
    padding: 0;
    color: var(--spygen-dark);
}

/* Container principal */
.container {
    width: calc(100vw - 32px);
    max-width: 1600px;
    margin: 32px auto;
    padding: 32px;
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    box-sizing: border-box;
}

/* En-tête avec logo et titre */
.header-logo-title {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 24px;
    justify-content: center;
}

.logo-title-img {
    height: 48px;
    width: auto;
    display: block;
}

h1 {
    margin: 0;
    color: var(--spygen-teal);
    font-family: 'DM Sans', Arial, sans-serif;
    text-align: center;
    font-size: 2.5rem;
    font-weight: 700;
}

h2 {
    color: var(--spygen-dark);
    font-family: 'DM Sans', Arial, sans-serif;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-top: 0.7em;
    margin-bottom: 0.5em;
    font-size: 1.8rem;
}

/* Grille des sections */
.sections-row {
    margin: 0;
    padding: 0;
}

.custom-grid {
    display: grid;
    grid-template-columns: 1.2fr 1.8fr;
    grid-template-rows: 1fr 1fr auto;
    gap: 12px;
}

.section-col-gauche {
    grid-column: 1 / 2;
    grid-row: 1 / 3;
}

.section-col-droite:first-of-type {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
}

.section-col-droite:last-of-type {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
}

.section-row-bottom {
    grid-column: 1 / 3;
    grid-row: 3 / 4;
}

/* Sections */
.section {
    padding: 32px;
    border-radius: 16px;
    box-sizing: border-box;
    background: var(--spygen-beige);
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #929292;
    font-family: 'DM Sans', Arial, sans-serif;
    font-weight: bold;
}

/* Champs de formulaire */
input, select {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
    background-color: #fff;
    color: var(--spygen-teal);
    border: 1.5px solid var(--spygen-teal);
    border-radius: 8px;
    font-family: 'DM Sans', Arial, sans-serif;
    font-size: 1em;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

input::placeholder, select::placeholder {
    color: var(--spygen-teal);
    opacity: 1;
}

select[multiple] {
    height: 90px;
    min-height: 3em;
    background: #fff;
    border: 1.5px solid var(--spygen-teal);
    border-radius: 8px;
    color: var(--spygen-teal);
    cursor: pointer;
    font-size: 1em;
    margin-top: 2px;
}

/* États d'erreur */
.error-highlight {
    border-color: #114451 !important;
    background: rgba(17, 68, 81, 0.18) !important;
    color: #114451 !important;
}

/* Exception pour les boutons taxonomiques - ne pas écraser les images */
#taxonomicGroupBtns .btn-multi.error-highlight {
    background: none !important;
    background-image: inherit !important;
    border-color: #114451 !important;
    box-shadow: 0 0 0 2px rgba(17, 68, 81, 0.3) !important;
    color: inherit !important;
}

#taxonomicGroupBtns .btn-multi.error-highlight .btn-label {
    background: rgba(17, 68, 81, 0.8) !important;
    color: #fff !important;
}

input.error-highlight::placeholder,
textarea.error-highlight::placeholder {
    color: #114451 !important;
    opacity: 1;
}

/* Boutons principaux */
button, .btn-large {
    width: 100%;
    padding: 10px;
    background-color: var(--spygen-teal);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: 'DM Sans', Arial, sans-serif;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px 0 rgba(17, 173, 123, 0.08);
    transition: background 0.2s, box-shadow 0.2s;
}

button:hover, .btn-large:hover {
    background-color: #168a5e;
    box-shadow: 0 4px 16px 0 rgba(17, 173, 123, 0.16);
}

/* Groupes de boutons multi-sélection */
.btn-multi-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 5px;
}

.btn-multi {
    padding: 8px 16px;
    border: 1.5px solid var(--spygen-teal);
    background: #fff;
    color: var(--spygen-teal);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    font-size: 1em;
    min-width: 160px;
    flex: 1 1 160px;
    max-width: 100%;
    box-sizing: border-box;
    white-space: normal;
    font-family: 'DM Sans', Arial, sans-serif;
    box-shadow: 0 2px 8px 0 rgba(28, 46, 162, 0.04);
}

.btn-multi:hover:not(:disabled) {
    background: var(--spygen-teal);
    color: #fff;
    border-color: var(--spygen-teal);
    box-shadow: 0 2px 12px 0 rgba(28, 46, 162, 0.12);
}

.btn-multi.selected {
    background: rgba(29, 172, 120, 0.25);
    color: #fff;
    border-color: var(--spygen-teal);
    box-shadow: 0 2px 12px 0 rgba(28, 46, 162, 0.12);
}

/* Groupes de boutons sélection unique */
.btn-dyn-group {
    display: flex;
    gap: 10px;
    margin-top: 5px;
}

.btn-dyn {
    padding: 8px 16px;
    border: 1.5px solid var(--spygen-teal);
    background: #fff;
    color: var(--spygen-teal);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    font-family: 'DM Sans', Arial, sans-serif;
    box-shadow: 0 2px 8px 0 rgba(162, 57, 28, 0.04);
}

.btn-dyn:hover:not(:disabled) {
    background: var(--spygen-teal);
    color: #fff;
    border-color: var(--spygen-teal);
    box-shadow: 0 2px 12px 0 rgba(28, 46, 162, 0.12);
}

.btn-dyn.selected {
    background: var(--spygen-teal);
    color: #fff;
    border-color: var(--spygen-teal);
    box-shadow: 0 2px 12px 0 rgba(28, 46, 162, 0.12);
}

/* Boutons avec images taxonomiques */
#taxonomicGroupBtns .btn-multi {
    background-size: cover;
    background-position: center;
    color: #fff;
    border: 2px solid #ccc;
    min-width: 120px;
    min-height: 80px;
    font-weight: bold;
    font-size: 1rem;
    margin: 0 8px 8px 0;
    transition: border 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: inline-block;
    position: relative;
    text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

#taxonomicGroupBtns .btn-multi.selected {
    border: 2.5px solid var(--spygen-green);
    box-shadow: 0 0 0 3px #b6f2e0;
    z-index: 2;
}

#taxonomicGroupBtns .btn-multi .btn-label {
    position: absolute;
    left: 0; 
    right: 0; 
    bottom: 0;
    background: rgba(0,0,0,0.45);
    color: #fff;
    padding: 4px 0;
    font-size: 0.95em;
    text-align: center;
    width: 100%;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    transition: color 0.2s;
}

#taxonomicGroupBtns .btn-multi.selected .btn-label {
    color: var(--spygen-green);
}

#taxonomicGroupBtns .btn-multi:hover .btn-label {
    color: #3ed7a0;
}


/* Tooltips */
.tooltip-container {
    position: relative;
    display: inline-block;
    margin-left: 6px;
}

.tooltip-icon {
    cursor: pointer;
    color: var(--spygen-dark);
    font-size: 1em;
    border-radius: 50%;
    border: 1px solid var(--spygen-dark);
    width: 1.2em;
    height: 1.2em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    transition: background 0.2s;
    position: relative;
}

.tooltip-icon:hover {
    background: #e9ecef;
}

.tooltip-hover-text {
    visibility: hidden;
    opacity: 0;
    width: max-content;
    max-width: 260px;
    background: #fff;
    color: var(--spygen-dark);
    border: 1px solid var(--spygen-dark);
    border-radius: 6px;
    padding: 7px 13px;
    font-size: 0.98em;
    font-family: 'DM Sans', Arial, sans-serif;
    font-weight: normal;
    position: absolute;
    left: 110%;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    box-shadow: 0 2px 8px 0 rgba(17, 173, 123, 0.10);
    transition: opacity 0.18s, visibility 0.18s;
    pointer-events: none;
    white-space: pre-line;
}

.tooltip-icon:hover .tooltip-hover-text,
.tooltip-icon:focus .tooltip-hover-text {
    visibility: visible;
    opacity: 1;
}

/* Modales */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.45);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-box {
    background: #fff;
    border-radius: 16px;
    max-width: 480px;
    width: 90vw;
    box-shadow: 0 8px 32px 0 rgba(0,0,0,0.18);
    padding: 32px 24px 24px 24px;
    position: relative;
    animation: modalFadeIn 0.25s;
}

.modal-title {
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 18px;
    color: var(--spygen-teal);
    font-family: 'DM Sans', Arial, sans-serif;
}

.modal-content {
    color: var(--spygen-dark);
    font-size: 1.05em;
    white-space: pre-line;
    margin-bottom: 18px;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: #fff;
    border: 1.5px solid var(--spygen-teal);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.3em;
    color: var(--spygen-teal);
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px 0 rgba(17, 173, 123, 0.10);
    transition: background 0.18s, color 0.18s, border-color 0.18s;
    z-index: 1010;
}

.modal-close:hover, .modal-close:focus {
    background: var(--spygen-teal);
    color: #fff;
    border-color: #168a5e;
    outline: none;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Accordéon dans les modales */
.modal-accordion-item {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
}

.modal-accordion-header {
    background: #f8f9fa;
    color: var(--spygen-dark);
    cursor: pointer;
    padding: 12px 16px;
    width: 100%;
    text-align: left;
    border: none;
    outline: none;
    font-weight: 600;
    font-size: 1em;
    transition: background-color 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-accordion-header:hover {
    background-color: #e9ecef;
}

.modal-accordion-header.active {
    background-color: var(--spygen-teal);
    color: white;
}

.modal-accordion-icon {
    font-size: 0.8em;
    transition: transform 0.2s ease;
}

.modal-accordion-header.active .modal-accordion-icon {
    transform: rotate(180deg);
}

.modal-accordion-content {
    padding: 0;
    background-color: white;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.modal-accordion-content.active {
    padding: 16px;
    max-height: 500px;
}

.modal-content ol, .modal-content ul {
    margin-left: 2.2em !important;
    padding-left: 1.2em !important;
    margin-bottom: 1em;
}

.modal-content li {
    margin-bottom: 0.4em;
    padding-left: 0.2em;
}

/* Messages de profondeur */
#depthMessage {
    background: rgba(29, 172, 120, 0.1);
    color: var(--spygen-teal);
    padding: 0.75rem;
    border-radius: 8px;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

/* Utilitaires */
.hidden {
    display: none !important;
}

.fade-in {
    opacity: 0;
    animation: fadeIn 0.5s forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 900px) {
    .custom-grid {
        display: block;
    }
    
    .custom-grid .section {
        width: 100%;
        margin-bottom: 24px !important;
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .custom-grid .section:last-child {
        margin-bottom: 0 !important;
    }
    
    .btn-multi {
        font-size: 0.95em;
        min-width: 120px;
        padding: 8px 8px;
    }
    
    .container {
        padding: 1rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .header-logo-title {
        flex-direction: column;
        text-align: center;
    }
}