/* Suppression du padding supérieur par défaut du thème The7 sur le calendrier */
.post-type-archive-evenement_kwf #main,
.tax-type_evenement_kwf #main,
.page-template-archive-evenement_kwf #main {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}
.post-type-archive-evenement_kwf #main > .wf-wrap,
.tax-type_evenement_kwf #main > .wf-wrap,
.page-template-archive-evenement_kwf #main > .wf-wrap {
    max-width: 100% !important;
    padding: 0 !important;
    width: 100% !important;
}

:root {
    --kwf-blue: #3498db;
    --kwf-blue-dark: #217dbb;
    --kwf-orange: #ff6b35;
    --kwf-dark: #1e293b;
    --kwf-slate: #64748b;
    --kwf-bg: #f8fafc;
    --kwf-border: #e2e8f0;
}

.kwf-cal-wrapper {
    background: var(--kwf-bg);
    padding: 24px 20px 70px;
    color: var(--kwf-dark);
}
.kwf-cal-container {
    max-width: 1140px;
    margin: 0 auto;
}

/* Barre de filtres */
.kwf-cal-toolbar {
    background: #ffffff;
    border: 1px solid var(--kwf-border);
    border-radius: 16px;
    padding: 18px 22px;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04);
    margin-bottom: 32px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.kwf-cal-top-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.kwf-cat-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.kwf-pill-btn {
    border: 1px solid var(--kwf-border);
    background: #f8fafc;
    color: var(--kwf-dark);
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.kwf-pill-btn:hover {
    border-color: var(--kwf-blue);
    background: #eff6ff;
}
.kwf-pill-btn.active {
    background: var(--kwf-dark);
    color: #ffffff;
    border-color: var(--kwf-dark);
}
.kwf-pill-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--kwf-blue);
}
.kwf-pill-btn[data-cat="competitions"] .kwf-pill-dot { background: #ef4444; }
.kwf-pill-btn[data-cat="formations"] .kwf-pill-dot { background: #10b981; }
.kwf-pill-btn[data-cat="examens"] .kwf-pill-dot { background: #f59e0b; }

.kwf-view-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.kwf-segmented {
    display: inline-flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--kwf-border);
}
.kwf-seg-btn {
    border: none;
    background: transparent;
    padding: 6px 12px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    color: var(--kwf-slate);
    cursor: pointer;
    transition: all 0.2s;
}
.kwf-seg-btn.active {
    background: #ffffff;
    color: var(--kwf-dark);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.kwf-cal-search-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
}

/* Champ de recherche bien visible (neutralise les styles par défaut du thème The7) */
.kwf-cal-search-box {
    flex: 1;
    min-width: 260px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 0 14px;
    height: 44px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.kwf-cal-search-box:focus-within {
    border-color: var(--kwf-blue);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.14);
}
.kwf-cal-search-svg {
    color: #64748b;
    flex-shrink: 0;
}
.kwf-cal-wrapper input.kwf-search-input {
    flex: 1;
    width: 100%;
    height: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: 14px !important;
    color: #1e293b !important;
}
.kwf-cal-wrapper input.kwf-search-input::placeholder {
    color: #64748b !important;
    opacity: 1 !important;
}
.kwf-cal-search-clear {
    display: none;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    border: none;
    background: #cbd5e1;
    color: #1e293b;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}
.kwf-cal-search-clear:hover {
    background: #94a3b8;
    color: #ffffff;
}

.kwf-season-select {
    padding: 0 14px;
    height: 44px;
    border: 1.5px solid #cbd5e1;
    border-radius: 11px;
    font-size: 13.5px;
    font-weight: 600;
    background: #f1f5f9;
    color: var(--kwf-dark);
}

/* Séparateur de mois */
.kwf-month-group {
    margin-bottom: 34px;
}
.kwf-month-heading {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--kwf-slate);
    margin: 0 0 14px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}
.kwf-month-heading::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--kwf-border);
}

/* Carte événement horizontale */
.kwf-event-row {
    background: #ffffff;
    border: 1px solid var(--kwf-border);
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 18px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.kwf-event-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
}
.kwf-event-row.is-past {
    opacity: 0.84;
}

