* {
    margin: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
    background: #f5f5f5;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-bottom: 40px; /* Pour le footer */
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* === HEADER COMPLET === */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #667eea 100%);
    padding: 25px 30px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

/* Effet de brillance animé */
.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { left: -100%; }
    100% { left: 100%; }
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 2;
}

/* Section principale avec logos et titre */
.header-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
}

/* Container des logos partenaires */
.partner-logos {
    display: flex;
    align-items: center;
    gap: 30px;
    justify-content: flex-start;
}

.logo-item {
    transition: all 0.3s ease;
    cursor: pointer;
    animation: logoFadeIn 0.8s ease forwards;
    opacity: 0;
}

.logo-item:nth-child(1) { animation-delay: 0.2s; }
.logo-item:nth-child(2) { animation-delay: 0.4s; }
.logo-item:nth-child(3) { animation-delay: 0.6s; }

@keyframes logoFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.logo-item:hover {
    transform: translateY(-3px) scale(1.05);
}

.partner-logo {
    height: 50px;
    width: auto;
    max-width: 140px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px;
    border-radius: 12px;
    box-shadow: 
        0 4px 15px rgba(0,0,0,0.2),
        0 0 0 1px rgba(255,255,255,0.1);
    object-fit: contain;
    object-position: center;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.partner-logo:hover {
    transform: translateY(-3px) scale(1.05);
    background: rgba(255, 255, 255, 1);
    box-shadow: 
        0 8px 30px rgba(0,0,0,0.3),
        0 0 0 2px rgba(255,255,255,0.2),
        0 5px 15px rgba(102, 126, 234, 0.4);
    filter: drop-shadow(0 5px 15px rgba(102, 126, 234, 0.3));
}

/* Section titre principal */
.main-title-section {
    text-align: left;
}

.main-title {
    color: white;
    font-size: 2.2em;
    margin: 0;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    letter-spacing: 1px;
    background: linear-gradient(45deg, #ffffff, #f0f4ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleSlideIn 0.8s ease forwards;
}

@keyframes titleSlideIn {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.main-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1em;
    margin: 8px 0 0 0;
    font-weight: 400;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
    opacity: 0;
    animation: subtitleFadeIn 1s ease forwards;
    animation-delay: 0.3s;
}

@keyframes subtitleFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 0.95;
        transform: translateY(0);
    }
}

/* Section utilisateur */
.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 15px 20px;
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.user-info span {
    font-weight: 500;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

.badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
}

.badge-admin {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

/* Boutons du header */
.user-info .btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

.user-info .btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.user-info .btn-small {
    padding: 8px 16px;
    font-size: 13px;
}

/* === ONGLETS === */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

.tab {
    padding: 12px 24px;
    background: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.tab:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.tab.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

/* === CARTES === */
.card {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

/* === BOUTONS === */
.btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 5px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: #6c757d;
}

.btn-danger {
    background: #dc3545;
}

.btn-success {
    background: #28a745;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

/* Bouton emoji */
.btn-emoji {
    position: absolute;
    right: 10px;
    top: 10px;
    padding: 6px 10px;
    font-size: 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}

.btn-emoji:hover {
    background: #5a67d8;
    transform: scale(1.1);
}

/* Bouton champs */
.btn-field {
    position: absolute;
    right: 55px;
    top: 10px;
    padding: 6px 10px;
    font-size: 14px;
    font-weight: bold;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}

.btn-field:hover {
    background: #218838;
    transform: scale(1.1);
}

/* === ZONE D'UPLOAD === */
.upload-area {
    border: 3px dashed #667eea;
    border-radius: 15px;
    padding: 60px;
    text-align: center;
    background: rgba(102, 126, 234, 0.05);
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    background: rgba(102, 126, 234, 0.1);
}

.upload-area.dragover {
    background: rgba(102, 126, 234, 0.2);
    transform: scale(1.02);
}

/* === MESSAGES ET CONTENEURS === */
.message-container {
    position: relative;
    margin-bottom: 20px;
}

.char-counter {
    margin-top: 5px;
    font-size: 14px;
    color: #28a745;
    text-align: right;
    transition: color 0.3s ease;
}

/* === FILTRES === */
.filters {
    display: grid;
    grid-template-columns: 120px 1fr 1fr 1fr auto auto auto auto;
    gap: 10px;
    margin-bottom: 20px;
}

.filters input,
.filters select {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
}

.filters input:focus,
.filters select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* === TABLEAUX === */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

table th {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    text-align: left;
    position: relative;
}

table td {
    border-bottom: 1px solid #e0e0e0;
    position: relative;
}
#contactsTable th,
#contactsTable td {
    padding: 12px 15px;
    vertical-align: middle; /* Bonus : assure un alignement vertical parfait du texte */
    height: 40px
}

table tr:hover td {
    background: rgba(102, 126, 234, 0.05);
}

/* Largeur minimale pour la colonne téléphone */
table th:nth-child(5), 
table td:nth-child(5) {
    min-width: 160px;
    white-space: nowrap;
}

/* Forcer les boutons côte à côte */
table td:last-child {
    white-space: nowrap;
    text-align: center;
}

table td:last-child .btn-small {
    margin: 0 3px;
}

/* === SCROLLING DES TABLEAUX === */
.table-container {
    width: 100%;
    position: relative;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.table-scroll-wrapper {
    position: relative;
}

.table-scroll-top {
    overflow-x: auto;
    overflow-y: hidden;
    height: 20px;
    margin-bottom: -5px;
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f8f9fa;
    border-radius: 10px 10px 0 0;
}

.table-scroll-top::-webkit-scrollbar {
    height: 15px;
}

.table-scroll-top::-webkit-scrollbar-track {
    background: #e9ecef;
    border-radius: 10px;
}

.table-scroll-top::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.table-scroll-top::-webkit-scrollbar-thumb:hover {
    background: #5a67d8;
}

.scroll-sync-helper {
    height: 1px;
    visibility: hidden;
}

.table-main-container {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.scroll-indicators {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    pointer-events: none;
    z-index: 5;
}

.scroll-indicator-left,
.scroll-indicator-right {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to right, rgba(255,255,255,0.9), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: auto;
    cursor: pointer;
}

.scroll-indicator-right {
    right: 0;
    background: linear-gradient(to left, rgba(255,255,255,0.9), transparent);
}

.scroll-indicator-left.show,
.scroll-indicator-right.show {
    opacity: 1;
}

.scroll-indicator-left:hover,
.scroll-indicator-right:hover {
    background: linear-gradient(to right, rgba(102, 126, 234, 0.1), transparent);
}

.scroll-indicator-right:hover {
    background: linear-gradient(to left, rgba(102, 126, 234, 0.1), transparent);
}

.scroll-arrow {
    font-size: 24px;
    color: #667eea;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.table-container table {
    min-width: 1500px;
}

/* Style pour la barre de défilement */
.table-container::-webkit-scrollbar {
    height: 10px;
}

.table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.table-container::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: #5a67d8;
}

/* === NOTIFICATIONS === */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 10px;
    color: white;
    animation: slideIn 0.3s ease;
    z-index: 1000;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.notification.success {
    background: #28a745;
}

.notification.error {
    background: #dc3545;
}

.notification.info {
    background: #17a2b8;
}

.notification.warning {
    background: #ffc107;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* === QR CODE ET CONNEXION === */
.qr-container {
    text-align: center;
    padding: 30px;
}

.qr-container img {
    max-width: 300px;
    margin: 20px 0;
}

.connected {
    color: #28a745;
    font-weight: bold;
    text-align: center;
    font-size: 18px;
}

/* === TEXTAREA ET CHAMPS === */
#smsTemplate {
    width: 100%;
    min-height: 150px;
    padding: 15px;
    padding-right: 100px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    line-height: 1.5;
    resize: vertical;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}

#smsTemplate:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#whatsappTemplate {
    width: 100%;
    min-height: 150px;
    padding: 15px;
    padding-right: 100px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    line-height: 1.5;
    resize: vertical;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}

#whatsappTemplate:focus {
    outline: none;
    border-color: #25D366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

#emailTemplate {
    width: 100%;
    min-height: 300px;
    padding: 15px;
    padding-right: 100px;
    border: 2px solid #e0e0e0;
    border-radius: 0 0 10px 10px;
    border-top: none;
    font-size: 16px;
    line-height: 1.6;
    background: white;
    outline: none;
}

#emailTemplate:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#emailTemplate:empty:before {
    content: attr(data-placeholder);
    color: #aaa;
}

