/**
 * Brocnote Filtres - CSS v2.4
 * Couleur : #0E91FD (Nouvelle couleur + optimisations responsive)
 */
:root {
    --bn-primary: #0E91FD;
    --bn-primary-dark: #0B7AE5;
    --bn-primary-light: #E5F4FF;
    --bn-primary-bg: #F0F8FF;
    --bn-gray-50: #FAFAFA;
    --bn-gray-100: #F4F4F5;
    --bn-gray-200: #E4E4E7;
    --bn-gray-300: #D4D4D8;
    --bn-gray-400: #A1A1AA;
    --bn-gray-500: #71717A;
    --bn-gray-600: #52525B;
    --bn-gray-700: #3F3F46;
    --bn-gray-800: #27272A;
    --bn-white: #FFFFFF;
    --bn-shadow: 0 10px 40px -10px rgba(0,0,0,0.15);
    --bn-shadow-lg: 0 20px 60px -15px rgba(0,0,0,0.2);
    --bn-radius: 8px;
    --bn-radius-lg: 16px;
}

.brocnote-filtre {
    position: relative;
    display: block;
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    box-sizing: border-box;
}

.brocnote-filtre *,
.brocnote-filtre *::before,
.brocnote-filtre *::after {
    box-sizing: border-box;
}

/* =====================
   TOGGLE BUTTON - NOUVEAU STYLE BLEU
   ===================== */
.brocnote-filtre-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 18px 24px;
    background: var(--bn-primary);
    border: 2px solid var(--bn-primary);
    border-radius: var(--bn-radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    color: var(--bn-white);
    box-shadow: 0 4px 12px rgba(14, 145, 253, 0.3);
}

.brocnote-filtre-toggle:hover {
    background: var(--bn-primary-dark);
    border-color: var(--bn-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(14, 145, 253, 0.4);
}

.brocnote-filtre.is-open .brocnote-filtre-toggle {
    background: var(--bn-primary-dark);
    border-color: var(--bn-primary-dark);
    box-shadow: 0 6px 20px rgba(14, 145, 253, 0.4);
}

.brocnote-filtre-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    color: var(--bn-white);
}

.brocnote-filtre-label {
    flex: 1;
    font-weight: 600;
    font-size: 16px;
    color: var(--bn-white);
}

.brocnote-filtre-arrow {
    display: flex;
    align-items: center;
    transition: transform 0.2s ease;
    opacity: 0.9;
    color: var(--bn-white);
}

.brocnote-filtre.is-open .brocnote-filtre-arrow {
    transform: rotate(180deg);
    opacity: 1;
}

/* =====================
   DROPDOWN LIEU
   ===================== */
.brocnote-filtre-lieu .brocnote-filtre-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    z-index: 9999;
    background: var(--bn-white);
    border: 1px solid var(--bn-gray-200);
    border-radius: var(--bn-radius-lg);
    box-shadow: var(--bn-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    width: 100%;
    min-width: 350px;
}

.brocnote-filtre-lieu.is-open .brocnote-filtre-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.brocnote-dropdown-content {
    padding: 24px;
}

.brocnote-dropdown-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--bn-gray-800);
    margin: 0 0 20px 0;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--bn-gray-100);
}

/* =====================
   SEARCH INPUT
   ===================== */
.brocnote-search-wrapper {
    position: relative;
    margin-bottom: 16px;
}

.brocnote-search-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--bn-gray-400);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brocnote-search-input {
    width: 100%;
    height: 50px;
    padding: 0 40px 0 16px;
    border: 2px solid var(--bn-gray-200);
    border-radius: var(--bn-radius);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: all 0.15s ease;
    background: var(--bn-gray-50);
}

.brocnote-search-input:focus {
    border-color: var(--bn-primary);
    background: var(--bn-white);
    box-shadow: 0 0 0 4px var(--bn-primary-light);
}

.brocnote-search-input::placeholder {
    color: var(--bn-gray-400);
    font-size: 14px;
}

/* =====================
   SEARCH RESULTS
   ===================== */
.brocnote-search-results {
    max-height: 280px;
    overflow-y: auto;
}

