/* Import des polices */
@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400..800;1,400..800&family=Great+Vibes&display=swap');

:root {
    --primary: #615447;
    --secondary: #2f4634;
    --text: #000;
    --background: #fbe1b4;
}

/* Appliquer un reset global */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'EB Garamond', sans-serif;
    font-size: 20px;
}

/* BASE : Corps de page */
html, body {
    margin: 0;
    min-height: 100%;
}

body {
    justify-content: center;
    background-image: url('../../images/asfalt-dark.png');
    background-color: var(--background);
    background-repeat: repeat;
    background-size: 100px 100px;
    color: var(--text);
}

.hidden-theme {
    display: none;
}

.mt-5 {
    margin-top: 0 !important;
    margin-bottom: 20px;
    margin-left: 20px;
    margin-right: 20px;
}

/* TITRES */
h1, h2, h3 {
    color: var(--text);
}

h1 {
    font-family: "Great Vibes", cursive;
    font-size: 70px;
    font-weight: bold;
    letter-spacing: -2px;
}

h2 {
    font-size: 30px;
    font-weight: bold;
}

h3 {
    font-size: 24px;
    font-weight: 100;
}

/* LIENS INTERACTIFS (DANS TITRES) */

.title_logo {
    display: flex;
}

.title_logo img {
    width: 130px;
    height: auto;
}

.title {
    margin-top: auto;
    margin-bottom: auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.title_logo h1, .title_logo h2 {
    transition: color 0.1s ease-in-out;
}

.title_logo:hover h1,
.title_logo:hover h2 {
    color: var(--secondary);
}

/* HEADER */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 20px;
}

header .title h2, header .title h3 {
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

header .title h1 {
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

header .title h2 {
    margin-top: -25px;
    margin-left: 85px;
}

header a {
    text-decoration: none;
}

.left-header {
    display: flex;
}

/* ACTION BUTTONS (Upload/Logout) */
.actions {
    display: flex;
    justify-content: right;
    gap: 10px;
    margin-left: 10px;
}

.loading {
    height: 25px;
    margin: auto 10px auto 10px;
    display: none;
}

.logout button, .upload-button, .action-button {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    color: #fff;
    border-radius: 5px;
    background-color: var(--primary);
    transition: all 0.3s linear;
    cursor: pointer;
    height: 45px;
}

.upload-button {
    padding: 10px;
}

.user-menu {
    margin: 10px;
}

.user-icon {
    height: 40px;
    width: 40px;
    fill: #fff;
}

.logout button:hover, .upload-button:hover, .action-button:hover {
    background-color: var(--secondary);
}

#folderInput {
    display: none;
}

.upload-button svg, .action-button svg {
    width: 24px;
    height: 24px;
}

/* TABS & ONGLET */

.tab {
    display: flex;
}

.onglet {
    position: relative;
    margin-left: 5px;
}

#logout-label {
    margin-left: 8px;
}

.tab a {
    border: none;
    width: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    transition: all 0.3s linear;
    cursor: pointer;
    padding: 10px;
    height: 50px;
}

.icon_tab {
    max-height: 45px;
    max-width: 50px;
    margin-right: 10px;
}

.tab a:hover {
    color: var(--secondary);
    font-weight: bold;
}

/* UTILISATEUR (Dropdown) */
.user-container {
    display: flex;
    position: relative;
}

.user-button {
    display: flex;
    background-color: transparent;
    color: #fff;
    font-size: 16px;
    border: none;
    cursor: pointer;
    border-radius: 5px;
}

.user-button:hover {
    background-color: transparent;
}

.logout-button {
    all: unset !important;
}

.user-container:hover .dropdown-content {
    display: block;
}

.dropdown-content {
    display: none;
    position: absolute;
    margin-top: 2px;
    background-image: url('../../images/asfalt-dark.png');
    background-color: var(--background);
    background-repeat: repeat;
    background-size: 100px 100px;
    border: 1px solid var(--primary);
    min-width: 160px;
    z-index: 1;
    right: 0;
    top: 45px;
}

.dropdown-content a {
    color: #000;
    padding: 10px 16px;
    text-decoration: none;
    display: block;
    transition: all 0.2s ease-in-out;
}

.dropdown-content a:hover {
    background-color: var(--secondary);
    color: white;
}

/* CARTE */