.kwf-date-box {
    min-width: 74px;
    height: 74px;
    border-radius: 12px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: var(--kwf-blue-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 6px;
    flex-shrink: 0;
}
.kwf-event-row.is-past .kwf-date-box {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: var(--kwf-slate);
}
.kwf-date-day {
    font-size: 19px;
    font-weight: 800;
    line-height: 1.1;
}
.kwf-date-month {
    font-size: 11px;
    font-weight: 700;
    margin-top: 3px;
    letter-spacing: 0.05em;
}

.kwf-event-thumb {
    width: 64px;
    height: 82px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid var(--kwf-border);
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
}
.kwf-event-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.kwf-event-thumb-placeholder {
    font-size: 10px;
    font-weight: 800;
    color: #94a3b8;
    text-align: center;
    padding: 4px;
}

.kwf-event-body {
    flex: 1;
    min-width: 0;
}
.kwf-event-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}
.kwf-cat-tag {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 6px;
    background: #eff6ff;
    color: var(--kwf-blue-dark);
}
.kwf-event-row[data-cat="competitions"] .kwf-cat-tag { background: #fef2f2; color: #dc2626; }
.kwf-event-row[data-cat="formations"] .kwf-cat-tag { background: #ecfdf5; color: #059669; }
.kwf-event-row[data-cat="examens"] .kwf-cat-tag { background: #fff7ed; color: #ea580c; }

.kwf-status-pill {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    background: #f1f5f9;
    color: #475569;
}
.kwf-status-pill.complet { background: #fee2e2; color: #b91c1c; }
.kwf-status-pill.ouvertes { background: #dcfce7; color: #15803d; }

.kwf-event-title {
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 6px 0;
    line-height: 1.35;
}
.kwf-event-title a {
    color: var(--kwf-dark);
    text-decoration: none;
}
.kwf-event-title a:hover {
    color: var(--kwf-blue);
}
.kwf-event-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 13.5px;
    color: var(--kwf-slate);
}
.kwf-event-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.kwf-event-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}
.kwf-btn-primary {
    display: inline-block;
    text-align: center;
    background: var(--kwf-blue);
    color: #ffffff !important;
    font-size: 13.5px;
    font-weight: 700;
    padding: 9px 16px;
    border-radius: 9px;
    text-decoration: none;
    transition: background 0.2s;
}
.kwf-btn-primary:hover {
    background: var(--kwf-blue-dark);
}
.kwf-btn-ics {
    display: inline-block;
    text-align: center;
    background: #f8fafc;
    color: var(--kwf-slate) !important;
    border: 1px solid var(--kwf-border);
    font-size: 12px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 8px;
    text-decoration: none;
}
.kwf-btn-ics:hover {
    background: #f1f5f9;
    color: var(--kwf-dark) !important;
}

/* Vue Grille Calendrier Mensuelle */
.kwf-grid-view {
    display: none;
    background: #ffffff;
    border: 1px solid var(--kwf-border);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04);
}
.kwf-grid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.kwf-grid-month-title {
    font-size: 18px;
    font-weight: 800;
    text-transform: capitalize;
    margin: 0;
}
.kwf-grid-nav {
    display: flex;
    gap: 8px;
}
.kwf-grid-nav button {
    border: 1px solid var(--kwf-border);
    background: #f8fafc;
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
}
.kwf-grid-table {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}
.kwf-grid-day-name {
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--kwf-slate);
    padding: 8px 0;
}
.kwf-grid-cell {
    min-height: 98px;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    padding: 6px;
    background: #ffffff;
}
.kwf-grid-cell.other-month { background: #f8fafc; opacity: 0.5; }
.kwf-grid-cell.today { border-color: var(--kwf-blue); background: #eff6ff33; }
.kwf-grid-num {
    font-size: 12px;
    font-weight: 700;
    color: var(--kwf-slate);
    margin-bottom: 4px;
}
.kwf-grid-chip {
    display: block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 6px;
    border-radius: 5px;
    background: #eff6ff;
    color: var(--kwf-blue-dark);
    text-decoration: none;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kwf-grid-chip.competitions { background: #fef2f2; color: #dc2626; }
.kwf-grid-chip.formations { background: #ecfdf5; color: #059669; }
.kwf-grid-chip.examens { background: #fff7ed; color: #ea580c; }

.kwf-empty-state {
    text-align: center;
    padding: 48px 20px;
    background: #ffffff;
    border: 1px dashed var(--kwf-border);
    border-radius: 16px;
    color: var(--kwf-slate);
    display: none;
}

@media (max-width: 768px) {
    .kwf-event-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .kwf-event-actions {
        width: 100%;
        flex-direction: row;
    }
    .kwf-btn-primary {
        flex: 1;
    }
    .kwf-grid-cell {
        min-height: 64px;
    }
}