/* === LISTES DE DESTINATAIRES === */
.recipients-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 10px;
    margin: 15px 0;
}

.recipients-list label {
    display: block;
    padding: 10px;
    margin: 5px 0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.recipients-list label:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.recipients-list input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
}

/* === STATUTS === */
.status-pending { color: #ffc107; }
.status-sent { color: #28a745; }
.status-failed { color: #dc3545; }

/* === CARTES DE STATISTIQUES === */
.stats-grid {
    display: grid;
    /* MODIFICATION : On passe à 6 colonnes au lieu de auto-fit */
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 15px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
    cursor: pointer; /* AJOUT : Pour montrer que c'est cliquable */
}

.stat-card:hover {
    transform: translateY(-5px) scale(1.03); /* On accentue un peu l'effet */
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.stat-card h3 {
    font-size: 2.2em; /* On réduit un peu la police du chiffre */
    margin-bottom: 8px; /* On réduit la marge */
}
/* On s'assure que le texte en dessous est aussi un peu plus petit */
.stat-card p {
    font-size: 16px !important;
    line-height: 1.2;
}
/* === MODALS === */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h3 {
    color: #667eea;
    margin-bottom: 20px;
}

/* === FORMULAIRES === */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group label input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 12px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

.modal-buttons button {
    flex: 1;
}

/* === SECTIONS ADMIN === */
.admin-section {
    margin-bottom: 40px;
}

.admin-section h3 {
    color: #667eea;
    margin-bottom: 20px;
}

/* === MINI TABS POUR L'HISTORIQUE === */
.tabs-mini {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
}

.tab-mini {
    padding: 8px 16px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.tab-mini:hover {
    background: #f8f9fa;
}

.tab-mini.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.tab-mini.admin-only {
    margin-left: auto;
    background: #dc3545 !important;
    color: white !important;
    border-color: #dc3545 !important;
}

.tab-mini.admin-only:hover {
    background: #c82333 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(220, 53, 69, 0.3);
}

/* === SÉLECTEURS D'ÉMOJIS ET CHAMPS === */
#emoji-selector {
    position: absolute;
    background: white;
    border: 2px solid #667eea;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    max-width: 400px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
}

#emoji-selector::-webkit-scrollbar {
    width: 8px;
}

#emoji-selector::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

#emoji-selector::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

#emoji-selector::-webkit-scrollbar-thumb:hover {
    background: #5a67d8;
}

#field-selector {
    position: absolute;
    background: white;
    border: 2px solid #28a745;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    width: 300px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
}

#field-selector h3 {
    margin: 0 0 10px 0;
    color: #28a745;
    font-size: 16px;
}