#pagination-header[data-origine="carte"] {
    visibility: hidden;
}

#carte {
    background-color: #fff;
    height: calc(100vh - 40px);
    border: 1px solid var(--primary);
    outline: 2px solid var(--primary);
    outline-offset: 10px;
    margin: auto 10px 0 10px
}

#error-carte {
    display: none;
    margin-bottom: 40px;
}

#pagination-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    width: 100%;
    gap: 10px;
}

/* FORMULAIRE */

.container .formulaire {
    position: relative;
    margin: 20px auto 0 auto;
    max-width: 1100px;
    overflow: hidden;
    padding: 20px;
    border: 1px solid var(--primary);
    outline: 2px solid var(--primary);
    outline-offset: 10px;
}

.errorlist {
    list-style-type: none;
}

.errorlist li {
    font-size: 12px;
    font-style: italic;
}

.row {
    --space-between: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-between);
}

.mb-4 {
    margin-bottom: 0 !important;
}

button, input, optgroup, select, textarea {
    font-size: inherit;
}

th {
    text-align: inherit;
}

.col-md-4 {
    flex: 0 0 auto;
    width: calc(33.33333333% - 10px);
}

.container .formulaire .form {
    position: absolute;
    background-color: #fff;
    transition: 0.3s ease;
}

.container .formulaire .formulaire.second {
    opacity: 0;
    pointer-events: none;
    transform: translateX(100%);
}

.formulaire.secActive .formulaire.second {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

.formulaire.secActive .formulaire.first {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-100%);
}

.container .formulaire .fields {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.formulaire .fields input {
    display: flex;
    width: calc(100% / 3 - 15px);
    flex-direction: column;
    margin: 4px 0;
}

.formulaire input, .formulaire select {
    outline: none;
    font-size: 14px;
    font-weight: 400;
    color: #000;
    border-radius: 5px;
    border: 1px solid var(--primary);
    background-color: transparent;
    padding: 0 5px;
    height: 30px;
    width: 100%;
    max-width: 300px;
    margin: 3px 0;
}

.formulaire input select,
.formulaire input[type="date"] {
    -webkit-appearance: none;
    appearance: none;
    color: #707070;
}

.formulaire input[type="date"]:valid {
    color: #000;
}

.container .formulaire .btn, .backBtn {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 35px;
    max-width: 150px;
    width: 100%;
    border: none;
    outline: none;
    color: #fff;
    border-radius: 5px;
    margin-right: 0;
    margin-left: auto;
    background-color: var(--primary);
    transition: all 0.3s linear;
    cursor: pointer;
}

.container .formulaire .btnText {
    font-size: 14px;
    font-weight: 400;
}

.container .formulaire .btn:hover {
    background-color: var(--secondary);
}

.formulaire .btn i,
.formulaire .backBtn i {
    margin: 0 6px;
}

.formulaire .backBtn i {
    transform: rotate(180deg);
}

.formulaire .buttons {
    display: flex;
    align-items: center;
}

.formulaire .buttons .btn, .backBtn {
    margin-right: 14px;
}

.formulaire p {
    margin-bottom: 0;
}


.input-container {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 300px;
}

.input-container input[type="date"] {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 30px;
    font-size: 12px;
}

.date {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.input-container .clear-btn {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--primary);
    font-size: 14px;
    display: none;
    transition: color 0.2s ease-in-out;
}

.input-container .clear-btn:hover {
    color: var(--primary);
}

.clear-all {
    position: absolute;
    right: 20px;
    top: 20px;
    cursor: pointer;
    color: var(--primary);
    font-size: 18px;
    transition: color 0.2s ease-in-out;
    user-select: none;
}

.clear-all:hover {
    color: #000;
}

.hidden {
    max-height: 0 !important;
    margin-top: 0 !important;
    opacity: 0;
}

#form-content {
    margin-top: 10px;
    max-height: 1000px;
    transition: max-height 0.5s ease-out, opacity 0.5s ease-out, margin-top 0.5s ease-out;
}

#toggle-form {
    border: none;
    outline: none;
    color: #000;
    background-color: transparent;
    cursor: pointer;
    width: calc(100% - 90px);
    display: flex;
}

#toggle-form > svg {
    transition: all 0.2s linear;
}

