/* ========================================
   DPM DÉLÉGUÉS - Cards Design System
   Design moderne avec cards responsives
   Couleurs: #1e293b (dark) et #11b300 (green)
   ======================================== */

/* Container principal */
.dpm-wrapper {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

/* ========================================
   BARRE DE RECHERCHE
   ======================================== */
.dpm-search-bar {
    margin-bottom: 32px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(30, 41, 59, 0.08);
    overflow: hidden;
    border: 2px solid #f1f5f9;
    transition: all 0.3s ease;
}

.dpm-search-bar:focus-within {
    border-color: #11b300;
    box-shadow: 0 6px 20px rgba(17, 179, 0, 0.15);
}

.dpm-search-group {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    gap: 12px;
    position: relative;
}

.dpm-search-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    color: #64748b;
    transition: color 0.3s;
}

.dpm-search-group:focus-within .dpm-search-icon {
    color: #11b300;
}

.dpm-search-icon svg {
    width: 24px;
    height: 24px;
}

.dpm-search-field {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    padding: 14px 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #1e293b;
    background: transparent;
    font-weight: 500;
}

.dpm-search-field::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.dpm-btn-clear {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #f1f5f9;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    color: #64748b;
}

.dpm-btn-clear:hover {
    background: #fee2e2;
    color: #ef4444;
    transform: scale(1.05);
}

.dpm-btn-clear:active {
    transform: scale(0.95);
}

.dpm-loader {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.dpm-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #e2e8f0;
    border-top-color: #11b300;
    border-radius: 50%;
    animation: dpm-spin 0.6s linear infinite;
}

@keyframes dpm-spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   GRID DE CARDS
   ======================================== */
.dpm-results {
    position: relative;
}

.dpm-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

/* Card individuelle */
.dpm-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(30, 41, 59, 0.06);
    border: 2px solid #f1f5f9;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.dpm-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #11b300 0%, #0ea300 100%);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.dpm-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(30, 41, 59, 0.12);
    border-color: #11b300;
}

.dpm-card:hover::before {
    transform: scaleX(1);
}

/* Avatar / Initiales */
.dpm-card-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    text-transform: uppercase;
    box-shadow: 0 4px 12px rgba(30, 41, 59, 0.15);
    transition: all 0.3s;
}

.dpm-card:hover .dpm-card-avatar {
    background: linear-gradient(135deg, #11b300 0%, #0ea300 100%);
    transform: scale(1.05);
}

/* Contenu de la card */
.dpm-card-content {
    flex: 1;
}

.dpm-card-header {
    margin-bottom: 12px;
}

.dpm-card-name {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.dpm-card-firstname {
    font-size: 16px;
    font-weight: 500;
    color: #64748b;
    margin: 0;
}

.dpm-card-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.dpm-card-detail-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #475569;
}

.dpm-card-detail-item svg {
    width: 18px;
    height: 18px;
    color: #11b300;
    flex-shrink: 0;
}

.dpm-card-detail-item strong {
    color: #1e293b;
    font-weight: 600;
    min-width: 70px;
}

/* Badge fonction */
.dpm-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    color: #15803d;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid #bbf7d0;
    text-transform: capitalize;
    margin-top: 12px;
}

/* État vide */
.dpm-empty {
    grid-column: 1 / -1;
    padding: 60px 20px;
    text-align: center;
}

.dpm-empty-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: #94a3b8;
}

.dpm-empty-content svg {
    width: 64px;
    height: 64px;
    opacity: 0.5;
}

.dpm-empty-content p {
    font-size: 18px;
    font-weight: 500;
    margin: 0;
    color: #64748b;
}

/* ========================================
   FOOTER / COMPTEUR
   ======================================== */
.dpm-footer-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    margin-bottom: 24px;
    border: 2px solid #e2e8f0;
}

.dpm-footer-counter svg {
    width: 22px;
    height: 22px;
    color: #11b300;
}

.dpm-footer-counter span {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
}

#dpm-total-delegues {
    font-size: 20px;
    font-weight: 700;
    color: #11b300;
}

/* ========================================
   PAGINATION
   ======================================== */
.dpm-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.dpm-page-btn {
    min-width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    color: #1e293b;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    cursor: pointer;
}

.dpm-page-btn:hover:not(.dpm-disabled):not(.dpm-current) {
    background: #11b300;
    color: #ffffff;
    border-color: #11b300;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(17, 179, 0, 0.25);
}

.dpm-page-btn.dpm-current {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: #ffffff;
    border-color: #1e293b;
    cursor: default;
    box-shadow: 0 4px 12px rgba(30, 41, 59, 0.2);
}

.dpm-page-btn.dpm-disabled {
    background: #f8fafc;
    color: #cbd5e1;
    border-color: #e2e8f0;
    cursor: not-allowed;
    opacity: 0.5;
}

.dpm-ellipsis {
    padding: 0 8px;
    color: #94a3b8;
    font-weight: 600;
}

/* Boutons de navigation */
.dpm-first,
.dpm-last,
.dpm-prev,
.dpm-next {
    font-size: 18px;
    font-weight: 700;
}

/* ========================================
   ÉTATS DE CHARGEMENT
   ======================================== */
.dpm-loading {
    position: relative;
    pointer-events: none;
}

.dpm-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    z-index: 10;
}

/* ========================================
   MESSAGE D'ERREUR
   ======================================== */
.dpm-error-box {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 2px solid #fecaca;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #dc2626;
    font-weight: 500;
}

.dpm-error-box svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Tablettes */
@media (max-width: 1024px) {
    .dpm-cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
    }
}

/* Petites tablettes */
@media (max-width: 768px) {
    .dpm-wrapper {
        padding: 16px;
    }

    .dpm-cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 16px;
    }

    .dpm-card {
        padding: 20px;
    }

    .dpm-card-avatar {
        width: 56px;
        height: 56px;
        font-size: 22px;
    }

    .dpm-card-name {
        font-size: 18px;
    }

    .dpm-search-bar {
        margin-bottom: 24px;
    }
}

/* Mobiles */
@media (max-width: 576px) {
    .dpm-wrapper {
        padding: 12px;
    }

    .dpm-cards-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .dpm-card {
        padding: 18px;
    }

    .dpm-search-field {
        font-size: 15px;
        padding: 12px 8px;
    }

    .dpm-search-icon {
        width: 40px;
        height: 40px;
    }

    .dpm-search-icon svg {
        width: 20px;
        height: 20px;
    }

    .dpm-btn-clear {
        width: 32px;
        height: 32px;
    }

    .dpm-page-btn {
        min-width: 38px;
        height: 38px;
        font-size: 14px;
        padding: 0 12px;
    }

    .dpm-footer-counter {
        font-size: 14px;
        padding: 16px;
    }

    #dpm-total-delegues {
        font-size: 18px;
    }
}

/* Très petits écrans */
@media (max-width: 380px) {
    .dpm-card-avatar {
        width: 52px;
        height: 52px;
        font-size: 20px;
    }

    .dpm-card-name {
        font-size: 17px;
    }

    .dpm-card-firstname {
        font-size: 15px;
    }

    .dpm-card-detail-item {
        font-size: 13px;
    }

    .dpm-page-btn {
        min-width: 34px;
        height: 34px;
        font-size: 13px;
    }
}

/* Mode impression */
@media print {
    .dpm-search-bar,
    .dpm-pagination {
        display: none;
    }

    .dpm-cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .dpm-card {
        box-shadow: none;
        border: 1px solid #e2e8f0;
        page-break-inside: avoid;
    }

    .dpm-card:hover {
        transform: none;
    }
}
