.page-template-template_evenements,
.page-template-template_appel_a_projets,
.page-template-template_actualites {

    main {
        background: var(--dark-blue);

        .container {
            &.event {
                display: flex;
                flex-direction: row;

                @media (max-width: 991px) {
                    flex-direction: column;
                }

                .wp-pagenavi {
                    .page:hover {
                        background: var(--white) !important;
                        color: var(--dark-blue) !important;
                    }

                    .current {
                        background: var(--white) !important;
                        color: var(--dark-blue) !important;
                    }

                    a,
                    span {
                        border: 1px solid var(--white) !important;
                        color: var(--white) !important;

                        [class*=postslink]:hover {
                            background: var(--white) !important;
                            color: var(--dark-blue) !important;
                        }
                    }
                }

                .wrapper_filter {
                    @media (min-width: 992px) {
                        position: relative;
                        flex: 0.2;

                        &:after {
                            content: '';
                            position: absolute;
                            z-index: 0;
                            background: var(--white);
                            height: 100%;
                            width: 100vw;
                            top: 0;
                            right: 50vw;
                            transform: translateX(50%);
                            border: 2px solid var(--white);
                        }

                        .pin-spacer {
                            z-index: 2 !important;
                        }
                    }

                    .filters {
                        position: relative;
                        z-index: 0;
                        padding: 30px;
                        background: var(--white);

                        h2 {
                            font-size: 20px !important;
                            margin: 0 !important;
                            line-height: 1.3 !important;
                            border-bottom: 1px solid rgba(0, 0, 0, 0.2);
                            padding-bottom: 20px;
                        }

                        .filter {
                            &:not(#keyword) {
                                border-bottom: 1px solid rgba(0, 0, 0, 0.2);
                                padding: 15px 0 30px 0;
                            }

                            &#date {
                                display: flex;
                                flex-direction: column;
                                gap: 5px;

                                .calendar_start {
                                    display: flex;
                                    align-items: center;
                                    gap: 10px;
                                }

                                .calendar_end {
                                    display: block;
                                    align-items: center;
                                    gap: 10px;
                                }

                                .calendar_start,
                                .calendar_end {
                                    label {
                                        font-size: 0.8rem;
                                        color: #999;
                                        min-width: 20px;
                                    }

                                    input[type="date"] {
                                        width: 100%;
                                        padding: 7px 10px;
                                        font-size: 14px;
                                        font-family: inherit;
                                        color: var(--dark);
                                        background-color: #f5f5f5;
                                        border: 1px solid transparent;
                                        border-radius: 8px;
                                        outline: none;
                                        cursor: pointer;
                                        transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
                                        color-scheme: light;
                                        text-transform: uppercase;

                                        &::-webkit-calendar-picker-indicator {
                                            opacity: 0.35;
                                            cursor: pointer;
                                            filter: grayscale(1);
                                            transition: opacity 0.2s ease;
                                        }

                                        &:hover {
                                            background-color: #efefef;
                                            border-color: #ddd;

                                            &::-webkit-calendar-picker-indicator {
                                                opacity: 0.6;
                                            }
                                        }

                                        &:focus {
                                            background-color: #fff;
                                            border-color: #bbb;
                                            box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);

                                            &::-webkit-calendar-picker-indicator {
                                                opacity: 0.6;
                                            }
                                        }
                                    }
                                }
                            }

                            &#keyword {
                                padding: 15px 0 10px 0;

                                form {
                                    display: flex;

                                    input {
                                        border-bottom: 1px solid rgba(0, 0, 0, 0.2);
                                        font-size: 14px !important;
                                        margin-right: 20px;

                                        &:focus,
                                        &:focus-visible {
                                            border: 0px !important;
                                            outline: none !important;
                                            box-shadow: none !important;
                                        }
                                    }

                                    button {
                                        display: flex;
                                        align-items: center;
                                        justify-content: center;
                                        padding: 7px 12px;
                                        background-color: var(--dark-blue);
                                        border-radius: 4px;
                                        cursor: pointer;
                                        transition: background-color 0.2s ease;
                                        border: transparent !important;
                                        margin: 0 !important;

                                        img {
                                            width: 18px;
                                            height: 18px;
                                            display: block;
                                            filter: invert(1) brightness(100);
                                        }
                                    }
                                }
                            }

                            .choices {
                                display: flex;
                                flex-direction: column;
                                gap: 5px;

                                .choice {
                                    display: flex;
                                    flex-direction: row;
                                    align-items: start;
                                    gap: 5px;

                                    label {
                                        font-size: 14px !important;
                                    }
                                }
                            }

                            h3 {
                                font-size: 18px !important;
                                font-weight: var(--bold) !important;
                                margin: 10px 0;
                                line-height: 1.2 !important;
                            }
                        }

                        .btn_filter {
                            margin-top: 20px;
                            display: flex;
                            flex-direction: column;
                            gap: 10px;

                            input,
                            span {
                                width: 100%;
                                border: 0px !important;
                                text-align: center;
                                cursor: pointer;
                            }

                            span {
                                transition: var(--transition);

                                &:hover {
                                    background: #000000 !important;
                                }
                            }
                        }

                        .choice_thematiques,
                        .choice_localisation {
                            display: flex;
                            align-items: center;
                            gap: 10px;

                            &:hover {
                                cursor: pointer;
                            }

                            .input_thematique,
                            .input_localisation {
                                appearance: none;
                                -webkit-appearance: none;
                                width: 18px;
                                height: 18px;
                                min-width: 18px;
                                border: 1.5px solid #ccc;
                                border-radius: 4px;
                                background-color: #f5f5f5;
                                cursor: pointer;
                                position: relative;
                                transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;

                                &::after,
                                &::after {
                                    content: '';
                                    position: absolute;
                                    inset: 0;
                                    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 12 10' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 5l3.5 3.5L11 1' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
                                    background-repeat: no-repeat;
                                    background-position: center;
                                    background-size: 75%;
                                    opacity: 0;
                                    transform: scale(0.5);
                                    transition: opacity 0.15s ease, transform 0.15s ease;
                                }

                                &:hover,
                                &:hover {
                                    border-color: #aaa;
                                    background-color: #efefef;
                                }

                                &:checked,
                                &:checked {
                                    background-color: #cd0823;
                                    border-color: #cd0823;
                                    box-shadow: 0 0 0 3px rgba(205, 8, 35, 0.12);

                                    &::after,
                                    &::after {
                                        opacity: 1;
                                        transform: scale(1);
                                    }
                                }

                                &:active,
                                &:active {
                                    transform: scale(0.88);
                                }

                            }

                            label,
                            label {
                                font-size: 14px;
                                color: var(--dark);
                                cursor: pointer;
                                user-select: none;
                                transition: color 0.15s ease;
                                line-height: 1.4;
                                margin-top: 2px;

                                &:checked+label,
                                &:checked+label {
                                    color: var(--red);
                                }
                            }
                        }
                    }
                }

                .cpt {
                    flex: 0.8;

                    .title_events {
                        padding: 20px 20px 0px 0px;
                        border-bottom: 2px solid rgba(255, 255, 255, 0.3);
                        margin: 0 0 20px 30px;

                        @media (max-width: 992px) {
                            margin: 0 0 20px 0px;
                            padding: 20px 0px 0px 0px;
                        }

                        form {
                            display: flex;
                            flex-direction: row;
                            gap: 30px;
                            margin: 0 0 20px 0px;

                            .events {
                                color: var(--white);
                                opacity: 1;
                                cursor: pointer;
                                transition: var(--transition);

                                input {
                                    display: none;

                                    &.active {
                                        &+label {
                                            opacity: 1 !important;

                                            &:after {
                                                content: '';
                                                height: 2px;
                                                background: rgba(255, 255, 255, 1);
                                                width: 100%;
                                                position: absolute;
                                                bottom: -22px;
                                                left: 0;
                                            }
                                        }
                                    }

                                    &:not(.active) {
                                        &+label {
                                            opacity: 0.3;
                                        }
                                    }
                                }

                                label {
                                    position: relative;
                                    transition: var(--transition);
                                    cursor: pointer;
                                    font-weight: var(--bold);
                                    width: fit-content;
                                    display: flex;
                                }

                                &:hover {
                                    label {
                                        opacity: 1 !important;
                                    }
                                }
                            }
                        }
                    }

                    .initial_events,
                    #event_post_results {
                        margin-left: 15px;

                        #nothing {
                            color: var(--white) !important;
                        }

                        @media (max-width: 991px) {
                            margin-left: 0px;
                        }

                        &>.container {
                            
                            @media (min-width: 992px) {
                                padding-right: 0 !important;
                            }

                            .grid_layout {
                                gap: 15px !important;

                                @media (min-width: 768px) and (max-width: 1199px) {
                                    grid-template-columns: repeat(2, 1fr) !important;
                                }

                                @media (max-width: 767px) {
                                    grid-template-columns: 1fr !important;
                                }

                                .teaser__item {
                                    .teaser__text {
                                        &>p:not(.teaser__date) {
                                            display: none !important;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

/* ── Filtre repliable (Thématiques, etc.) ─────────────────────────────── */
/* ── Pastille de couleur dans les labels (filtre Zone géographique AAP) ── */
.choice_localisation label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.zone-color-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.filter--collapsible {
    .filter__toggle {
        background: transparent;
        border: 0;
        padding: 0;
        margin: 0;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        cursor: pointer;
        text-align: left;
        color: inherit;
        font: inherit;

        h3 {
            margin: 0;
            line-height: 1.2;
        }
    }

    .filter__toggle-icon {
        position: relative;
        width: 14px;
        height: 14px;
        flex-shrink: 0;

        &::before,
        &::after {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            background: currentColor;
            transition: transform 0.25s ease;
        }

        &::before {
            width: 14px;
            height: 2px;
            transform: translate(-50%, -50%);
        }

        &::after {
            width: 2px;
            height: 14px;
            transform: translate(-50%, -50%);
        }
    }

    .filter__panel {
        overflow: hidden;
        max-height: 1500px;
        transition: max-height 0.35s ease, margin-top 0.25s ease, opacity 0.2s ease;
        margin-top: 12px;
        opacity: 1;
    }

    &.is-collapsed {
        .filter__panel {
            max-height: 0;
            margin-top: 0;
            opacity: 0;
            pointer-events: none;
        }

        .filter__toggle-icon::after {
            transform: translate(-50%, -50%) rotate(0deg);
        }
    }

    &:not(.is-collapsed) {
        .filter__toggle-icon::after {
            transform: translate(-50%, -50%) rotate(90deg);
        }
    }
}