@media (max-width: 811px) {
    .btn {
        margin-top: 10px;
    }

    .container .formulaire {
        overflow-y: scroll;
    }

    .container .formulaire::-webkit-scrollbar {
        display: none;
    }

    .formulaire .fields input {
        width: calc(100% / 2 - 15px);
    }

    .formulaire input, .formulaire select, .input-container {
        max-width: unset;
    }

    .row {
        justify-content: space-between;
    }

    .col-md-4 {
        width: calc(50% - 10px);
    }
}

@media (max-width: 578px) {
    .col-md-4 {
        width: calc(100%);
    }
}

/* IMAGE POPUP */

.gallery {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.thumbnail {
    object-fit: cover;
    cursor: pointer;
    max-height: 100px;
    max-width: 80px;
}

.popup {
    display: none;
    position: fixed;
    flex-direction: column;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.popup-container {
    position: relative;
    background-image: url('../../images/asfalt-dark.png');
    background-color: var(--background);
    background-repeat: repeat;
    background-size: 100px 100px;
    max-width: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: visible;
    padding: 30px 30px 0 30px;
}

.popup-border {
    background: #dde5c0;
    border: 1px solid var(--primary);
    padding: 8px;
}

.popup-content {
    position: relative;
    margin: 10px;
    outline: 2px solid var(--primary);
    outline-offset: 4px;
}

#legend {
    background-image: url('../../images/asfalt-dark.png');
    background-color: var(--background);
    background-repeat: repeat;
    background-size: 100px 100px;
    width: 100%;
    border: 1px solid transparent;
}

#popup-img {
    max-width: 100%;
    max-height: 75vh;
    height: auto;
    width: auto;
    object-fit: contain;
    border: 1px solid var(--primary);
    margin-bottom: -6px;
}

#image-name {
    position: absolute;
    font-size: 15px;
    top: 10px;
    right: 30px;
}

.seal {
    max-width: 50px;
    width: 20%;
    position: absolute;
    bottom: 60px;
    right: 20px;
    rotate: -30deg;
    font-size: 20px;
    font-weight: 100;
    font-family: "Great Vibes", cursive;
    letter-spacing: -0px;
}

#image-title {
    margin-top: 10px;
    text-align: center;
    word-wrap: break-word;
    font-size: 20px;
    max-width: 100%;
    padding-right: 10px;
    padding-left: 10px;
}

#image-title > i {
    word-wrap: break-word;
    font-size: 20px;
}

#image-info {
    text-align: center;
    word-wrap: break-word;
    font-size: 16px;
    max-width: 100%;
    margin: auto 10px 10px 10px;
    padding-right: 10px;
    padding-left: 10px;
}

.popup_button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: transparent;
    border: none;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
}

#close-popup {
    position: absolute;
    background-color: transparent;
    top: 15px;
    right: 5px;
    font-size: 30px;
}

#close-icon, #next-icon, #prev-icon {
    fill: var(--primary);
}

.prev {
    left: -40px;
}

.next {
    right: -40px;
}

@media (max-width: 600px) {
    .seal {
        display: none;
    }

    .popup_button {
        position: fixed;
    }

    .prev {
        left: 0;
    }

    .next {
        right: 0;
    }

    #image-title {
        font-size: 12px;
    }

    #image-name {
        font-size: 12px;
    }

    #image-title > i {
        font-size: 12px;
    }

    #image-info {
        font-size: 12px;
    }
}

/* CONNEXION */

.login {
    justify-content: center;
    display: flex;
    max-width: 800px;
    overflow: hidden;
    padding: 20px;
    border: 1px solid var(--primary);
    outline: 2px solid var(--primary);
    outline-offset: 10px;
    margin: auto;
}

.login h1 {
    text-align: center;
}

.form-errors {
    margin: 1em 0;
    padding: 1em;
    background-color: #ffe6e6;
    border: 1px solid #ff9999;
    border-radius: 8px;
    color: #a94442;
    display: table;
}

.login .alert {
    color: red;
    margin-bottom: 10px;
}

.login-form {
    padding: 20px;
    margin-top: 20px;
}

.container .login-form form.second {
    opacity: 0;
    pointer-events: none;
    transform: translateX(100%);
}

.login-form form.secActive form.second {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

.login-form form.secActive form.first {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-100%);
}

.container .login-form .title {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin: 6px 0 8px 0;
    color: var(--primary);
}