#field-selector .field-item {
    padding: 8px 12px;
    margin: 5px 0;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#field-selector .field-item:hover {
    background: #e9ecef;
    border-color: #28a745;
    transform: translateX(5px);
}

#field-selector .field-item .field-name {
    font-weight: bold;
    color: #28a745;
}

#field-selector .field-item .field-desc {
    font-size: 12px;
    color: #6c757d;
}

/* === SECTION NUMÉRO MANUEL === */
.manual-number-section {
    background: #f8f9fa;
    border: 2px solid #e8e9ea;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    transition: all 0.3s ease;
}

.manual-number-section:hover {
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.1);
}

.manual-number-section h4 {
    margin: 0 0 15px 0;
    color: #667eea;
    font-size: 18px;
}

.manual-number-section input[type="tel"] {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.manual-number-section input[type="tel"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#selectedNumberDisplay {
    margin-top: 10px;
    padding: 10px;
    background: #e8f5e9;
    border-radius: 5px;
    color: #28a745;
    font-weight: 500;
    display: none;
}

#selectedNumberDisplay:not(:empty) {
    display: block;
}

/* === BARRE D'ACTIONS EMAIL === */
#email-actions-bar {
    position: sticky;
    top: 0;
    background: linear-gradient(to right, #f8f9fa, #ffffff);
    z-index: 100;
    padding: 20px 0;
    margin: -30px -30px 30px -30px;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
}

.email-actions-container {
    max-width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    gap: 20px;
}

.email-selection-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #4a5568;
    font-size: 16px;
}

.email-selection-info i {
    font-size: 20px;
    color: #667eea;
}

#email-selected-count {
    font-size: 24px;
    color: #667eea;
    font-weight: 700;
}

.email-action-buttons {
    display: flex;
    gap: 15px;
    align-items: center;
}

.btn-action {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.btn-action i {
    font-size: 16px;
}

.btn-preview {
    background: #6c757d;
    color: white;
}

.btn-preview:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.btn-send {
    background: linear-gradient(135deg, #EA4335, #d33b2c);
    color: white;
    position: relative;
    overflow: hidden;
}

.btn-send::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.btn-send:hover::before {
    left: 100%;
}

.btn-send:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(234, 67, 53, 0.4);
}

.btn-send:not(:disabled) {
    animation: pulse 2s infinite;
}

.btn-action:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    animation: none;
}

.btn-action:disabled:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* === PAGINATION === */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin: 20px 0;
    border-top: 2px solid #e0e0e0;
    border-bottom: 2px solid #e0e0e0;
    flex-wrap: wrap;
    gap: 15px;
}

.pagination-info {
    color: #666;
    font-size: 14px;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination-controls .btn-small {
    min-width: 40px;
    padding: 6px 12px;
    margin: 0;
}

.pagination-controls .btn-small.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.pagination-controls .btn-small:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-dots {
    padding: 0 10px;
    color: #999;
}

.pagination-select {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    margin-left: 15px;
    cursor: pointer;
}

.pagination-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* === ÉDITEUR EMAIL AMÉLIORÉ === */
.enhanced-email-toolbar {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    padding: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 0;
}

.email-toolbar-group {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px;
    border-right: 1px solid #ddd;
    margin-right: 10px;
}

.email-toolbar-group:last-child {
    border-right: none;
}

.email-toolbar-btn {
    padding: 6px 10px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    min-width: 32px;
    text-align: center;
}

.email-toolbar-btn:hover {
    background: #e9ecef;
    border-color: #667eea;
    transform: translateY(-1px);
}

.email-toolbar-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.email-toolbar-select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: white;
    cursor: pointer;
    font-size: 13px;
}

.email-toolbar-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

/* Templates pour l'email */
.email-templates-section {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.email-templates-title {
    font-size: 16px;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 15px;
    text-align: center;
}

.email-templates-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr); /* On force 6 colonnes de taille égale */
    gap: 10px;
}

.email-template-item {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.email-template-item:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.email-template-name {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
    font-size: 13px;
}

.email-template-description {
    font-size: 11px;
    color: #666;
    line-height: 1.3;
}

/* Onglets pour l'éditeur email */
.email-editor-tabs {
    display: flex;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    border-radius: 0;
    margin-bottom: 0;
}

.email-editor-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    font-size: 14px;
}

.email-editor-tab.active {
    background: white;
    border-bottom-color: #667eea;
    color: #667eea;
    font-weight: bold;
}

.email-editor-tab:hover {
    background: #e9ecef;
}

/* Zone d'aperçu email */
.email-preview-container {
    background: #f8f9fa;
    padding: 20px;
    border: 2px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 10px 10px;
    display: none;
}

.email-preview-controls {
    text-align: center;
    margin-bottom: 20px;
}

.email-device-btn {
    padding: 8px 16px;
    margin: 0 5px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
}

.email-device-btn.active {
    background: #667eea;
    color: white;
}