.brocnote-search-results:empty {
    display: none;
}

.brocnote-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    margin: 4px 0;
    cursor: pointer;
    border-radius: var(--bn-radius);
    border-left: 4px solid transparent;
    transition: all 0.12s ease;
}

.brocnote-result-item:hover,
.brocnote-result-item:focus {
    background: var(--bn-primary-bg);
    border-left-color: var(--bn-primary);
    outline: none;
}

.brocnote-result-item.is-selected {
    background: var(--bn-primary);
    border-left-color: var(--bn-primary-dark);
    color: var(--bn-white);
}

.brocnote-result-type {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 8px;
    border-radius: 4px;
    background: var(--bn-primary-light);
    color: var(--bn-primary);
    font-weight: 700;
    flex-shrink: 0;
}

.brocnote-result-item.is-selected .brocnote-result-type {
    background: rgba(255,255,255,0.25);
    color: var(--bn-white);
}

.brocnote-result-name {
    flex: 1;
    font-weight: 500;
    font-size: 14px;
}

.brocnote-result-count {
    font-size: 12px;
    color: var(--bn-gray-400);
    font-weight: 500;
}

.brocnote-result-item.is-selected .brocnote-result-count {
    color: rgba(255,255,255,0.7);
}

.brocnote-no-results,
.brocnote-search-loading {
    padding: 32px;
    text-align: center;
    color: var(--bn-gray-500);
    font-size: 14px;
}

/* =====================
   CALENDAR DROPDOWN
   ===================== */
.brocnote-dropdown-calendar {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    right: 0;
    z-index: 9999;
    background: var(--bn-white);
    border: 1px solid var(--bn-gray-200);
    border-radius: var(--bn-radius-lg);
    box-shadow: var(--bn-shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    overflow: visible;
}

.brocnote-filtre-date.is-open .brocnote-filtre-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.brocnote-dropdown-calendar .brocnote-dropdown-content {
    padding: 24px;
}

.brocnote-dropdown-calendar .brocnote-dropdown-title {
    text-align: center;
    font-size: 18px;
    margin-bottom: 20px;
}

.brocnote-calendar-wrapper {
    display: flex;
    gap: 0;
    overflow-x: visible;
}

/* =====================
   SHORTCUTS
   ===================== */
.brocnote-date-shortcuts {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 160px;
    padding-right: 20px;
    margin-right: 20px;
    border-right: 2px solid var(--bn-gray-100);
    flex-shrink: 0;
}

.brocnote-shortcut {
    display: block;
    padding: 10px 12px;
    color: var(--bn-gray-600);
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.12s ease;
    white-space: nowrap;
}

.brocnote-shortcut:hover,
.brocnote-shortcut:focus {
    background: var(--bn-primary-bg);
    color: var(--bn-primary);
    outline: none;
}

.brocnote-shortcut-month {
    color: var(--bn-primary);
    font-weight: 600;
    background: var(--bn-primary-light);
}

.brocnote-shortcut-month:hover {
    background: var(--bn-primary);
    color: var(--bn-white);
}

/* =====================
   CALENDARS
   ===================== */
.brocnote-calendars {
    flex: 1;
    position: relative;
    padding-top: 50px;
}

.brocnote-calendar-nav {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    z-index: 2;
}

/* BOUTONS FLECHES - NOUVEAU STYLE */
.brocnote-cal-prev,
.brocnote-cal-next {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bn-primary);
    border: 2px solid var(--bn-primary);
    border-radius: 8px;
    cursor: pointer;
    color: var(--bn-white);
    font-size: 20px;
    font-weight: bold;
    transition: all 0.12s ease;
    box-shadow: 0 2px 8px rgba(14, 145, 253, 0.3);
}

.brocnote-cal-prev:hover,
.brocnote-cal-next:hover {
    background: var(--bn-primary-dark);
    border-color: var(--bn-primary-dark);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(14, 145, 253, 0.4);
}

.brocnote-cal-prev:disabled,
.brocnote-cal-next:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--bn-gray-200);
    border-color: var(--bn-gray-200);
    color: var(--bn-gray-400);
    box-shadow: none;
}

