.projets-header {
    text-align: center;
    margin-bottom: 50px;
}

.projets-header h1 {
    color: #0078C6;
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.projets-header p {
    color: #666;
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Compteur de projets */
.projets-count {
    background: #e3f2fd;
    color: #0078C6;
    padding: 9px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
}

/* Contrôles */
.projets-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.search-container {
    position: relative;
    width: 320px;
}

.search-input {
    width: 100%;
    padding: 12px 50px 12px 20px;
    border: none;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    box-shadow:
            0 2px 10px rgba(0, 0, 0, 0.08),
            inset 0 1px 2px rgba(255, 255, 255, 0.8);
    color: #2d3748;
    backdrop-filter: blur(10px);
    -webkit-tap-highlight-color: transparent;
}

.search-input:focus,
.search-input:focus-visible {
    outline: none;
    border: 2px solid #0078C6;
    box-shadow: 0 0 0 3px rgba(0, 120, 198, 0.1);
}

.controls-left {
    display: flex;
    flex: 1;
}

.controls-right {
    display: flex;
    align-items: center;
}


/* Barre de recherche */
.search-container {
    position: relative;
    flex: 1;
    max-width: 400px;
    margin: 0 20px;
}

.clear-search-btn {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: #a0aec0;
    padding: 0;
    display: none;
}

.clear-search-btn:hover {
    color: #718096;
}



/* Styles des pillules de filtre */
.year-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.year-filters::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.year-filter {
    background: #d2d8dd;
    border: 0;
    padding: 12px 24px;
    border-radius: 40px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 600;
    color: #28343d;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

.year-filter:focus,
.year-filter:focus-visible {
    outline: none;
}

.year-filter:hover {
    background: #c5ccd1;
}


.year-filter.active {
    background: #0078C6;
    color: #fff;
}

/* Grille identique aux machines, 5 colonnes sur grand écran */
.projets-grid {
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(5, minmax(260px, 1fr));
    padding: 10px 0 40px;
}

/* Carte alignée sur le style des machines */
.projet-card {
    position: relative;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 6px 18px -6px rgba(0,0,0,0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform .35s ease, box-shadow .35s ease;
    cursor: pointer;
    border: 1px solid #eef2f7;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

.projet-card:focus,
.projet-card:focus-visible {
    outline: none;
}

.projet-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 28px -6px rgba(0,0,0,0.28);
}

.projet-card.hidden {
    display: none !important;
}

/* Image avec même hauteur que les machines */
.projet-image {
    height: 250px;
    width: 100%;
    align-content: center;
    overflow: hidden;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.projet-image img {
    height: 90%;
    width: 90%;
    object-fit: contain;
    display: block;
    transition: transform .6s ease;
}

.projet-card:hover .projet-image img {
    transform: scale(1.08);
}

/* Contenu centré et flexible */
.projet-content {
    padding: 16px 18px 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    text-align: center;
}

.projet-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #222;
    margin: 0 0 8px;
    line-height: 1.3;
}

/* Overlay (apparition au hover) - même comportement que machines */
.projet-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15,20,30,0);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: background .35s ease, opacity .35s ease;
    padding: 16px;
}

.projet-card:hover .projet-overlay {
    background: rgba(15,20,30,0.55);
    opacity: 1;
    pointer-events: auto;
}

/* Actions empilées comme sur les machines (dans l'overlay) */
.projet-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: center;
    width: 100%;
    max-width: 260px;
    text-align: center;
}

/* Boutons */
.btn {
    background: #ffffff;
    border: none;
    padding: 10px 18px;
    font-size: .85rem;
    font-weight: 600;
    border-radius: 28px;
    letter-spacing: .5px;
    text-transform: uppercase;
    box-shadow: 0 4px 10px -4px rgba(0,0,0,0.35);
    cursor: pointer;
    transition: background .25s ease, color .25s ease, transform .25s ease;
    text-decoration: none;
    color: #0f1928;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

.btn:hover {
    background: #0f1928;
    color: #fff;
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn:focus,
.btn:focus-visible {
    outline: none;
}

/* États de chargement et erreur */
.loading-state, .error-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.loading-state {
    color: #0078C6;
}

.error-state {
    color: #dc3545;
}

.error-state button {
    background: #0078C6;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
}

.error-state button:hover {
    background: #005a91;
}

/* Empty state et compte */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #999;
}

/* Breakpoints : passer en grille auto-fill et ensuite 1 colonne */
@media (max-width: 1200px) {
    .projets-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }
}

@media (max-width: 768px) {
    .projets-header {
        margin-bottom: 32px;
    }

    .projets-header h1 {
        font-size: 2rem;
    }

    .projets-header p {
        font-size: 1rem;
    }

    .projets-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .controls-left {
        order: 2;
    }

    .controls-right {
        order: 1;
        flex-direction: column;
        gap: 12px;
    }

    .search-container {
        max-width: none;
        width: 100%;
        margin: 0;
    }

    .projets-count {
        align-self: flex-end;
    }

    .year-filters {
        gap: 8px;
        justify-content: flex-start;
        flex-wrap: nowrap;
        padding-bottom: 8px;
    }

    .year-filter {
        padding: 10px 18px;
        font-size: 13px;
        flex-shrink: 0;
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
    }

    .year-filter:focus,
    .year-filter:focus-visible {
        outline: none;
    }

    .projets-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .projet-card {
        -webkit-tap-highlight-color: transparent;
    }

    .projet-card:focus,
    .projet-card:focus-visible {
        outline: none;
    }

    .projet-actions {
        flex-direction: column;
    }

    .btn {
        flex: none;
        -webkit-tap-highlight-color: transparent;
    }

    .btn:focus,
    .btn:focus-visible {
        outline: none;
    }

    .search-input {
        -webkit-tap-highlight-color: transparent;
    }

    .search-input:focus {
        outline: none;
        border: 2px solid #0078C6;
        box-shadow: 0 0 0 3px rgba(0, 120, 198, 0.1);
    }
}

@media (max-width: 600px) {
    .projets-header {
        margin-bottom: 24px;
    }

    .projets-header h1 {
        font-size: 1.75rem;
    }

    .projets-header p {
        font-size: 0.9rem;
    }

    .projets-controls {
        gap: 12px;
    }

    .search-container {
        width: 100%;
    }

    .search-input {
        padding: 12px 16px;
        font-size: 14px;
    }

    .projets-count {
        font-size: 0.85rem;
        padding: 8px 14px;
    }

    .year-filters {
        gap: 6px;
        width: 100%;
        flex-wrap: nowrap;
        justify-content: flex-start;
        padding-bottom: 8px;
    }

    .year-filter {
        padding: 9px 16px;
        font-size: 12px;
        flex-shrink: 0;
        min-width: auto;
    }

    .projets-grid {
        gap: 16px;
        padding: 10px 0 32px;
    }

    .projet-card {
        border-radius: 16px;
    }

    .projet-image {
        height: 200px;
    }

    .projet-content {
        padding: 14px 16px 20px;
    }

    .projet-title {
        font-size: 0.95rem;
    }

    .btn {
        padding: 10px 16px;
        font-size: 0.8rem;
    }

    .empty-state {
        padding: 40px 16px;
    }

    .empty-state h3 {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .projets-header h1 {
        font-size: 1.5rem;
    }

    .projets-header p {
        font-size: 0.85rem;
    }

    .year-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 8px;
    }

    .year-filter {
        flex-shrink: 0;
        padding: 10px 12px;
        min-width: fit-content;
    }

    .projet-image {
        height: 180px;
    }

    .projet-title {
        font-size: 0.9rem;
    }

    .btn {
        padding: 9px 14px;
        font-size: 0.75rem;
    }
}