.email-device-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.email-preview-frame {
    background: white;
    border: 2px solid #ddd;
    border-radius: 10px;
    margin: 0 auto;
    transition: all 0.3s ease;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.email-preview-frame.desktop {
    width: 100%;
    max-width: 700px;
}

.email-preview-frame.mobile {
    width: 375px;
    max-width: 100%;
}

.email-preview-content {
    padding: 20px;
    min-height: 300px;
    font-family: Arial, sans-serif;
    line-height: 1.6;
}

/* Zone code HTML email */
.email-html-container {
    display: none;
    padding: 20px;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 10px 10px;
}

.email-html-textarea {
    width: 100%;
    height: 350px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    background: white;
    resize: vertical;
}

.email-html-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Palette de couleurs pour l'email */
.email-color-palette {
    position: absolute;
    background: white;
    border: 2px solid #667eea;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    display: none;
    z-index: 1001;
    width: 280px;
}

.email-color-section {
    margin-bottom: 15px;
}

.email-color-section h4 {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #333;
    font-weight: bold;
}

.email-color-grid {
    display: grid;
    grid-template-columns: repeat(8, 28px);
    gap: 4px;
}

.email-color-btn {
    width: 28px;
    height: 28px;
    border: 2px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.email-color-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
    border-color: #667eea;
}

.email-custom-color {
    width: 100%;
    height: 35px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    cursor: pointer;
}

.email-custom-color:focus {
    outline: none;
    border-color: #667eea;
}

/* Créateur de tableau pour email */
.email-table-creator {
    position: absolute;
    background: white;
    border: 2px solid #667eea;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    display: none;
    z-index: 1001;
    width: 280px;
}

.email-table-creator h4 {
    margin: 0 0 15px 0;
    color: #667eea;
    font-size: 16px;
}

.email-table-grid {
    display: grid;
    grid-template-columns: repeat(6, 20px);
    gap: 2px;
    margin: 15px 0;
    justify-content: center;
}

.email-table-cell {
    width: 20px;
    height: 20px;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: all 0.1s ease;
}

.email-table-cell.hover {
    background: #667eea;
    border-color: #667eea;
}

.email-table-size {
    text-align: center;
    margin: 10px 0;
    font-weight: bold;
    color: #667eea;
}

/* Messages de notification pour l'éditeur */
.email-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideInRight 0.3s ease;
}