.container .login-form .fields {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.login-form .fields input {
    display: flex;
    width: calc(100% / 3 - 15px);
    flex-direction: column;
    margin: 4px 0;
}

.login-form input, .login-form select {
    outline: none;
    font-size: 14px;
    font-weight: 400;
    color: #000;
    border-radius: 5px;
    border: 1px solid var(--primary);
    background-color: transparent;
    padding: 0 5px;
    height: 30px;
    margin: 3px 0;
    width: 100%;
}

.login-form input select,
.login-form input[type="date"] {
    color: #707070;
}

.login-form input[type="date"]:valid {
    color: #000;
}

.login-form button {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 35px;
    max-width: 300px;
    width: 100%;
    border: none;
    outline: none;
    color: #fff;
    border-radius: 5px;
    margin-right: auto;
    margin-left: auto;
    margin-top: 10px;
    background-color: var(--primary);
    transition: all 0.3s linear;
    cursor: pointer;
}

.container form .btnText {
    font-size: 14px;
    font-weight: 400;
}

.container form button:hover {
    background-color: var(--secondary);
}

form button i,
form .backBtn i {
    margin: 0 6px;
}

form .backBtn i {
    transform: rotate(180deg);
}

form .buttons {
    display: flex;
    align-items: center;
}

form .buttons button, .backBtn {
    margin-right: 14px;
}


@media (max-width: 400px) {
    form input, form select {
        max-width: 300px;
    }
}

/* MINI CARTE */

#mini-map-container {
    display: none;
    position: fixed;
    bottom: 10px;
    right: 10px;
    z-index: 1000;
    aspect-ratio: 767/947;
    height: 40vw;
    max-height: 212px;
    background-image: url("../../images/globe.png");
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
}

#mini-map {
    position: absolute;
    width: 30vw;
    max-height: 160px;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.6);
    top: 41%;
    left: 48%;
    transform: translate(-50%, -50%);
    z-index: 2;
}

#mini-map-container.expanded {
    height: 65vw;
    max-height: 515px;
}

#mini-map-container.expanded #mini-map {
    width: 50vw;
    max-height: 400px;
}

#toggle-map-size {
    position: absolute;
    bottom: 0;
    right: 0;
    background-image: url('../../images/asfalt-dark.png');
    background-color: var(--background);
    background-size: 100px 100px;
    border-radius: 50%;
    border: none;
    width: 35px;
    height: 35px;
    padding: 5px;
    cursor: pointer;
    z-index: 1001;
    transform: rotate(90deg);
}

/* PAGINATION */

.hidden-pagination {
    visibility: hidden;
}

nav[aria-label="Table navigation"] {
    text-align: center;
    margin: 30px 0;
}

.pagination {
    display: inline-flex;
    list-style: none;
    padding: 0;
    margin: 0;
    border-radius: 5px;
    height: 45px;
    max-width: calc(100vw - 40px);
}

.pagination li {
    display: inline-block;
    margin: 0;
}

.pagination li a, .pagination li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    padding: 10px 15px;
    border: 1px solid var(--primary);
    font-size: 16px;
    font-weight: bold;
    transition: all 0.2s ease-in-out;
    color: var(--primary);
    height: 100%;
    margin-left: -1px;
}

.pagination li a:hover {
    border-color: var(--secondary);
    background-color: var(--secondary);
    color: #fff;
}

.pagination li.active a {
    color: #fff;
    background-color: var(--primary);
    border-color: var(--primary);
}

.pagination li .inactive:hover {
    background-color: #fff;
}

.pagination li:first-child a {
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
}

.pagination li:last-child a {
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
}

@media (max-width: 768px) {
    .pagination li a, .pagination li span {
        font-size: 12px;
        padding: 0 8px;
    }
}

/* PROFIL */

.section {
    position: relative;
    margin: auto auto 40px auto;
    max-width: 600px;
    overflow: hidden;
    border: 1px solid var(--primary);
    outline: 2px solid var(--primary);
    outline-offset: 10px;
    padding: 30px;
}

.section h2 {
    color: #000;
    margin-bottom: 10px;
}

h4 {
    color: #000;
    margin-bottom: 10px;
}

.list {
    margin-left: 20px
}