.brocnote-cal-prev:disabled:hover,
.brocnote-cal-next:disabled:hover {
    transform: none;
}

.brocnote-calendars-grid {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

/* =====================
   MONTH
   ===================== */
.brocnote-calendar-month {
    min-width: 240px;
    flex: 1;
}

.brocnote-month-header {
    text-align: center;
    font-weight: 700;
    color: var(--bn-gray-800);
    padding: 4px 0 12px 0;
    font-size: 15px;
}

.brocnote-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 8px;
    border-bottom: 1px solid var(--bn-gray-100);
    padding-bottom: 8px;
}

.brocnote-weekdays span {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--bn-gray-400);
    text-transform: uppercase;
}

.brocnote-weekdays .brocnote-weekend {
    color: var(--bn-primary);
    opacity: 0.7;
}

/* =====================
   DAYS
   ===================== */
.brocnote-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

.brocnote-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    color: var(--bn-gray-700);
    position: relative;
    min-height: 36px;
    transition: all 0.12s ease;
}

.brocnote-day:hover:not(.brocnote-day-empty):not(.brocnote-day-past) {
    background: var(--bn-primary);
    color: var(--bn-white);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(14, 145, 253, 0.3);
}

.brocnote-day-empty {
    cursor: default;
}

.brocnote-day-past {
    color: var(--bn-gray-300);
    cursor: not-allowed;
}

.brocnote-day-past:hover {
    background: transparent !important;
    color: var(--bn-gray-300) !important;
    transform: none !important;
    box-shadow: none !important;
}

.brocnote-day-today {
    font-weight: 700;
    color: var(--bn-primary);
    background: var(--bn-primary-light);
    box-shadow: 0 0 0 2px var(--bn-primary-light);
}

.brocnote-day-today::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background: var(--bn-primary);
    border-radius: 50%;
}

.brocnote-day-weekend {
    color: var(--bn-gray-500);
}

/* =====================
   LOADING
   ===================== */
@keyframes bn-spin {
    to { transform: rotate(360deg); }
}

.brocnote-loading-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--bn-gray-200);
    border-top-color: var(--bn-primary);
    border-radius: 50%;
    animation: bn-spin 0.7s linear infinite;
    margin: 0 auto;
}

/* =====================
   RESPONSIVE TABLET (≤1024px)
   ===================== */
@media (max-width: 1024px) {
    .brocnote-calendars-grid {
        gap: 20px;
    }

    .brocnote-calendar-month {
        min-width: 200px;
    }

    .brocnote-day {
        font-size: 13px;
        min-height: 32px;
    }
}

/* =====================
   RESPONSIVE TABLET SMALL (≤800px)
   ===================== */
@media (max-width: 800px) {
    .brocnote-dropdown-calendar {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 85vh;
        overflow-y: auto;
        border-radius: var(--bn-radius-lg) var(--bn-radius-lg) 0 0;
        transform: translateY(100%);
    }

    .brocnote-filtre-date.is-open .brocnote-filtre-dropdown {
        transform: translateY(0);
    }

    .brocnote-dropdown-calendar .brocnote-dropdown-content {
        padding: 20px;
    }

    .brocnote-calendar-wrapper {
        flex-direction: column;
        gap: 24px;
        overflow-x: visible;
    }

    .brocnote-date-shortcuts {
        flex-direction: row;
        flex-wrap: wrap;
        border-right: none;
        border-bottom: 2px solid var(--bn-gray-100);
        padding: 0 0 16px 0;
        margin: 0 0 20px 0;
        min-width: auto;
        gap: 8px;
    }

    .brocnote-shortcut {
        padding: 10px 14px;
        font-size: 13px;
        border: 2px solid var(--bn-gray-200);
        border-radius: var(--bn-radius);
        flex: 0 0 auto;
    }

    .brocnote-shortcut:hover {
        border-color: var(--bn-primary);
        background: var(--bn-primary-bg);
    }

    .brocnote-shortcut-month {
        background: var(--bn-primary);
        color: var(--bn-white);
        border-color: var(--bn-primary);
    }

    .brocnote-calendars {
        padding-top: 0;
    }

    .brocnote-calendar-nav {
        position: relative;
        margin-bottom: 20px;
    }

    .brocnote-calendars-grid {
        flex-direction: column;
        gap: 24px;
        flex-wrap: nowrap;
    }

    .brocnote-calendar-month {
        min-width: auto;
        width: 100%;
    }
}

