/**
 * ════════════════════════════════════════════════════════════════
 * ADMIN ANALYTICS DASHBOARD - STYLES COMPLETS v5.0
 * Style identique au News Terminal avec adaptations pour le dashboard
 * ════════════════════════════════════════════════════════════════
 */

/* ════════════════════════════════════════════════════════════════
   VARIABLES & BASE
   ════════════════════════════════════════════════════════════════ */

:root {
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(203, 213, 225, 0.3);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #10b981, #059669);
    --gradient-danger: linear-gradient(135deg, #ef4444, #dc2626);
    --gradient-warning: linear-gradient(135deg, #f59e0b, #d97706);
    --transition-smooth: all 0.3s ease;
}

body.dark-mode {
    --glass-bg: rgba(30, 41, 59, 0.6);
    --glass-border: rgba(100, 116, 139, 0.2);
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
}

/* ════════════════════════════════════════════════════════════════
   GRADIENT TITLES & ELEMENTS
   ════════════════════════════════════════════════════════════════ */

.gradient-title,
.page-title,
.section-title {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
}

.gradient-title i,
.page-title i,
.section-title i {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-subtitle {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-left: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: none;
    -webkit-text-fill-color: currentColor;
}

/* ════════════════════════════════════════════════════════════════
   LOADING SCREEN
   ════════════════════════════════════════════════════════════════ */

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 24px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-content h2 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.loading-content p {
    font-size: 0.95rem;
    opacity: 0.9;
}

/* ════════════════════════════════════════════════════════════════
   HEADER & BUTTONS
   ════════════════════════════════════════════════════════════════ */

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 2px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-right {
    display: flex;
    gap: 12px;
}

.dashboard-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

.dashboard-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 36px rgba(102, 126, 234, 0.6);
}

.dashboard-btn:active {
    transform: translateY(0);
}

.dashboard-btn-export {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
}

.dashboard-btn-export:hover {
    box-shadow: 0 12px 36px rgba(16, 185, 129, 0.6);
}

@media (max-width: 768px) {
    .dashboard-btn .btn-text {
        display: none;
    }
    .dashboard-btn {
        padding: 12px 16px;
    }
}

/* ════════════════════════════════════════════════════════════════
   NAVIGATION PAR ONGLETS (MAIN TABS)
   ════════════════════════════════════════════════════════════════ */

.main-tabs {
    display: flex;
    gap: 8px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    padding: 12px 16px;
    border-radius: 16px;
    margin-bottom: 32px;
    overflow-x: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 2px solid var(--glass-border);
}

.main-tab {
    padding: 12px 24px;
    border: none;
    background: transparent;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    color: var(--text-secondary);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.main-tab:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.main-tab.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.main-tab i {
    font-size: 1.1rem;
}

.tab-section {
    display: none;
}

.tab-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ════════════════════════════════════════════════════════════════
   SECTIONS & CONTAINERS
   ════════════════════════════════════════════════════════════════ */

.section {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    border: 2px solid var(--glass-border);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.section-header-with-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.section-header-collapsible {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 16px 0;
    border-bottom: 2px solid var(--glass-border);
    margin-bottom: 24px;
}

.collapse-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 2px solid var(--glass-border);
    background: transparent;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.collapse-btn:hover {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: transparent;
    transform: scale(1.1);
}

/* ════════════════════════════════════════════════════════════════
   SUBSECTIONS (ANALYTICS SUBSECTIONS)
   ════════════════════════════════════════════════════════════════ */

.analytics-subsection {
    margin-bottom: 32px;
}

.subsection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition-smooth);
    margin-bottom: 16px;
}

.subsection-header:hover {
    background: rgba(102, 126, 234, 0.05);
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.subsection-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.subsection-title i {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subsection-arrow {
    font-size: 1.2rem;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
}

.subsection-content {
    overflow: hidden;
    max-height: 5000px;
    opacity: 1;
    transition: all 0.3s ease;
}

.subsection-content.collapsed {
    max-height: 0;
    opacity: 0;
}

/* ════════════════════════════════════════════════════════════════
   KPI CARDS
   ════════════════════════════════════════════════════════════════ */

.kpis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.kpi-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    border: 2px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 36px rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.kpi-card:hover::before {
    opacity: 1;
}

.kpi-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.kpi-content {
    flex: 1;
}

.kpi-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 900;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
    line-height: 1.2;
}

.kpi-sublabel {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* ════════════════════════════════════════════════════════════════
   DASHBOARD STATS GRID (MENU PRINCIPAL)
   ════════════════════════════════════════════════════════════════ */

.dashboard-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.dashboard-stat-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    border: 2px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: var(--transition-smooth);
}

.dashboard-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 36px rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.dashboard-stat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.dashboard-stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.dashboard-stat-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dashboard-stat-value {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.2;
}

.dashboard-stat-change {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.dashboard-stat-change.positive {
    color: #10b981;
}

.dashboard-stat-change.negative {
    color: #ef4444;
}

/* ════════════════════════════════════════════════════════════════
   CHARTS
   ════════════════════════════════════════════════════════════════ */

.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.chart-wrapper {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    border: 2px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: var(--transition-smooth);
}

.chart-wrapper:hover {
    border-color: #667eea;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.15);
}

.chart-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-title i {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

canvas {
    max-height: 350px;
}

/* ════════════════════════════════════════════════════════════════
   GEOGRAPHIC MAP
   ════════════════════════════════════════════════════════════════ */

.map-wrapper {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    border: 2px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.geo-map {
    width: 100%;
    height: 500px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* ════════════════════════════════════════════════════════════════
   TABLES
   ════════════════════════════════════════════════════════════════ */

.table-wrapper {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    border: 2px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.data-table thead th {
    padding: 16px;
    text-align: left;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: none;
}

.data-table thead th:first-child {
    border-top-left-radius: 12px;
}

.data-table thead th:last-child {
    border-top-right-radius: 12px;
}

.data-table tbody tr {
    background: transparent;
    transition: var(--transition-smooth);
    border-bottom: 1px solid var(--glass-border);
}

.data-table tbody tr:hover {
    background: rgba(102, 126, 234, 0.05);
}

.data-table tbody td {
    padding: 14px 16px;
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* ════════════════════════════════════════════════════════════════
   USERS MANAGEMENT TABLE (avec Actions)
   ════════════════════════════════════════════════════════════════ */

.users-management-table {
    font-size: 0.85rem;
}

.users-management-table tbody tr.banned-row {
    background-color: rgba(239, 68, 68, 0.05);
    opacity: 0.7;
}

body.dark-mode .users-management-table tbody tr.banned-row {
    background-color: rgba(239, 68, 68, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.user-email {
    font-weight: 600;
    color: var(--text-primary);
}

.user-name {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.plan-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.plan-badge.plan-basic {
    background: rgba(6, 182, 212, 0.15);
    color: #0891b2;
}

.plan-badge.plan-pro {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.plan-badge.plan-platinum {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

.status-badge.status-active {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.status-badge.status-inactive {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.status-badge.status-banned {
    background: rgba(239, 68, 68, 0.25);
    color: #dc2626;
    font-weight: 800;
}

.btn-action {
    padding: 6px 14px;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-action.btn-ban {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

.btn-action.btn-ban:hover {
    background: rgba(239, 68, 68, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-action.btn-unban {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.btn-action.btn-unban:hover {
    background: rgba(16, 185, 129, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* ════════════════════════════════════════════════════════════════
   ML PREDICTIONS
   ════════════════════════════════════════════════════════════════ */

.ml-predictions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.prediction-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    border: 2px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 20px;
    align-items: center;
    transition: var(--transition-smooth);
}

.prediction-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 36px rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.prediction-icon {
    font-size: 3rem;
}

.prediction-content h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.prediction-value {
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 8px;
    line-height: 1.2;
}

.prediction-value.success {
    color: #10b981;
}

.prediction-value.danger {
    color: #ef4444;
}

.prediction-detail {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* ════════════════════════════════════════════════════════════════
   PARTICLES BACKGROUND FIX
   ════════════════════════════════════════════════════════════════ */

.particles-background,
#particles-canvas {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: -1 !important;
    pointer-events: none !important;
    opacity: 0.6;
}

body.dark-mode .particles-background,
body.dark-mode #particles-canvas {
    opacity: 0.3;
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE - VERSION AMÉLIORÉE
   ════════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
    .charts-row {
        grid-template-columns: 1fr;
    }
    
    .chart-wrapper {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    /* ========== SECTIONS ========== */
    .section {
        padding: 20px;
    }

    /* ========== TABS ========== */
    .main-tabs {
        padding: 8px;
        gap: 6px;
    }

    .main-tab {
        padding: 10px 16px;
        font-size: 0.85rem;
    }

    /* ========== KPI CARDS ========== */
    .kpis-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .dashboard-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .kpi-icon,
    .dashboard-stat-icon {
        width: 48px;
        height: 48px;
        font-size: 1.4rem;
    }

    .kpi-value,
    .dashboard-stat-value {
        font-size: 1.6rem;
    }

    /* ========== CHARTS - FIX DÉBORDEMENT ========== */
    .charts-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .chart-wrapper {
        padding: 16px;
        max-width: 100%;
        overflow: hidden;
    }
    
    canvas {
        max-width: 100%;
        max-height: 300px;
        width: 100% !important;
        height: auto !important;
    }

    /* ========== TABLES - FIX SCROLL ========== */
    .table-wrapper {
        padding: 16px;
        max-width: 100%;
        overflow: hidden;
    }
    
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }

    .data-table {
        font-size: 0.8rem;
        min-width: 600px;
    }

    .data-table thead th,
    .data-table tbody td {
        padding: 10px 12px;
        white-space: nowrap;
    }
    
    .users-management-table {
        min-width: 1000px;
    }

    /* ========== GEO MAP ========== */
    .geo-map {
        height: 350px;
    }

    /* ========== ML PREDICTIONS ========== */
    .ml-predictions-grid {
        grid-template-columns: 1fr;
    }

    .prediction-card {
        padding: 16px;
    }

    .prediction-icon {
        font-size: 2.5rem;
    }
    
    /* ========== SUBSECTIONS ========== */
    .subsection-header {
        padding: 12px 16px;
    }
    
    .subsection-title {
        font-size: 1rem;
    }
    
    /* ========== FIX SPÉCIFIQUE INTERNAL ANALYTICS & LEADS ========== */
    #internal-analytics .chart-wrapper,
    #internal-analytics .table-wrapper {
        max-width: calc(100vw - 40px);
        overflow: hidden;
    }
    
    #internal-analytics .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    #potential-customers .chart-wrapper,
    #potential-customers .table-wrapper {
        max-width: calc(100vw - 40px);
        overflow: hidden;
    }
    
    #potential-customers .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    #internal-analytics canvas,
    #potential-customers canvas {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
    }
}

@media (max-width: 480px) {
    /* ========== KPI CARDS - 1 COLONNE ========== */
    .kpis-grid,
    .dashboard-stats-grid {
        grid-template-columns: 1fr;
    }

    /* ========== TABS - ICÔNES SEULEMENT ========== */
    .main-tab span {
        display: none;
    }

    .main-tab {
        padding: 10px;
    }

    /* ========== SECTIONS ========== */
    .section {
        padding: 16px;
    }

    /* ========== CHARTS ========== */
    .chart-wrapper {
        padding: 12px;
    }
    
    canvas {
        max-height: 250px;
    }

    /* ========== TABLES ========== */
    .data-table {
        font-size: 0.75rem;
    }
    
    .data-table thead th,
    .data-table tbody td {
        padding: 8px 10px;
    }

    /* ========== USERS TABLE ========== */
    .user-avatar-small {
        width: 28px;
        height: 28px;
    }

    .btn-action {
        padding: 4px 10px;
        font-size: 0.75rem;
    }
    
    /* ========== GEO MAP ========== */
    .geo-map {
        height: 300px;
    }
    
    /* ========== HEADER ========== */
    .section-header-with-actions {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .section-header-with-actions .dashboard-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ════════════════════════════════════════════════════════════════
   SCROLLBAR STYLING
   ════════════════════════════════════════════════════════════════ */

.table-responsive::-webkit-scrollbar,
.main-tabs::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

.table-responsive::-webkit-scrollbar-track,
.main-tabs::-webkit-scrollbar-track {
    background: rgba(203, 213, 225, 0.2);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb,
.main-tabs::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover,
.main-tabs::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2, #667eea);
}

/* ════════════════════════════════════════════════════════════════
   ANIMATIONS ADDITIONNELLES
   ════════════════════════════════════════════════════════════════ */

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.loading-state i {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.kpi-card,
.dashboard-stat-card,
.chart-wrapper,
.table-wrapper {
    animation: slideInUp 0.4s ease;
}

/* ════════════════════════════════════════════════════════════════
   FOOTER
   ════════════════════════════════════════════════════════════════ */

footer {
    margin-top: 40px;
    padding: 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    border-top: 2px solid var(--glass-border);
    border-radius: 16px;
}

footer i {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.cache-stats-card {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
}

.stat-item {
    flex: 1;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 8px;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
}

.stat-value.danger {
    color: #fee;
    animation: pulse 2s infinite;
}

.stat-value.success {
    color: #d1fae5;
}

/* Activity Action Badge */
.action-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    white-space: nowrap;
}

/* ========================================
   PAGINATION CONTROLS
   ======================================== */

.pagination-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: rgba(241, 245, 249, 0.5);
    border-top: 1px solid rgba(203, 213, 225, 0.3);
    border-radius: 0 0 16px 16px;
    margin-top: -1px;
    gap: 16px;
    flex-wrap: wrap;
}

body.dark-mode .pagination-controls {
    background: rgba(15, 23, 42, 0.5);
    border-top-color: rgba(71, 85, 105, 0.3);
}

.pagination-info {
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 600;
}

body.dark-mode .pagination-info {
    color: #94a3b8;
}

.pagination-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-btn {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(203, 213, 225, 0.5);
    background: white;
    color: #64748b;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.dark-mode .pagination-btn {
    background: #1e293b;
    border-color: rgba(71, 85, 105, 0.5);
    color: #94a3b8;
}

.pagination-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-pages {
    display: flex;
    gap: 4px;
}

.pagination-page-btn {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(203, 213, 225, 0.5);
    background: white;
    color: #64748b;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
    font-size: 0.9rem;
}

body.dark-mode .pagination-page-btn {
    background: #1e293b;
    border-color: rgba(71, 85, 105, 0.5);
    color: #94a3b8;
}

.pagination-page-btn:hover {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
}

.pagination-page-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.pagination-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #64748b;
}

body.dark-mode .pagination-selector {
    color: #94a3b8;
}

.pagination-select {
    padding: 6px 12px;
    border: 1px solid rgba(203, 213, 225, 0.5);
    background: white;
    color: #1e293b;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

body.dark-mode .pagination-select {
    background: #1e293b;
    border-color: rgba(71, 85, 105, 0.5);
    color: #e2e8f0;
}

.pagination-select:hover {
    border-color: #667eea;
}

.pagination-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Responsive Pagination */
@media (max-width: 768px) {
    .pagination-controls {
        flex-direction: column;
        gap: 12px;
    }
    
    .pagination-info {
        order: 1;
    }
    
    .pagination-selector {
        order: 2;
    }
    
    .pagination-buttons {
        order: 3;
    }
}

/* ════════════════════════════════════════════════════════════════
   🆕 CHART.JS RESPONSIVE FIX
   ════════════════════════════════════════════════════════════════ */

.chart-wrapper > div {
    position: relative;
    width: 100%;
    max-width: 100%;
}

.chart-wrapper canvas {
    display: block;
    box-sizing: border-box;
    width: 100% !important;
    max-width: 100% !important;
}

@media (max-width: 768px) {
    .chart-wrapper canvas {
        max-height: 300px !important;
        height: auto !important;
    }
}

@media (max-width: 480px) {
    .chart-wrapper canvas {
        max-height: 250px !important;
    }
}

/* ════════════════════════════════════════════════════════════════
   🆕 TABLE SCROLL INDICATOR (MOBILE)
   ════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .table-wrapper {
        position: relative;
    }
    
    .table-responsive::after {
        content: '→ Scroll';
        position: absolute;
        right: 16px;
        top: 50%;
        transform: translateY(-50%);
        background: linear-gradient(135deg, #667eea, #764ba2);
        color: white;
        padding: 4px 12px;
        border-radius: 12px;
        font-size: 0.75rem;
        font-weight: 700;
        pointer-events: none;
        opacity: 0.8;
        animation: scrollPulse 2s infinite;
    }
    
    .table-responsive.scrolled::after {
        display: none;
    }
}

@keyframes scrollPulse {
    0%, 100% {
        opacity: 0.8;
    }
    50% {
        opacity: 0.4;
    }
}

/**
 * ════════════════════════════════════════════════════════════════
 * ADMIN ANALYTICS DASHBOARD - GMAIL MANAGEMENT v6.0
 * Architecture Gmail-like + Responsive PC/Mobile + Image Resizer
 * ════════════════════════════════════════════════════════════════
 */

/* ════════════════════════════════════════════════════════════════
   VARIABLES & BASE
   ════════════════════════════════════════════════════════════════ */

:root {
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(203, 213, 225, 0.3);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #10b981, #059669);
    --gradient-danger: linear-gradient(135deg, #ef4444, #dc2626);
    --gradient-warning: linear-gradient(135deg, #f59e0b, #d97706);
    --transition-smooth: all 0.3s ease;
    --gmail-sidebar-width: 260px;
    --gmail-header-height: 64px;
}

body.dark-mode {
    --glass-bg: rgba(30, 41, 59, 0.6);
    --glass-border: rgba(100, 116, 139, 0.2);
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
}

/* ════════════════════════════════════════════════════════════════
   GRADIENT TITLES & ELEMENTS
   ════════════════════════════════════════════════════════════════ */

.gradient-title,
.page-title,
.section-title {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
}

.gradient-title i,
.page-title i,
.section-title i {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-subtitle {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-left: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: none;
    -webkit-text-fill-color: currentColor;
}

/* ════════════════════════════════════════════════════════════════
   LOADING SCREEN
   ════════════════════════════════════════════════════════════════ */

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 24px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-content h2 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.loading-content p {
    font-size: 0.95rem;
    opacity: 0.9;
}

/* ════════════════════════════════════════════════════════════════
   HEADER & BUTTONS
   ════════════════════════════════════════════════════════════════ */

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 2px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--gmail-header-height);
}

.header-right {
    display: flex;
    gap: 12px;
}

.header-actions-group {
    display: flex;
    gap: 12px;
    align-items: center;
}

.dashboard-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

.dashboard-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 36px rgba(102, 126, 234, 0.6);
}

.dashboard-btn:active {
    transform: translateY(0);
}

.dashboard-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.dashboard-btn-export {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
}

.dashboard-btn-export:hover {
    box-shadow: 0 12px 36px rgba(16, 185, 129, 0.6);
}

/* ════════════════════════════════════════════════════════════════
   🆕 GMAIL-LIKE LAYOUT (3 COLONNES)
   ════════════════════════════════════════════════════════════════ */

.gmail-layout {
    display: grid;
    grid-template-columns: var(--gmail-sidebar-width) 1fr 320px;
    gap: 0;
    height: calc(100vh - var(--gmail-header-height));
    overflow: hidden;
}

.gmail-sidebar {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    border-right: 2px solid var(--glass-border);
    padding: 20px;
    overflow-y: auto;
}

.gmail-main-content {
    background: transparent;
    overflow-y: auto;
    padding: 20px;
}

.gmail-details-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    border-left: 2px solid var(--glass-border);
    padding: 20px;
    overflow-y: auto;
}

/* Si pas de layout Gmail, architecture classique */
#gmail-management:not(.gmail-layout-enabled) .gmail-layout {
    display: block;
}

#gmail-management:not(.gmail-layout-enabled) .gmail-sidebar,
#gmail-management:not(.gmail-layout-enabled) .gmail-details-panel {
    display: none;
}

#gmail-management:not(.gmail-layout-enabled) .gmail-main-content {
    max-width: 100%;
}

/* ════════════════════════════════════════════════════════════════
   NAVIGATION PAR ONGLETS (MAIN TABS)
   ════════════════════════════════════════════════════════════════ */

.main-tabs {
    display: flex;
    gap: 8px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    padding: 12px 16px;
    border-radius: 16px;
    margin-bottom: 32px;
    overflow-x: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 2px solid var(--glass-border);
}

.main-tab {
    padding: 12px 24px;
    border: none;
    background: transparent;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    color: var(--text-secondary);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.main-tab:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.main-tab.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.main-tab i {
    font-size: 1.1rem;
}

.tab-section {
    display: none;
}

.tab-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ════════════════════════════════════════════════════════════════
   SECTIONS & CONTAINERS
   ════════════════════════════════════════════════════════════════ */

.section {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    border: 2px solid var(--glass-border);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.section-header-with-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.section-header-collapsible {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 16px 0;
    border-bottom: 2px solid var(--glass-border);
    margin-bottom: 24px;
}

.collapse-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 2px solid var(--glass-border);
    background: transparent;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.collapse-btn:hover {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: transparent;
    transform: scale(1.1);
}

/* ════════════════════════════════════════════════════════════════
   🚫 MASQUER LES GRAPHES EMAIL CATEGORIES & TOP SENDERS
   ════════════════════════════════════════════════════════════════ */

#gmail-categories-chart,
#gmail-top-senders-body,
.charts-row .chart-wrapper:has(#gmail-categories-chart),
.charts-row .chart-wrapper:has(#gmail-top-senders-body) {
    display: none !important;
}

/* ════════════════════════════════════════════════════════════════
   KPI CARDS
   ════════════════════════════════════════════════════════════════ */

.kpis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.kpi-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    border: 2px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 36px rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.kpi-card:hover::before {
    opacity: 1;
}

.kpi-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.kpi-content {
    flex: 1;
}

.kpi-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 900;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
    line-height: 1.2;
}

.kpi-sublabel {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* ════════════════════════════════════════════════════════════════
   CHARTS
   ════════════════════════════════════════════════════════════════ */

.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.chart-wrapper {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    border: 2px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: var(--transition-smooth);
    max-width: 100%;
    overflow: hidden;
}

.chart-wrapper:hover {
    border-color: #667eea;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.15);
}

.chart-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-title i {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

canvas {
    max-height: 350px;
    max-width: 100%;
    width: 100% !important;
    height: auto !important;
}

/* ════════════════════════════════════════════════════════════════
   TABLES
   ════════════════════════════════════════════════════════════════ */

.table-wrapper {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    border: 2px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    max-width: 100%;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 600px;
}

.data-table thead {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.data-table thead th {
    padding: 16px;
    text-align: left;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: none;
    white-space: nowrap;
}

.data-table thead th:first-child {
    border-top-left-radius: 12px;
}

.data-table thead th:last-child {
    border-top-right-radius: 12px;
}

.data-table tbody tr {
    background: transparent;
    transition: var(--transition-smooth);
    border-bottom: 1px solid var(--glass-border);
}

.data-table tbody tr:hover {
    background: rgba(102, 126, 234, 0.05);
}

.data-table tbody td {
    padding: 14px 16px;
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* ════════════════════════════════════════════════════════════════
   🔍 GMAIL SEARCH BAR
   ════════════════════════════════════════════════════════════════ */

.gmail-search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 2px solid var(--glass-border);
}

.search-input {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    font-size: 1rem;
    transition: var(--transition-smooth);
    background: white;
    color: var(--text-primary);
}

body.dark-mode .search-input {
    background: #0f172a;
    border-color: rgba(102, 126, 234, 0.3);
    color: #f1f5f9;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-search {
    padding: 14px 32px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-smooth);
    font-size: 1rem;
}

.btn-search:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

.btn-search:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ════════════════════════════════════════════════════════════════
   📊 SEARCH RESULTS
   ════════════════════════════════════════════════════════════════ */

.search-results-container {
    margin-bottom: 24px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 2px solid var(--glass-border);
}

.search-result-item {
    padding: 16px;
    border-bottom: 1px solid var(--glass-border);
    transition: var(--transition-smooth);
    cursor: pointer;
    border-radius: 8px;
    margin-bottom: 8px;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: rgba(102, 126, 234, 0.05);
    transform: translateX(4px);
}

.search-result-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.search-result-subject {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    font-size: 1rem;
}

.search-result-snippet {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.email-date {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

/* ════════════════════════════════════════════════════════════════
   📧 GMAIL MODALS (STANDARDISÉS)
   ════════════════════════════════════════════════════════════════ */

.gmail-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
    padding: 20px;
}

.gmail-modal-content {
    background: white;
    border-radius: 24px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

body.dark-mode .gmail-modal-content {
    background: #1e293b;
}

.gmail-modal-large {
    max-width: 1000px;
}

.gmail-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    border-bottom: 2px solid var(--glass-border);
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 24px 24px 0 0;
}

.gmail-modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-close-modal {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    color: white;
    font-size: 1.2rem;
}

.btn-close-modal:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.gmail-modal-body {
    padding: 32px;
    background: white;
}

body.dark-mode .gmail-modal-body {
    background: #1e293b;
}

.gmail-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 24px 32px;
    border-top: 2px solid var(--glass-border);
    background: rgba(248, 250, 252, 0.8);
    border-radius: 0 0 24px 24px;
}

body.dark-mode .gmail-modal-footer {
    background: rgba(15, 23, 42, 0.8);
}

/* ════════════════════════════════════════════════════════════════
   🎨 BOUTONS MODALS STANDARDISÉS
   ════════════════════════════════════════════════════════════════ */

.btn-primary,
.btn-secondary,
.btn-danger,
.btn-success {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    min-width: 120px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.5);
}

.btn-secondary {
    background: rgba(100, 116, 139, 0.1);
    color: var(--text-primary);
    border: 2px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(100, 116, 139, 0.2);
    border-color: #64748b;
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.5);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.5);
}

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-danger:disabled,
.btn-success:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
    min-width: 90px;
}

.btn-action {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.btn-action:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

/* ════════════════════════════════════════════════════════════════
   📝 FORM ELEMENTS
   ════════════════════════════════════════════════════════════════ */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-input,
.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    font-size: 1rem;
    transition: var(--transition-smooth);
    background: white;
    color: var(--text-primary);
}

body.dark-mode .form-input,
body.dark-mode .form-select {
    background: #0f172a;
    border-color: rgba(100, 116, 139, 0.3);
    color: #f1f5f9;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-input[readonly] {
    background: rgba(248, 250, 252, 0.8);
    cursor: not-allowed;
}

body.dark-mode .form-input[readonly] {
    background: rgba(15, 23, 42, 0.5);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ════════════════════════════════════════════════════════════════
   🎨 WYSIWYG EDITOR (Quill.js)
   ════════════════════════════════════════════════════════════════ */

.email-editor {
    min-height: 300px;
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    background: white;
    overflow: hidden;
}

body.dark-mode .email-editor {
    background: #0f172a;
    border-color: rgba(100, 116, 139, 0.3);
}

.ql-toolbar {
    border-radius: 12px 12px 0 0 !important;
    background: rgba(248, 250, 252, 0.8) !important;
    border-color: var(--glass-border) !important;
}

body.dark-mode .ql-toolbar {
    background: rgba(15, 23, 42, 0.8) !important;
    border-color: rgba(100, 116, 139, 0.3) !important;
}

.ql-container {
    border-radius: 0 0 12px 12px !important;
    font-size: 1rem !important;
    border-color: var(--glass-border) !important;
}

body.dark-mode .ql-container {
    border-color: rgba(100, 116, 139, 0.3) !important;
}

.ql-editor {
    min-height: 250px;
    color: var(--text-primary);
}

/* ════════════════════════════════════════════════════════════════
   🖼 IMAGE RESIZE CONTROLS - VERSION OVERLAY CORRIGÉE
   ════════════════════════════════════════════════════════════════ */

.image-resize-controls-overlay {
    position: fixed !important;
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
    padding: 12px 20px !important;
    border-radius: 28px !important;
    display: flex !important;
    gap: 14px !important;
    align-items: center !important;
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.6), 
                0 0 0 1px rgba(255, 255, 255, 0.2) inset !important;
    z-index: 999999 !important;
    animation: popIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55) !important;
    backdrop-filter: blur(10px) !important;
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(20px) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

.img-resize-btn {
    background: rgba(255, 255, 255, 0.25) !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    color: white !important;
    font-weight: 700 !important;
    font-size: 16px !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.img-resize-btn:hover {
    background: rgba(255, 255, 255, 0.4) !important;
    transform: scale(1.15) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25) !important;
}

.img-resize-btn:active {
    transform: scale(0.95) !important;
}

.img-resize-input {
    width: 85px !important;
    padding: 8px 12px !important;
    border: 2px solid rgba(255, 255, 255, 0.4) !important;
    border-radius: 10px !important;
    background: rgba(255, 255, 255, 0.25) !important;
    color: white !important;
    font-weight: 700 !important;
    text-align: center !important;
    font-size: 15px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) inset !important;
}

.img-resize-input:focus {
    outline: none !important;
    background: rgba(255, 255, 255, 0.35) !important;
    border-color: rgba(255, 255, 255, 0.6) !important;
}

.img-resize-input::placeholder {
    color: rgba(255, 255, 255, 0.7) !important;
}

.img-resize-label {
    color: white !important;
    font-weight: 700 !important;
    font-size: 15px !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

/* Image sélectionnée dans Quill */
.ql-editor img {
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    border: 3px solid transparent !important;
    border-radius: 8px !important;
    max-width: 100% !important;
    height: auto !important;
}

.ql-editor img:hover {
    border-color: rgba(102, 126, 234, 0.4) !important;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3) !important;
    transform: scale(1.02) !important;
}

.ql-editor img.img-selected {
    border-color: #764ba2 !important;
    box-shadow: 0 8px 32px rgba(118, 75, 162, 0.6) !important;
    animation: imageSelect 0.3s ease !important;
}

@keyframes imageSelect {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .image-resize-controls-overlay {
        padding: 10px 16px !important;
        gap: 10px !important;
    }
    
    .img-resize-btn {
        width: 36px !important;
        height: 36px !important;
        font-size: 14px !important;
    }
    
    .img-resize-input {
        width: 70px !important;
        font-size: 14px !important;
        padding: 6px 10px !important;
    }
    
    .img-resize-label {
        font-size: 14px !important;
    }
}

@media (max-width: 480px) {
    .image-resize-controls-overlay {
        padding: 8px 12px !important;
        gap: 8px !important;
    }
    
    .img-resize-btn {
        width: 32px !important;
        height: 32px !important;
        font-size: 12px !important;
    }
    
    .img-resize-input {
        width: 60px !important;
        font-size: 12px !important;
        padding: 5px 8px !important;
    }
}

/* ════════════════════════════════════════════════════════════════
   📎 ATTACHMENTS
   ════════════════════════════════════════════════════════════════ */

.attachments-list {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.attachment-item {
    background: rgba(102, 126, 234, 0.05);
    padding: 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 2px solid rgba(102, 126, 234, 0.2);
    transition: var(--transition-smooth);
}

.attachment-item:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: #667eea;
}

.attachment-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.attachment-info i {
    color: #667eea;
    font-size: 1.2rem;
}

.attachment-size {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    margin-left: auto;
}

.btn-remove-attachment,
.btn-download {
    background: transparent;
    border: 2px solid var(--glass-border);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    color: var(--text-secondary);
}

.btn-remove-attachment:hover {
    background: #ef4444;
    color: white;
    border-color: transparent;
}

.btn-download:hover {
    background: #667eea;
    color: white;
    border-color: transparent;
}

/* ════════════════════════════════════════════════════════════════
   💾 DRAFTS
   ════════════════════════════════════════════════════════════════ */

.drafts-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.draft-item {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition-smooth);
    border-left: 4px solid #8b5cf6;
}

.draft-item:hover {
    border-color: #8b5cf6;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
    transform: translateX(4px);
}

.draft-info {
    flex: 1;
}

.draft-subject {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-size: 1rem;
}

.draft-to {
    font-size: 0.85rem;
    color: #8b5cf6;
    margin-bottom: 4px;
}

.draft-snippet {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.draft-actions {
    display: flex;
    gap: 8px;
}

/* ════════════════════════════════════════════════════════════════
   👁 EMAIL DETAILS VIEW
   ════════════════════════════════════════════════════════════════ */

.email-details-header {
    background: rgba(102, 126, 234, 0.05);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    border: 2px solid rgba(102, 126, 234, 0.2);
}

.detail-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    padding: 8px 0;
    border-bottom: 1px solid var(--glass-border);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row strong {
    color: var(--text-secondary);
    font-weight: 700;
}

.detail-row span {
    color: var(--text-primary);
}

.email-body-content {
    padding: 20px;
    background: rgba(248, 250, 252, 0.5);
    border-radius: 12px;
    margin-bottom: 24px;
    min-height: 200px;
    line-height: 1.7;
    color: var(--text-primary);
}

body.dark-mode .email-body-content {
    background: rgba(15, 23, 42, 0.5);
}

.email-attachments-section h4 {
    margin-bottom: 12px;
    color: var(--text-primary);
    font-weight: 700;
}

/* ════════════════════════════════════════════════════════════════
   ✍ SIGNATURE MANAGEMENT
   ════════════════════════════════════════════════════════════════ */

.signatures-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.signature-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    border-radius: 12px;
    padding: 20px;
    border: 2px solid var(--glass-border);
    transition: var(--transition-smooth);
}

.signature-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.signature-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--glass-border);
}

.signature-header i {
    color: #667eea;
    font-size: 1.2rem;
}

.signature-header strong {
    color: var(--text-primary);
    font-size: 1rem;
}

.signature-email {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    margin-left: auto;
}

.signature-preview {
    min-height: 100px;
    padding: 12px;
    background: rgba(248, 250, 252, 0.5);
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.6;
    overflow-x: auto;
}

body.dark-mode .signature-preview {
    background: rgba(15, 23, 42, 0.5);
}

/* ════════════════════════════════════════════════════════════════
   🆕 SIGNATURE EDITOR MODAL
   ════════════════════════════════════════════════════════════════ */

.signature-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--glass-border);
    overflow-x: auto;
    padding-bottom: 8px;
}

.signature-tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 700;
    color: var(--text-secondary);
    transition: var(--transition-smooth);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.signature-tab:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.signature-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.signature-tab i {
    font-size: 1.1rem;
}

.signature-editor-container {
    margin-bottom: 24px;
}

.signature-editor-container label {
    font-weight: 700;
    margin-bottom: 12px;
    display: block;
    color: var(--text-primary);
    font-size: 1rem;
}

#current-signature-email {
    color: #667eea;
    font-weight: 800;
}

.signature-templates {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 2px solid var(--glass-border);
}

.signature-templates h4 {
    margin-bottom: 16px;
    color: var(--text-primary);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.template-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

/* ════════════════════════════════════════════════════════════════
   PARTICLES BACKGROUND FIX
   ════════════════════════════════════════════════════════════════ */

.particles-background,
#particles-canvas {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: -1 !important;
    pointer-events: none !important;
    opacity: 0.6;
}

body.dark-mode .particles-background,
body.dark-mode #particles-canvas {
    opacity: 0.3;
}

/* ════════════════════════════════════════════════════════════════
   🎨 ANIMATIONS
   ════════════════════════════════════════════════════════════════ */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        transform: translateY(40px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* ════════════════════════════════════════════════════════════════
   📱 RESPONSIVE - PC & MOBILE 100%
   ════════════════════════════════════════════════════════════════ */

/* TABLETTE (1024px) */
@media (max-width: 1024px) {
    .gmail-layout {
        grid-template-columns: 1fr;
    }
    
    .gmail-sidebar,
    .gmail-details-panel {
        display: none;
    }
    
    .charts-row {
        grid-template-columns: 1fr;
    }
    
    .kpis-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* MOBILE (768px) */
@media (max-width: 768px) {
    /* ===== SECTIONS ===== */
    .section {
        padding: 20px;
        margin-bottom: 20px;
    }

    /* ===== HEADER ===== */
    .top-header {
        padding: 16px;
        height: auto;
    }
    
    .header-actions-group {
        flex-wrap: wrap;
    }

    /* ===== TABS ===== */
    .main-tabs {
        padding: 8px;
        gap: 6px;
    }

    .main-tab {
        padding: 10px 16px;
        font-size: 0.85rem;
    }

    /* ===== KPI CARDS ===== */
    .kpis-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .kpi-icon {
        width: 48px;
        height: 48px;
        font-size: 1.4rem;
    }

    .kpi-value {
        font-size: 1.6rem;
    }

    /* ===== SEARCH BAR ===== */
    .gmail-search-bar {
        flex-direction: column;
        padding: 16px;
    }
    
    .btn-search {
        width: 100%;
    }

    /* ===== CHARTS ===== */
    .charts-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .chart-wrapper {
        padding: 16px;
        max-width: 100%;
        overflow: hidden;
    }
    
    canvas {
        max-height: 300px;
    }

    /* ===== TABLES ===== */
    .table-wrapper {
        padding: 16px;
        max-width: 100%;
    }
    
    .table-responsive {
        max-width: 100%;
    }

    .data-table {
        font-size: 0.8rem;
    }

    .data-table thead th,
    .data-table tbody td {
        padding: 10px 12px;
    }

    /* ===== SIGNATURES GRID ===== */
    .signatures-preview-grid {
        grid-template-columns: 1fr;
    }

    /* ===== MODALS ===== */
    .gmail-modal {
        padding: 10px;
    }
    
    .gmail-modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .gmail-modal-header {
        padding: 20px;
    }
    
    .gmail-modal-header h3 {
        font-size: 1.2rem;
    }
    
    .gmail-modal-body {
        padding: 20px;
    }
    
    .gmail-modal-footer {
        padding: 16px;
        flex-wrap: wrap;
    }
    
    .gmail-modal-footer .btn-primary,
    .gmail-modal-footer .btn-secondary,
    .gmail-modal-footer .btn-danger {
        flex: 1;
        min-width: 140px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .email-editor {
        min-height: 200px;
    }
    
    .signature-tabs {
        gap: 4px;
    }
    
    .signature-tab {
        padding: 10px 14px;
        font-size: 0.85rem;
    }
    
    .template-buttons {
        grid-template-columns: 1fr;
    }
}

/* PETIT MOBILE (480px) */
@media (max-width: 480px) {
    /* ===== KPI CARDS 1 COLONNE ===== */
    .kpis-grid {
        grid-template-columns: 1fr;
    }

    /* ===== TABS ICÔNES SEULEMENT ===== */
    .main-tab span {
        display: none;
    }

    .main-tab {
        padding: 10px;
        justify-content: center;
    }

    /* ===== SECTIONS ===== */
    .section {
        padding: 16px;
    }

    /* ===== SEARCH BAR ===== */
    .gmail-search-bar {
        padding: 12px;
    }

    /* ===== CHARTS ===== */
    .chart-wrapper {
        padding: 12px;
    }
    
    canvas {
        max-height: 250px;
    }

    /* ===== TABLES ===== */
    .data-table {
        font-size: 0.75rem;
        min-width: 500px;
    }
    
    .data-table thead th,
    .data-table tbody td {
        padding: 8px 10px;
    }

    /* ===== HEADER ===== */
    .section-header-with-actions {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-actions-group {
        width: 100%;
    }
    
    .dashboard-btn {
        width: 100%;
        justify-content: center;
    }
    
    /* ===== MODALS ===== */
    .gmail-modal-header h3 {
        font-size: 1rem;
    }
    
    .gmail-modal-body {
        padding: 16px;
    }
    
    .gmail-modal-footer {
        padding: 12px;
    }
    
    .btn-primary,
    .btn-secondary,
    .btn-danger {
        font-size: 0.85rem;
        padding: 10px 16px;
    }
    
    .signature-tab {
        font-size: 0;
    }
    
    .signature-tab i {
        margin-right: 0;
        font-size: 1.2rem;
    }
    
    .image-resize-controls {
        flex-direction: column;
        gap: 8px;
        padding: 6px 12px;
    }
}

/* ════════════════════════════════════════════════════════════════
   SCROLLBAR STYLING
   ════════════════════════════════════════════════════════════════ */

.table-responsive::-webkit-scrollbar,
.main-tabs::-webkit-scrollbar,
.signature-tabs::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

.table-responsive::-webkit-scrollbar-track,
.main-tabs::-webkit-scrollbar-track,
.signature-tabs::-webkit-scrollbar-track {
    background: rgba(203, 213, 225, 0.2);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb,
.main-tabs::-webkit-scrollbar-thumb,
.signature-tabs::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover,
.main-tabs::-webkit-scrollbar-thumb:hover,
.signature-tabs::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2, #667eea);
}

/* ════════════════════════════════════════════════════════════════
   PRINT STYLES (BONUS)
   ════════════════════════════════════════════════════════════════ */

@media print {
    .gmail-modal,
    .dashboard-btn,
    .btn-action,
    .particles-background,
    .main-tabs {
        display: none !important;
    }
    
    .section {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* ════════════════════════════════════════════════════════════════
   🖼 IMAGE RESIZE CONTROLS (SIGNATURE EDITOR) - CORRIGÉ
   ════════════════════════════════════════════════════════════════ */

.image-resize-controls {
    position: absolute !important;
    bottom: -50px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
    padding: 10px 16px !important;
    border-radius: 24px !important;
    display: flex !important;
    gap: 12px !important;
    align-items: center !important;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.5) !important;
    z-index: 10000 !important;
    animation: slideUpFade 0.3s ease !important;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.image-resize-btn {
    background: rgba(255, 255, 255, 0.2) !important;
    border: none !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    color: white !important;
    font-weight: 700 !important;
    transition: all 0.3s ease !important;
}

.image-resize-btn:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    transform: scale(1.1) !important;
}

.image-resize-btn:active {
    transform: scale(0.95) !important;
}

.image-size-input {
    width: 80px !important;
    padding: 6px 10px !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 8px !important;
    background: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    font-weight: 600 !important;
    text-align: center !important;
    font-size: 14px !important;
}

.image-size-input:focus {
    outline: none !important;
    background: rgba(255, 255, 255, 0.3) !important;
}

/* Sélecteur d'image dans l'éditeur Quill */
.ql-editor img {
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    border: 3px solid transparent !important;
    border-radius: 8px !important;
}

.ql-editor img:hover {
    border-color: rgba(102, 126, 234, 0.5) !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3) !important;
}

.ql-editor img.selected {
    border-color: #764ba2 !important;
    box-shadow: 0 8px 24px rgba(118, 75, 162, 0.5) !important;
}

/* Assurer que le conteneur Quill permet le positionnement absolu */
.ql-editor p,
.ql-editor div {
    position: relative !important;
}

/* Responsive pour les contrôles */
@media (max-width: 480px) {
    .image-resize-controls {
        padding: 8px 12px !important;
        gap: 8px !important;
        bottom: -45px !important;
    }
    
    .image-resize-btn {
        width: 32px !important;
        height: 32px !important;
    }
    
    .image-size-input {
        width: 60px !important;
        font-size: 12px !important;
        padding: 4px 8px !important;
    }
}

/* ========================================
   PROFILE PICTURES MANAGEMENT
   ======================================== */

.profile-pictures-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.profile-picture-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

body.dark-mode .profile-picture-card {
    background: #1e293b;
    border-color: #334155;
}

.profile-picture-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.profile-picture-preview {
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-picture-info {
    text-align: center;
}

.profile-name {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
}

body.dark-mode .profile-name {
    color: #f8fafc;
}

.profile-email {
    font-size: 13px;
    color: #667eea;
    font-weight: 600;
    margin-bottom: 4px;
}

.profile-title {
    font-size: 12px;
    color: #64748b;
    font-style: italic;
}

.profile-picture-actions {
    width: 100%;
}

.profile-picture-actions .btn-action {
    width: 100%;
    justify-content: center;
}

/* PROFILE PICTURE MODAL */

.profile-picture-editor {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.picture-type-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.picture-type-option {
    position: relative;
    cursor: pointer;
}

.picture-type-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.picture-type-option .option-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
}

body.dark-mode .picture-type-option .option-content {
    background: #1e293b;
    border-color: #334155;
}

.picture-type-option .option-content i {
    font-size: 24px;
}

.picture-type-option input[type="radio"]:checked + .option-content {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    color: #667eea;
}

.picture-type-option:hover .option-content {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.conditional-options {
    padding: 16px;
    background: #f8fafc;
    border-radius: 12px;
    border-left: 4px solid #667eea;
}

body.dark-mode .conditional-options {
    background: #0f172a;
}

/* RESPONSIVE */

@media (max-width: 768px) {
    .profile-pictures-grid {
        grid-template-columns: 1fr;
    }
    
    .picture-type-options {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   🆕 SENT EMAILS SECTION STYLING
   ======================================== */

.sent-email-row {
    transition: background-color 0.2s ease;
}

.sent-email-row:hover {
    background-color: rgba(16, 185, 129, 0.05) !important;
}

.sent-email-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #10b981;
    font-weight: 600;
    font-size: 0.85rem;
}

/* Profile Pictures Grid */
.profile-pictures-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 16px;
}

.profile-picture-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(248, 250, 252, 0.9));
    border: 2px solid rgba(102, 126, 234, 0.1);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.profile-picture-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.profile-picture-preview {
    display: flex;
    justify-content: center;
    align-items: center;
}

.profile-picture-info {
    text-align: center;
}

.profile-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
}

.profile-email {
    font-size: 0.9rem;
    color: #667eea;
    font-weight: 600;
    margin-bottom: 4px;
}

.profile-title {
    font-size: 0.85rem;
    color: #64748b;
}

.profile-picture-actions {
    width: 100%;
}

.picture-type-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 8px;
}

.picture-type-option {
    position: relative;
    cursor: pointer;
}

.picture-type-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.picture-type-option .option-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 600;
    color: #64748b;
}

.picture-type-option input[type="radio"]:checked + .option-content {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: #667eea;
    color: white;
    transform: scale(1.05);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
}

.picture-type-option .option-content i {
    font-size: 1.5rem;
}

.conditional-options {
    margin-top: 16px;
    padding: 16px;
    background: rgba(102, 126, 234, 0.05);
    border-left: 4px solid #667eea;
    border-radius: 8px;
}

/* Image Resize Controls Overlay (CORRIGÉ) */
.image-resize-controls-overlay {
    position: fixed;
    display: flex;
    gap: 12px;
    align-items: center;
    background: linear-gradient(135deg, #667eea, #764ba2);
    padding: 10px 16px;
    border-radius: 24px;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.5);
    z-index: 999999;
    pointer-events: auto;
}

.img-resize-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    font-weight: 700;
    transition: all 0.3s ease;
}

.img-resize-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.img-resize-input {
    width: 80px;
    padding: 6px 10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-weight: 600;
    text-align: center;
    font-size: 14px;
}

.img-resize-input:focus {
    background: rgba(255, 255, 255, 0.3);
    outline: none;
}

.img-resize-label {
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.img-selected {
    outline: 3px solid #667eea;
    outline-offset: 4px;
    border-radius: 8px;
}

/* ════════════════════════════════════════════════════════════════
   📱 EMAIL SIGNATURES MANAGER - FIX DÉFINITIF DÉBORDEMENT MOBILE
   ════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    /* Grid signatures - 1 colonne */
    .signatures-preview-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
        max-width: 100%;
        overflow: hidden;
    }
    
    /* Signature Card - Conteneur principal */
    .signature-card {
        padding: 14px !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }
    
    /* Signature Header - Layout vertical */
    .signature-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 8px;
        padding-bottom: 12px;
        max-width: 100%;
        overflow: hidden;
    }
    
    .signature-header i {
        font-size: 1rem;
        flex-shrink: 0;
    }
    
    .signature-header strong {
        font-size: 0.95rem;
        max-width: 100%;
        word-break: break-word;
        overflow-wrap: break-word;
    }
    
    /* Email badge - Gestion dépassement */
    .signature-email {
        margin-left: 0 !important;
        font-size: 0.75rem !important;
        word-break: break-all !important;
        overflow-wrap: break-word !important;
        color: #667eea;
        background: rgba(102, 126, 234, 0.1);
        padding: 4px 8px;
        border-radius: 8px;
        font-weight: 600;
        max-width: 100% !important;
        display: inline-block;
        box-sizing: border-box;
    }
    
    /* 🔥 SIGNATURE PREVIEW - FIX CRITIQUE */
    .signature-preview {
        font-size: 0.8rem !important;
        padding: 10px !important;
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Forcer tous les enfants à respecter la largeur */
    .signature-preview * {
        max-width: 100% !important;
        word-break: break-word !important;
        overflow-wrap: break-word !important;
        box-sizing: border-box !important;
    }
    
    /* Éléments spécifiques (texte, liens, paragraphes) */
    .signature-preview p,
    .signature-preview div,
    .signature-preview span,
    .signature-preview a,
    .signature-preview strong,
    .signature-preview em {
        max-width: 100% !important;
        overflow-wrap: break-word !important;
        word-wrap: break-word !important;
        word-break: break-word !important;
        hyphens: auto !important;
    }
    
    /* URLs et emails dans la preview */
    .signature-preview a[href*="http"],
    .signature-preview a[href*="mailto"] {
        word-break: break-all !important;
        display: inline-block;
        max-width: 100%;
    }
    
    /* Section header avec actions */
    .section-header-with-actions {
        flex-direction: column;
        align-items: stretch !important;
        gap: 12px;
    }
    
    .section-header-with-actions .btn-primary {
        width: 100%;
        justify-content: center;
    }
    
    /* Loading indicator */
    #signatures-loading-indicator {
        padding: 16px !important;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    /* Petits écrans - Optimisation supplémentaire */
    .signature-card {
        padding: 12px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    .signature-preview {
        font-size: 0.75rem !important;
        padding: 8px !important;
        min-height: 80px;
    }
    
    .signature-header {
        gap: 6px;
        padding-bottom: 10px;
    }
    
    .signature-email {
        font-size: 0.7rem !important;
        padding: 3px 6px;
    }
    
    .chart-title {
        font-size: 0.9rem;
        gap: 6px;
    }
    
    .section-header-with-actions .btn-primary {
        font-size: 0.85rem;
        padding: 10px 14px;
    }
}

/* ════════════════════════════════════════════════════════════════
   🔧 FIX GLOBAL POUR TOUTES LES SECTIONS
   ════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    /* S'assurer que la section parente ne crée pas de débordement */
    .section {
        max-width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
    
    /* Grille parente */
    .signatures-preview-grid {
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* Empêcher tout débordement horizontal */
    body,
    html {
        overflow-x: hidden !important;
    }
}

/* ════════════════════════════════════════════════════════════════
   🎨 AMÉLIORATION VISUELLE (BONUS)
   ════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    /* Hover/Active states pour mobile */
    .signature-card:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    /* Empty state preview */
    .signature-preview em {
        display: block;
        text-align: center;
        padding: 16px 8px;
        font-size: 0.85rem;
        color: #94a3b8;
    }
    
    /* Icônes header - Taille cohérente */
    .signature-header i {
        width: 20px;
        text-align: center;
    }
}

/* ════════════════════════════════════════════════════════════════
   🔍 FIX POUR CONTENU HTML COMPLEXE DANS SIGNATURES
   ════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    /* Tables dans les signatures */
    .signature-preview table {
        width: 100% !important;
        max-width: 100% !important;
        table-layout: fixed !important;
    }
    
    .signature-preview table td,
    .signature-preview table th {
        word-break: break-word !important;
        overflow-wrap: break-word !important;
    }
    
    /* Images dans les signatures */
    .signature-preview img {
        max-width: 100% !important;
        height: auto !important;
        display: block;
    }
    
    /* Logos/avatars */
    .signature-preview img[width] {
        width: auto !important;
        max-width: 60px !important;
    }
}