.email-notification.success {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.email-notification.error {
    background: linear-gradient(135deg, #dc3545, #e74c3c);
}

.email-notification.info {
    background: linear-gradient(135deg, #17a2b8, #3498db);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* === BARRE DE PROGRESSION SMS === */
.sms-progress-container {
    background: white;
    border: 2px solid #667eea;
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
    display: none;
    animation: slideDown 0.3s ease;
}

.sms-progress-container.show {
    display: block;
}

.sms-progress-title {
    text-align: center;
    color: #667eea;
    font-weight: bold;
    margin-bottom: 15px;
    font-size: 16px;
}

.sms-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
    color: #666;
}

.sms-progress-bar-container {
    background: #e0e0e0;
    border-radius: 10px;
    height: 25px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.sms-progress-bar {
    background: linear-gradient(135deg, #667eea, #764ba2);
    height: 100%;
    border-radius: 10px;
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.sms-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.sms-progress-details {
    margin-top: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 13px;
    color: #666;
}

.sms-progress-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.sms-progress-stat {
    text-align: center;
    padding: 8px;
    background: white;
    border-radius: 5px;
    border: 1px solid #e0e0e0;
}

.sms-progress-stat-value {
    font-weight: bold;
    font-size: 16px;
    color: #667eea;
}

.sms-progress-stat-label {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sms-progress-bar.success {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.sms-progress-bar.error {
    background: linear-gradient(135deg, #dc3545, #e74c3c);
}

.sms-progress-bar.warning {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
}

.sms-cancel-button {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 10px;
    transition: all 0.2s ease;
}

.sms-cancel-button:hover {
    background: #c82333;
    transform: translateY(-1px);
}

.sms-status-message {
    text-align: center;
    margin-top: 10px;
    padding: 8px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 500;
}

.sms-status-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.sms-status-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f1aeb5;
}

.sms-status-message.info {
    background: #cce7ff;
    color: #004085;
    border: 1px solid #b8daff;
}

/* === INPUTS DATETIME === */
input[type="datetime-local"] {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    width: 100%;
}

input[type="datetime-local"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* === COPYRIGHT FOOTER === */
.copyright-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(44, 62, 80, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 9999;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    animation: slideUpCopyright 0.5s ease-out;
}

.copyright-content {
    text-align: center;
    padding: 8px 20px;
    color: #ecf0f1;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

@keyframes slideUpCopyright {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

/* Responsive pour l'éditeur email amélioré */
@media (max-width: 768px) {
    .header {
        padding: 20px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .header-main {
        align-items: center;
        text-align: center;
    }
    
    .main-title-section {
        text-align: center;
    }
    
    .partner-logos {
        justify-content: center;
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .partner-logo {
        height: 40px;
        max-width: 100px;
        padding: 8px;
    }
    
    .main-title {
        font-size: 1.6em;
    }
    
    .main-subtitle {
        font-size: 0.9em;
    }
    
    .user-info {
        flex-wrap: wrap;
        justify-content: center;
        padding: 12px 16px;
    }
    
    .tabs {
        flex-wrap: wrap;
    }
    
    .filters {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    table {
        font-size: 14px;
    }
    
    table th,
    table td {
        padding: 8px;
    }
    
    .modal-content {
        padding: 20px;
    }
    
    .table-container table {
        min-width: 800px;
    }
    
    .enhanced-email-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .email-toolbar-group {
        justify-content: center;
        border-right: none;
        border-bottom: 1px solid #ddd;
        padding-bottom: 8px;
        margin-bottom: 8px;
        margin-right: 0;
    }

    .email-toolbar-group:last-child {
        border-bottom: none;
        margin-bottom: 0;
        padding-bottom: 0;
    }
    
    .email-templates-grid {
        grid-template-columns: 1fr;
    }
    
    .email-preview-frame.mobile {
        width: 100%;
    }
    
    .email-color-palette,
    .email-table-creator {
        width: 90vw;
        max-width: 300px;
        left: 5vw !important;
    }
    
    .email-actions-container {
        flex-direction: column;
        gap: 15px;
        padding: 0 15px;
    }
    
    .email-action-buttons {
        width: 100%;
        justify-content: stretch;
    }
    
    .btn-action {
        flex: 1;
        justify-content: center;
    }
    
    .email-selection-info {
        text-align: center;
    }
    
    .pagination-container {
        flex-direction: column;
        text-align: center;
    }
    
    .pagination-controls {
        justify-content: center;
    }
    
    .pagination-select {
        margin-left: 0;
        margin-top: 10px;
    }
    
    .sms-progress-info {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
    
    .sms-progress-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .sms-progress-container {
        padding: 15px;
        margin: 15px 0;
    }
}

@media (max-width: 1200px) {
    .partner-logos {
        gap: 20px;
    }
    
    .partner-logo {
        height: 45px;
        max-width: 120px;
        padding: 8px;
    }
    
    .main-title {
        font-size: 1.9em;
    }
    
    .main-subtitle {
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    .partner-logos {
        gap: 12px;
    }
    
    .partner-logo {
        height: 35px;
        max-width: 85px;
        padding: 5px;
    }
    
    .main-title {
        font-size: 1.4em;
        line-height: 1.2;
    }
    
    .main-subtitle {
        font-size: 0.85em;
        line-height: 1.3;
    }
    
    .copyright-content {
        font-size: 11px;
        padding: 6px 15px;
    }
}

/* === CLASSES UTILITAIRES === */
.admin-only {
    display: none;
}

.loading {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid #667eea;
    border-top: 3px solid transparent;
    border-radius: 50%;
    margin-left: 10px;
    animation: spin 1s linear infinite;
}

.email-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 150px;
    color: #667eea;
    font-size: 16px;
}

.email-loading::after {
    content: '';
    width: 18px;
    height: 18px;
    border: 3px solid #667eea;
    border-top: 3px solid transparent;
    border-radius: 50%;
    margin-left: 10px;
    animation: spin 1s linear infinite;
}

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

/* Animation pour les templates */
.email-template-item {
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* États désactivés */
.email-toolbar-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.email-toolbar-btn:disabled:hover {
    background: white;
    border-color: #ddd;
}

/* Amélioration du focus pour l'accessibilité */
.email-toolbar-btn:focus,
.email-toolbar-select:focus,
.email-editor-tab:focus,
.email-device-btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}
/* Styles pour le conteneur des boutons d'action des contacts */
.contact-actions {
    display: flex; /* Pour aligner les boutons horizontalement */
    gap: 15px; /* Espace entre les boutons */
    margin-top: 15px; /* Espace au-dessus des boutons */
    margin-bottom: 20px; /* Espace en dessous avant le tableau */
}
/* --- AJUSTEMENT DES LARGEURS DE COLONNES DU TABLEAU DE CONTACTS --- */

/* Cible la colonne "Prénoms" (la 3ème colonne du tableau) */
#contactsTable th:nth-child(3),
#contactsTable td:nth-child(3) {
    min-width: 160px;      /* On définit une largeur minimale pour les prénoms composés */
    white-space: nowrap;   /* On empêche le texte de revenir à la ligne */
}

/* Cible la colonne "Ville" (la 7ème colonne du tableau) */
#contactsTable th:nth-child(7),
#contactsTable td:nth-child(7) {
    min-width: 150px;      /* On définit une largeur minimale pour les noms de ville */
}

/* Cible la colonne "Date Inscription" (la 8ème colonne du tableau) */
#contactsTable th:nth-child(8),
#contactsTable td:nth-child(8) {
    min-width: 150px;      /* Assez large pour que "Date Inscription" tienne sur une ligne */
    white-space: nowrap;   /* On empêche la date de se couper si le format est long */
}
/* =================================================================== */
/* AMÉLIORATIONS VISUELLES DU TABLEAU DE CONTACTS                      */
/* =================================================================== */

/* 1. Couleurs de lignes alternées (Zebra Striping) pour une meilleure lisibilité */
#contactsTable tbody tr:nth-child(even) {
    background-color: #f8f9fa; /* Un gris très clair pour les lignes paires */
}

/* 2. Effet de survol pour rendre le tableau plus interactif */
#contactsTable tbody tr:hover {
    background-color: #e9ecef; /* Un gris un peu plus foncé au survol */
    cursor: default; /* Change le curseur pour indiquer l'interactivité */
}

/* 3. Affiner les bordures pour un look plus léger */
#contactsTable td {
    border-color: #e9ecef; /* Bordure plus subtile que le gris par défaut */
}

/* 4. Ajouter une bordure sous l'en-tête pour une meilleure séparation */
#contactsTable th {
    border-bottom: 1px solid #5a67d8; /* Bordure solide et foncée sous l'en-tête */
}

/* 5. Centrer le texte dans certaines colonnes pour une meilleure présentation */
/* Colonnes ciblées : Checkbox (1), ID (2), Level (5), Rang (6) */
#contactsTable th:nth-child(1), #contactsTable td:nth-child(1),
#contactsTable th:nth-child(2), #contactsTable td:nth-child(2),
#contactsTable th:nth-child(5), #contactsTable td:nth-child(5),
#contactsTable th:nth-child(6), #contactsTable td:nth-child(6) {
    text-align: center;
}
.card h2 {
    font-size: 1.3em;      /* On réduit la taille de la police (la valeur par défaut est plus grande) */
    margin-bottom: 25px; /* On ajoute un espace de 25px en dessous du titre */
}
/* =================================================================== */
/* AMÉLIORATIONS ENTÊTE TABLEAU - HAUTEUR ET LARGEUR DES COLONNES     */
/* =================================================================== */

/* 1. Réduire la hauteur de l'entête et empêcher le retour à la ligne */
#contactsTable th {
    height: 35px;           /* Hauteur fixe réduite pour l'entête */
    padding: 8px 12px;      /* Padding réduit (au lieu de 12px 15px) */
    white-space: nowrap;    /* Empêche le texte de l'entête de revenir à la ligne */
    overflow: hidden;       /* Cache le texte qui dépasse */
    text-overflow: ellipsis; /* Ajoute "..." si le texte est trop long */
    vertical-align: middle; /* Centre verticalement le texte */
    font-size: 14px;        /* Taille de police légèrement réduite */
    font-weight: 600;       /* Police un peu moins grasse */
}

/* 2. Définir des largeurs minimales spécifiques pour chaque colonne */
/* Checkbox */
#contactsTable th:nth-child(1),
#contactsTable td:nth-child(1) {
    width: 50px;
    min-width: 50px;
    max-width: 50px;
}

/* ID */
#contactsTable th:nth-child(2),
#contactsTable td:nth-child(2) {
    width: 80px;
    min-width: 80px;
}

/* Prénoms */
#contactsTable th:nth-child(3),
#contactsTable td:nth-child(3) {
    width: 140px;
    min-width: 140px;
}

/* Nom */
#contactsTable th:nth-child(4),
#contactsTable td:nth-child(4) {
    width: 120px;
    min-width: 120px;
}

/* Genre */
#contactsTable th:nth-child(5),
#contactsTable td:nth-child(5) {
    width: 80px;
    min-width: 80px;
}

/* Level */
#contactsTable th:nth-child(6),
#contactsTable td:nth-child(6) {
    width: 90px;
    min-width: 90px;
}

