body.modal-open {
    overflow: hidden;
}

body {
    margin-bottom: 0;
}

.main-menu {
    background: #ded2b3;
    padding: 5px 10px;
    display: flex;
    justify-content: space-around;
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 1500;
    font-size: 12px;
    line-height: 1.2;
    transition: transform 0.8s ease, opacity 0.8s ease;
}

.main-menu.hidden {
    transform: translateY(100%);
    opacity: 0;
}

.menu-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: opacity 0.3s;
    gap: 5px;
}

.menu-button:hover {
    opacity: 0.8;
}

.menu-button img {
    width: 40px;
    height: 40px;
}

.menu-button span {
    color: #222222;
    font-size: 12px;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #fff;
    z-index: 400;
}

.modal-content {
    background: #fff;
    padding: 20px;
    width: 100%;
    height: 100vh;
    overflow-y: auto;
    transform: none;
    opacity: 1;
}

.modal.active {
    display: block;
}

#notes-modal {
    z-index: 1000;
}

#saved-modal {
    z-index: 1000;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
}

#fonctionnement-modal h2 {
    font-size: 24px;
    margin-bottom: 20px;
    color: #222222;
}

#fonctionnement-modal ul {
    list-style: none;
    padding: 0;
}

#fonctionnement-modal li {
    font-size: 16px;
    margin-bottom: 10px;
}

#notes-modal .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

#notes-modal h2 {
    font-size: 24px;
    margin: 0;
    color: #222222;
}

#notes-modal .open-saved-btn {
    background: #5e832a;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

#notes-modal .open-saved-btn:hover {
    background: #4a6822;
}

#notes-modal textarea {
    width: 100%;
    height: 300px;
    font-size: 16px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    resize: vertical;
}

#saved-modal .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

#saved-modal .back-btn {
    background: #5e832a;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    min-width: 44px;
    /* Ensure a decent rectangle shape */
}

#saved-modal .back-btn:hover {
    background: #4a6822;
}

#saved-modal h2 {
    font-size: 24px;
    margin: 0;
    color: #222222;
    text-align: right;
}

#saved-modal .search-bar {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
    width: 100%;
    justify-content: flex-end;
    /* Aligné à droite */
}

#saved-modal .dropdown {
    position: relative;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 5px;
    height: 38px;
    width: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

#saved-modal .dropdown img {
    width: 32px;
    height: 32px;
}

#saved-modal .dropdown ul {
    position: absolute;
    top: 100%;
    padding-left: 0;
    margin: 0;
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    width: auto;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 5px;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    z-index: 10;
}

#saved-modal .dropdown:hover ul {
    display: block;
}

#saved-modal .dropdown li {
    padding: 5px;
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
}

#saved-modal .dropdown li img {
    width: 32px;
    height: 32px;
}

#saved-modal .dropdown li:hover {
    background: #f5f5f5;
}

#saved-modal .dropdown .dropdown-icon {
    position: absolute;
    right: 5px;
    font-size: 12px;
}

#saved-modal .date-inputs {
    display: flex;
    gap: 5px;
    flex: 1;
    position: relative;
}

#saved-modal .date-inputs input[type="text"] {
    padding: 5px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 5px;
    width: 100px;
    height: 28px;
    flex: 1;
}

#saved-modal .date-inputs input[type="date"] {
    display: none;
}

#saved-modal .date-inputs input[type="date"]::-webkit-calendar-picker-indicator {
    position: absolute;
    right: 0 !important;
    width: 20px;
    height: 100%;
    margin: 0;
    padding: 0;
    cursor: pointer;
}

#saved-modal .sort-btn {
    background: #5e832a;
    color: white;
    border: none;
    padding: 5px 5px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    height: 38px;
    width: 5%;
    /* Réduction de 50% par rapport à flex: 1 */
    position: relative;
}

#saved-modal .sort-btn:hover {
    background: #4a6822;
}

#saved-modal .sort-btn::after {
    content: 'Ordre chronologique ou antéchronologique';
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 12px;
    white-space: nowrap;
    display: none;
}

#saved-modal .sort-btn:hover::after {
    display: block;
}

#saved-modal .csv-buttons {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
}

#saved-modal button {
    background: #5e832a;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
}

#saved-modal button:hover {
    background: #4a6822;
}

.notes-table {
    margin-top: 20px;
    position: relative;
    padding-bottom: 60px;
}

.notes-table .no-results {
    display: none;
    color: #888;
    text-align: center;
    margin-top: 20px;
}

.note-entry {
    background: #f5f5f5;
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 10px;
}

.note-entry img {
    width: 24px;
    height: 24px;
    vertical-align: middle;
}

.note-entry p {
    margin: 5px 0;
    font-size: 20px;
    /* Augmenté à 16px */
}

#credits-modal {
    background: #ded2b3;
}

#credits-modal .modal-content {
    background: #ded2b3;
    width: 100%;
    height: 100vh;
    border: none;
    padding: 20px;
    overflow-y: auto;
    transform: none;
}


@media (max-width: 600px) {

    #saved .modal-content,
    #credits-modal .modal-content {
        padding: 15px;
        max-height: 85vh;
    }
}

@media (max-width: 768px) {
    .modal-content {
        padding: 15px;
    }

    #notes-modal textarea {
        height: 200px;
    }

    #credits-modal .modal-content {
        padding: 15px;
    }

    #saved-modal .search-bar {
        flex-wrap: wrap;
    }

    #saved-modal .date-inputs input[type="text"] {
        width: 80px;
    }

    .note-entry[onclick] {
        cursor: pointer;
    }

    .note-text {
        margin: 5px 0;
        font-size: 16px;
        white-space: pre-wrap;
    }
}