.profile-section .list a {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 150px;
    width: 100%;
    border: none;
    outline: none;
    color: #fff;
    border-radius: 5px;
    margin-right: auto;
    background-color: var(--primary);
    transition: all 0.3s linear;
    cursor: pointer;
    text-decoration: none;
    margin-left: 20px;
    height: auto;
    min-height: 25px;
}

.profile-section .list li {
    display: flex;
    margin-bottom: 5px;
    min-height: 25px;
    align-items: center;
}

.profile-section .list a:hover {
    background-color: var(--secondary);
}

.profile-section {
    margin-top: 10px;
}

.logout-btn:hover {
    background-color: #000;
}

/* TABLE */

.table {
    vertical-align: top;
    border-color: #dee2e6;
    width: 100%;
    margin-bottom: 0;
}

.table > thead {
    vertical-align: bottom;
}

table {
    border-collapse: collapse;
}

.table > :not(:first-child) {
    border-top: none;
}

.table > tbody {
    vertical-align: inherit;
}

.table > :not(caption) > * > * {
    padding: .5rem .5rem;
    border-bottom-width: 1px;
}

.table-container {
    overflow-x: auto;
    border-radius: 7px;
    margin-bottom: 20px;
}

.table thead {
    background-color: var(--primary);
    color: #fff;
}

.table .even {
    background-color: transparent;
}

.table .odd {
    background-color: rgba(0, 0, 0, 0.1);
}

.table thead a {
    color: #fff;
    text-decoration: none;
}

.table thead a:hover {
    color: lightgray;
}

/* TABLE HEADER */

#per_page {
    margin: 30px 0 30px 0;
}

/* Style pour les options */
select option {
    padding: 10px;
    font-size: 12px;
    text-align: center;
    font-weight: normal;
    color: var(--primary);
}

#total-species {
    height: 50px;
    margin-top: -60px;
}

select {
    display: inline-block;
    padding: 10px 15px;
    text-align-last: center;
    font-size: 16px;
    font-weight: bold;
    border-radius: 5px;
    border: 1px solid var(--primary);
    background-color: transparent;
    transition: all 0.2s ease-in-out;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: none;
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 10px;
    cursor: pointer;
    height: 45px;
    text-align: center;
    margin: auto 20px;
}

/* Style au survol */
select:hover {
    border-color: var(--secondary);
    background-color: var(--secondary);
    color: #fff;
}

/* Style lors de la sélection (focus) */
select:focus {
    outline: none;
    border-color: transparent;
}

/* Style désactivé */
select:disabled {
    color: #adb5bd;
    background-color: #e9ecef;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    select {
        font-size: 12px;
        padding: 8px 12px;
    }

    #per_page {
        padding: 8px;
    }
}

@media (max-width: 578px) {
    #pagination-header {
        margin-bottom: 0;
    }
}

/* TÉLÉCHARGEMENT D'IMAGE */

#progress-bar-container {
    width: 200px;
    height: 30px;
    background-color: #f3f3f3;
    border: 1px solid #ccc;
    border-radius: 5px;
    margin-top: auto;
    margin-bottom: auto;
    display: none;
}

#upload-info-container {
    flex-direction: column;
}

#upload-info {
    margin: auto;
}

#progress-bar {
    height: 100%;
    width: 0;
    background-color: var(--primary);
    border-radius: 5px;
}

/* MEDIA QUERIES */
@media (max-width: 1200px) {
    .icon_tab {
        display: none;
    }

    .tab a {
        width: 150px;
    }
}

@media (max-width: 1100px) {
    .icon_tab:not(.hidden-theme) {
        display: block;
        max-height: 40px;
        max-width: 50px;
    }

    .left-header {
        height: 120px;
    }

    .tab {
        flex-direction: column;
    }

    .tab a {
        height: 40px;
        width: 200px;
        justify-content: space-between;
    }

    .actions {
        flex-direction: column;
    }

    .logout button, .upload-button, .action-button {
        height: 40px;
        width: 40px;
    }
}

@media (max-width: 700px) {
    header .logo {
        display: none;
    }
}

@media (max-width: 580px) {
    header .logo {
        display: block;
    }

    header .title {
        display: none;
    }
}

@media (max-width: 420px) {
    header .logo {
        display: none;
    }

    .left-header {
        width: 100%;
        justify-content: space-between;
    }

    .tab a {
        justify-content: start;
    }
}