/* Rang */
#contactsTable th:nth-child(7),
#contactsTable td:nth-child(7) {
    width: 110px;
    min-width: 110px;
}

/* Ville */
#contactsTable th:nth-child(8),
#contactsTable td:nth-child(8) {
    width: 140px;
    min-width: 140px;
}

/* Date Inscription */
#contactsTable th:nth-child(9),
#contactsTable td:nth-child(9) {
    width: 130px;
    min-width: 130px;
}

/* Téléphone */
#contactsTable th:nth-child(10),
#contactsTable td:nth-child(10) {
    width: 150px;
    min-width: 150px;
}

/* Email */
#contactsTable th:nth-child(11),
#contactsTable td:nth-child(11) {
    width: 180px;
    min-width: 180px;
}

/* Binaire */
#contactsTable th:nth-child(12),
#contactsTable td:nth-child(12) {
    width: 80px;
    min-width: 80px;
}

/* Autoship */
#contactsTable th:nth-child(13),
#contactsTable td:nth-child(13) {
    width: 100px;
    min-width: 100px;
}

/* Mot de passe */
#contactsTable th:nth-child(14),
#contactsTable td:nth-child(14) {
    width: 120px;
    min-width: 120px;
}

/* Actions */
#contactsTable th:nth-child(15),
#contactsTable td:nth-child(15) {
    width: 100px;
    min-width: 100px;
}

/* 6. UNIFORMISER LA HAUTEUR DES LIGNES DE DONNÉES */
#contactsTable tbody tr {
    height: 35px; /* Même hauteur que l'entête */
}

#contactsTable tbody td {
    height: 35px;           /* Hauteur fixe identique à l'entête */
    padding: 8px 12px;      /* Même padding que l'entête */
    vertical-align: middle; /* Centre verticalement le contenu */
    font-size: 14px;        /* Même taille de police que l'entête */
    line-height: 1.2;       /* Hauteur de ligne optimisée */
    overflow: hidden;       /* Cache le contenu qui dépasse */
    text-overflow: ellipsis; /* Ajoute "..." si le texte est trop long */
    white-space: nowrap;    /* Empêche le retour à la ligne dans les cellules */
}

/* 3. Ajuster la largeur minimale totale du tableau */
.table-container table {
    min-width: 1800px; /* Augmenté de 1500px à 1800px pour accommoder toutes les colonnes */
}

/* 4. Améliorer l'affichage responsive pour les petits écrans */
@media (max-width: 768px) {
    #contactsTable th {
        font-size: 12px;
        padding: 6px 8px;
        height: 30px;
    }
    
    #contactsTable tbody td {
        font-size: 12px;
        padding: 6px 8px;
        height: 30px; /* Même hauteur que l'entête sur mobile */
    }
    
    .table-container table {
        min-width: 1200px; /* Réduit sur mobile mais toujours suffisant */
    }
}

/* 5. Optionnel : Améliorer la lisibilité avec des couleurs alternées */
#contactsTable thead tr {
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
}

#contactsTable th {
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* 7. AMÉLIORER LA COHÉRENCE VISUELLE */
/* Supprimer les anciennes règles de hauteur conflictuelles */
#contactsTable th,
#contactsTable td {
    border-collapse: collapse;
    box-sizing: border-box;
}

/* Assurer une hauteur uniforme pour tous les éléments du tableau */
#contactsTable tr {
    height: 35px;
}

/* Optimiser l'affichage des boutons dans la colonne Actions */
#contactsTable td:last-child .btn-small {
    margin: 0 2px;
    padding: 4px 8px;
    font-size: 12px;
    line-height: 1;
}

/* Optimiser l'affichage des checkboxes */
#contactsTable input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
}

#contactsTable th:last-child {
    border-right: none;
}
/* =================================================================== */
/* CARTES STATISTIQUES ULTRA-COMPACTES POUR 8 ÉLÉMENTS SUR UNE LIGNE  */
/* À AJOUTER À LA FIN DU FICHIER STYLES.CSS (REMPLACE LA VERSION 7)   */
/* =================================================================== */