/* =====================
   RESPONSIVE MOBILE (≤600px)
   ===================== */
@media (max-width: 600px) {
    .brocnote-filtre-toggle {
        padding: 16px 20px;
    }

    .brocnote-filtre-label {
        font-size: 15px;
    }

    .brocnote-filtre-lieu .brocnote-filtre-dropdown {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        min-width: auto !important;
        border-radius: var(--bn-radius-lg) var(--bn-radius-lg) 0 0;
        max-height: 85vh;
        overflow-y: auto;
        transform: translateY(100%);
    }

    .brocnote-filtre-lieu.is-open .brocnote-filtre-dropdown {
        transform: translateY(0);
    }

    .brocnote-dropdown-content {
        padding: 20px;
    }

    .brocnote-dropdown-title {
        font-size: 16px;
        margin-bottom: 16px;
    }

    .brocnote-search-input {
        height: 48px;
        font-size: 16px; /* Évite le zoom sur iOS */
    }

    .brocnote-date-shortcuts {
        gap: 6px;
    }

    .brocnote-shortcut {
        padding: 8px 12px;
        font-size: 12px;
        flex: 1 1 calc(50% - 3px);
        min-width: calc(50% - 3px);
        text-align: center;
    }

    .brocnote-calendar-month {
        min-width: 280px;
    }

    .brocnote-day {
        font-size: 13px;
        min-height: 36px;
    }

    .brocnote-weekdays span {
        font-size: 10px;
    }
}

/* =====================
   RESPONSIVE MOBILE SMALL (≤400px)
   ===================== */
@media (max-width: 400px) {
    .brocnote-filtre-toggle {
        padding: 14px 18px;
        gap: 10px;
    }

    .brocnote-filtre-label {
        font-size: 14px;
    }

    .brocnote-dropdown-content {
        padding: 16px;
    }

    .brocnote-shortcut {
        font-size: 11px;
        padding: 8px 10px;
    }

    .brocnote-calendar-month {
        min-width: 100%;
    }

    .brocnote-day {
        font-size: 12px;
        min-height: 32px;
    }

    .brocnote-cal-prev,
    .brocnote-cal-next {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
}

/* =====================
   OVERLAY MOBILE
   ===================== */
.brocnote-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
    backdrop-filter: blur(2px);
}

@media (max-width: 800px) {
    .brocnote-filtre.is-open .brocnote-overlay {
        display: block;
    }
}

/* =====================
   ACCESSIBILITÉ
   ===================== */
.brocnote-filtre-toggle:focus-visible,
.brocnote-shortcut:focus-visible,
.brocnote-day:focus-visible,
.brocnote-cal-prev:focus-visible,
.brocnote-cal-next:focus-visible {
    outline: 3px solid var(--bn-primary);
    outline-offset: 2px;
}

.brocnote-search-input:focus-visible {
    outline: none;
}

/* =====================
   SCROLLBAR CUSTOM
   ===================== */
.brocnote-search-results::-webkit-scrollbar,
.brocnote-dropdown-calendar::-webkit-scrollbar {
    width: 8px;
}

.brocnote-search-results::-webkit-scrollbar-track,
.brocnote-dropdown-calendar::-webkit-scrollbar-track {
    background: var(--bn-gray-100);
    border-radius: 4px;
}

.brocnote-search-results::-webkit-scrollbar-thumb,
.brocnote-dropdown-calendar::-webkit-scrollbar-thumb {
    background: var(--bn-primary);
    border-radius: 4px;
}

.brocnote-search-results::-webkit-scrollbar-thumb:hover,
.brocnote-dropdown-calendar::-webkit-scrollbar-thumb:hover {
    background: var(--bn-primary-dark);
}