/* Modifier la grille pour accommoder 8 cartes sur une ligne */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr); /* 8 colonnes au lieu de 7 */
    gap: 10px; /* Réduire encore l'espace entre les cartes (était 12px) */
    margin-bottom: 30px;
}

/* Réduire encore plus la taille des cartes statistiques */
.stat-card {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 10px 6px; /* Encore plus compact (était 12px 8px) */
    border-radius: 10px; /* Légèrement plus petit (était 12px) */
    text-align: center;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.2); /* Ombre plus subtile */
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 75px; /* Hauteur minimale réduite (était 80px) */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.stat-card:hover {
    transform: translateY(-2px) scale(1.02); /* Effet encore plus subtil */
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

/* Réduire encore la taille du chiffre principal */
.stat-card h3 {
    font-size: 1.6em; /* Réduit de 1.8em à 1.6em */
    margin-bottom: 4px; /* Réduit de 6px à 4px */
    font-weight: 700;
    line-height: 1;
}

/* Réduire encore la taille du texte descriptif */
.stat-card p {
    font-size: 11px; /* Réduit de 12px à 11px */
    margin: 0;
    line-height: 1.1;
    font-weight: 500;
}

/* Style spécifique pour la carte Binaire (verte) */
.stat-card[style*="linear-gradient(135deg, #28a745, #20c997)"] {
    background: linear-gradient(135deg, #28a745, #20c997) !important;
    color: white;
}

.stat-card[style*="linear-gradient(135deg, #28a745, #20c997)"]:hover {
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
}

/* Responsive pour tablettes */
@media (max-width: 1400px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr); /* 4 colonnes sur tablette large */
        gap: 8px;
    }
    
    .stat-card {
        padding: 8px 4px;
        min-height: 65px;
    }
    
    .stat-card h3 {
        font-size: 1.4em;
    }
    
    .stat-card p {
        font-size: 10px;
    }
}

/* Responsive pour tablettes moyennes */
@media (max-width: 1000px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr); /* 3 colonnes sur tablette */
        gap: 8px;
    }
}

/* Responsive pour mobiles */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 colonnes sur mobile */
        gap: 6px;
    }
    
    .stat-card {
        padding: 6px 3px;
        min-height: 55px;
    }
    
    .stat-card h3 {
        font-size: 1.2em;
        margin-bottom: 2px;
    }
    
    .stat-card p {
        font-size: 9px;
    }
}

/* Styles spécifiques pour les cartes d'alerte (manque de données) */
.stat-card[style*="linear-gradient(135deg, #ff9a9e, #fecfef)"] {
    background: linear-gradient(135deg, #ff9a9e, #fecfef) !important;
    color: #721c24;
}

.stat-card[style*="linear-gradient(135deg, #ff9a9e, #fecfef)"]:hover {
    box-shadow: 0 5px 15px rgba(255, 154, 158, 0.4);
}
/* =================================================================== */
/* SOLUTION FINALE COLONNES FIGÉES (SURBRILLANCE + CHEVAUCHEMENT)    */
/* =================================================================== */

/* 1. Définir la position et la couche (z-index) pour les colonnes figées */
#contactsTable thead th:nth-child(-n+4),
#contactsTable tbody td:nth-child(-n+4) {
    position: sticky;
    z-index: 1; /* Met les cellules figées sur une couche supérieure */
}

/* 2. S'assurer que les en-têtes sont par-dessus tout */
#contactsTable thead th:nth-child(-n+4) {
    z-index: 2;
}

/* 3. Gérer explicitement l'arrière-plan des cellules de données figées pour TOUS les cas */

/* Cas par défaut (lignes impaires) : fond blanc */
#contactsTable tbody td:nth-child(-n+4) {
    background-color: white;
}

/* Cas des lignes paires : fond gris clair (comme le reste de la ligne) */
#contactsTable tbody tr:nth-child(even) td:nth-child(-n+4) {
    background-color: #f8f9fa;
}

/* Cas du survol de N'IMPORTE QUELLE ligne : fond gris foncé (comme le reste de la ligne) */
#contactsTable tbody tr:hover td:nth-child(-n+4) {
    background-color: #e9ecef;
}

/* 4. Maintenir la bordure de séparation à droite de la dernière colonne figée */
#contactsTable th:nth-child(4),
#contactsTable td:nth-child(4) {
    border-right: 2px solid #667eea;
}

/* Positions spécifiques pour chaque colonne */
#contactsTable th:nth-child(1),
#contactsTable td:nth-child(1) {
    left: 0px;
}

#contactsTable th:nth-child(2),
#contactsTable td:nth-child(2) {
    left: 50px;
}

#contactsTable th:nth-child(3),
#contactsTable td:nth-child(3) {
    left: 130px;
}

#contactsTable th:nth-child(4),
#contactsTable td:nth-child(4) {
    left: 270px;
    border-right: 2px solid #667eea; /* Bordure pour marquer la fin des colonnes figées */
}

/* Maintenir le background des entêtes */
#contactsTable thead th:nth-child(-n+4) {
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
    z-index: 15;
}

/* Ombre pour séparer visuellement */
#contactsTable th:nth-child(4)::after,
#contactsTable td:nth-child(4)::after {
    content: '';
    position: absolute;
    top: 0;
    right: -3px;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to right, rgba(102, 126, 234, 0.3), transparent);
    pointer-events: none;
}

/* Responsive - Désactiver sur mobile */
@media (max-width: 768px) {
    #contactsTable th:nth-child(-n+4),
    #contactsTable td:nth-child(-n+4) {
        position: static;
    }
    
    #contactsTable th:nth-child(4)::after,
    #contactsTable td:nth-child(4)::after {
        display: none;
    }
}
/* =================================================================== */
/* STYLES POUR LES LIENS QUANTUM LIFESTYLE                            */
/* À AJOUTER À LA FIN DU FICHIER STYLES.CSS                           */
/* =================================================================== */

/* Style pour les liens de connexion Quantum dans le tableau */
#contactsTable a[onclick*="openQuantumLogin"] {
    color: #667eea !important;
    text-decoration: none;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 5px;
    transition: all 0.3s ease;
    display: inline-block;
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.2);
}

#contactsTable a[onclick*="openQuantumLogin"]:hover {
    background: rgba(102, 126, 234, 0.2);
    border-color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    text-decoration: none;
}

#contactsTable a[onclick*="openQuantumLogin"]:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(102, 126, 234, 0.2);
}

/* Style pour les IDs sans mot de passe (non cliquables) */
#contactsTable span[title*="mot de passe manquant"] {
    color: #999 !important;
    font-style: italic;
    padding: 4px 8px;
    background: rgba(153, 153, 153, 0.1);
    border-radius: 5px;
    border: 1px dashed rgba(153, 153, 153, 0.3);
}

/* Animation pour indiquer le clic */
@keyframes clickPulse {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

#contactsTable a[onclick*="openQuantumLogin"]:active {
    animation: clickPulse 0.2s ease;
}

/* Responsive - adapter sur mobile */
@media (max-width: 768px) {
    #contactsTable a[onclick*="openQuantumLogin"] {
        padding: 2px 4px;
        font-size: 12px;
    }
}
/* === STYLES EAU-VIVANTE === */
.source-selector {
    animation: fadeIn 0.5s ease;
}

.source-selector select {
    background: white;
    color: #333;
    font-weight: 500;
    transition: all 0.3s ease;
}

.source-selector select:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.source-selector select:focus {
    outline: none;
    border-color: #00acc1;
    box-shadow: 0 0 0 3px rgba(0, 172, 193, 0.2);
}

/* Style pour les boutons eau-vivante */
.btn-eau-vivante {
    background: linear-gradient(135deg, #00acc1, #5ddef4);
    color: white;
}

.btn-eau-vivante:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 172, 193, 0.4);
}

/* Badge eau-vivante */
.badge-eau-vivante {
    background: linear-gradient(135deg, #00acc1, #5ddef4);
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
}

/* Adaptation des cartes stats pour eau-vivante */
.stat-card.eau-vivante {
    background: linear-gradient(135deg, #00acc1, #5ddef4);
}

.stat-card.eau-vivante:hover {
    box-shadow: 0 10px 25px rgba(0, 172, 193, 0.4);
}

/* Animation de changement de source */
@keyframes sourceSwitch {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

.table-container.switching {
    animation: sourceSwitch 0.3s ease;
}
/* Styles pour les boîtes d'information de format */
.format-info-box {
    transition: all 0.3s ease;
    animation: fadeIn 0.5s ease;
}

.format-info-box code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    word-break: break-all;
}

.format-info-box h3 {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Animation de changement */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* === SÉLECTEUR DE SOURCE AMÉLIORÉ === */
.source-selector-container {
    margin-top: 20px;
    padding: 15px 30px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    animation: slideDown 0.5s ease;
}

.source-selector-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
}

.source-indicator {
    display: flex;
    align-items: center;
    gap: 20px;
}

.source-label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.source-toggle-group {
    display: flex;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 30px;
    padding: 4px;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.source-toggle-btn {
    padding: 8px 20px;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    border-radius: 25px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 2;
}

.source-toggle-btn:hover {
    color: white;
}

.source-toggle-btn.active {
    background: white;
    color: #667eea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.source-toggle-btn.active.eau-vivante {
    color: #00acc1;
}

.source-mini-logo {
    height: 18px;
    width: auto;
    object-fit: contain;
}

/* Animation de bascule */
@keyframes slideSwitch {
    0% { transform: translateX(0); }
    100% { transform: translateX(100%); }
}

/* Responsive */
@media (max-width: 768px) {
    .source-selector-container {
        padding: 10px 15px;
    }
    
    .source-indicator {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .source-toggle-group {
        width: 100%;
        justify-content: center;
    }
    
    .source-label {
        font-size: 12px;
    }
    
    .source-toggle-btn {
        padding: 6px 15px;
        font-size: 13px;
        flex: 1;
    }
}
/* Infobulles personnalisées pour l'historique */
td[title] {
    position: relative;
    cursor: help;
}

td[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 14px;
    white-space: pre-wrap;
    max-width: 400px;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.2s ease;
}

td[title]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    z-index: 1001;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(5px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Styles pour l'onglet Telegram */
#telegram-tab .fab.fa-telegram {
    color: #0088cc;
}

.telegram-connection-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.telegram-connection-item:hover {
    box-shadow: 0 2px 8px rgba(0,136,204,0.1);
    border-color: #0088cc;
}

.telegram-format-btn {
    padding: 6px 12px;
    background: white;
    border: 1px solid #0088cc;
    color: #0088cc;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.telegram-format-btn:hover {
    background: #0088cc;
    color: white;
}

/* Animation pour les nouveaux messages Telegram */
@keyframes telegramPulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.telegram-new-message {
    animation: telegramPulse 1s ease-in-out;
}
#admin-blacklist table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}
#admin-blacklist th, #admin-blacklist td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}
#admin-blacklist th {
    background: #f8f9fa;
    font-weight: bold;
    color: #333;
}
#admin-blacklist tr:hover {
    background: #f1f3f5;
}
#admin-blacklist .btn-small {
    padding: 6px 12px;
    font-size: 14px;
}