/* ==================== VARIABLES ET RESET ==================== */
:root {
    /* Couleurs principales */
    --primary-color: #ff6b8b;
    --primary-dark: #ff3b68;
    --primary-light: #ff9eb2;
    --secondary-color: #6a11cb;
    --secondary-dark: #4d0c9a;
    --secondary-light: #9d4edd;
    
    /* Couleurs de statut */
    --success-color: #4CAF50;
    --success-light: #d4edda;
    --warning-color: #FF9800;
    --warning-light: #fff3cd;
    --danger-color: #F44336;
    --danger-light: #f8d7da;
    --info-color: #2196F3;
    --info-light: #d1ecf1;
    
    /* Couleurs neutres */
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    
    /* Ombres */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px rgba(0,0,0,0.1);
    
    /* Bordures */
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Breakpoints (en pixels) */
    --mobile: 480px;
    --tablet: 768px;
    --desktop: 1024px;
    --widescreen: 1200px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--gray-800);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==================== TYPOGRAPHIE RESPONSIVE ==================== */
h1 { font-size: clamp(1.8rem, 5vw, 2.5rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2rem); }
h3 { font-size: clamp(1.3rem, 3.5vw, 1.75rem); }
h4 { font-size: clamp(1.2rem, 3vw, 1.5rem); }
h5 { font-size: clamp(1.1rem, 2.5vw, 1.25rem); }
h6 { font-size: clamp(1rem, 2vw, 1.1rem); }

p {
    font-size: clamp(0.9rem, 2vw, 1rem);
    margin-bottom: 1rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

/* ==================== LAYOUT RESPONSIVE ==================== */
.container {
    width: 100%;
    max-width: var(--widescreen);
    margin: 0 auto;
    padding: 0 clamp(1rem, 3vw, 2rem);
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: -0.5rem;
}

.col {
    flex: 1 1 300px;
    padding: 0.5rem;
    min-width: 280px;
}

/* Grilles responsives */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
    gap: clamp(1rem, 2vw, 1.5rem);
}

/* ==================== CARTES RESPONSIVES ==================== */
.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    padding: clamp(1rem, 3vw, 1.5rem);
    margin-bottom: 1.5rem;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    border: 1px solid var(--gray-200);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--gray-200);
}

.card-title {
    font-size: clamp(1.1rem, 2.5vw, 1.25rem);
    color: var(--dark-color);
    margin: 0;
    word-break: break-word;
}

.card-body {
    padding: 0;
}

/* ==================== BOUTONS RESPONSIVES ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: clamp(0.9rem, 2vw, 1rem);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    gap: 0.5rem;
    white-space: nowrap;
}

.btn i {
    font-size: 1.1em;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--secondary-dark) 100%);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, var(--secondary-dark) 0%, var(--secondary-color) 100%);
    transform: translateY(-2px);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #45a049;
    transform: translateY(-2px);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #d32f2f;
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Adaptation mobile des boutons */
@media (max-width: 768px) {
    .btn {
        padding: 0.6rem 1.2rem;
    }
    
    .btn-block-mobile {
        width: 100%;
    }
}

/* ==================== FORMULAIRES RESPONSIVES ==================== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--gray-700);
    font-size: clamp(0.9rem, 2vw, 1rem);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius-sm);
    font-size: clamp(0.9rem, 2vw, 1rem);
    transition: border-color var(--transition-fast);
    background: white;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 139, 0.1);
}

.form-control.is-invalid {
    border-color: var(--danger-color);
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(244, 67, 54, 0.1);
}

.invalid-feedback {
    display: block;
    margin-top: 0.5rem;
    color: var(--danger-color);
    font-size: 0.875rem;
}

.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius-sm);
    font-size: clamp(0.9rem, 2vw, 1rem);
    background: white;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

/* ==================== TABLEAUX RESPONSIVES ==================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px; /* Force le scroll sur mobile */
}

.table th,
.table td {
    padding: clamp(0.75rem, 2vw, 1rem);
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
    font-size: clamp(0.85rem, 2vw, 0.95rem);
}

.table th {
    background-color: var(--gray-100);
    font-weight: 600;
    color: var(--gray-700);
    white-space: nowrap;
}

.table tbody tr:hover {
    background-color: var(--gray-100);
}

.table-striped tbody tr:nth-child(odd) {
    background-color: var(--gray-50);
}

/* Version mobile alternative */
@media (max-width: 768px) {
    .table-card {
        border: 1px solid var(--gray-200);
        border-radius: var(--border-radius);
        margin-bottom: 1rem;
    }
    
    .table-card-item {
        padding: 1rem;
        border-bottom: 1px solid var(--gray-200);
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .table-card-item:last-child {
        border-bottom: none;
    }
    
    .table-card-label {
        font-weight: 600;
        color: var(--gray-700);
        font-size: 0.9rem;
    }
    
    .table-card-value {
        font-size: 1rem;
    }
}

/* ==================== BADGES RESPONSIVES ==================== */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 50px;
    text-align: center;
    white-space: nowrap;
    line-height: 1.5;
}

.badge-primary {
    background-color: var(--primary-light);
    color: var(--primary-dark);
}

.badge-secondary {
    background-color: var(--secondary-light);
    color: var(--secondary-dark);
}

.badge-success {
    background-color: var(--success-light);
    color: var(--success-color);
}

.badge-warning {
    background-color: var(--warning-light);
    color: var(--warning-color);
}

.badge-danger {
    background-color: var(--danger-light);
    color: var(--danger-color);
}

.badge-info {
    background-color: var(--info-light);
    color: var(--info-color);
}

/* Badges de sévérité */
.badge-severity-low {
    background-color: #d4edda;
    color: #155724;
}

.badge-severity-medium {
    background-color: #fff3cd;
    color: #856404;
}

.badge-severity-high {
    background-color: #f8d7da;
    color: #721c24;
}

/* Adaptation mobile */
@media (max-width: 480px) {
    .badge {
        padding: 0.2rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* ==================== GRILLE DE BADGES RESPONSIVE ==================== */
.badge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr));
    gap: clamp(1rem, 2vw, 1.5rem);
    margin-top: 1.5rem;
}

.badge-item {
    background: white;
    border-radius: 15px;
    padding: clamp(1rem, 3vw, 1.5rem);
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    border: 2px solid #e0e0e0;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.badge-item.earned {
    border-color: #ff6b6b;
    background: linear-gradient(135deg, #fff5f5, #ffffff);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.2);
}

.badge-icon {
    font-size: clamp(2rem, 5vw, 3rem);
    color: #ccc;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.badge-item.earned .badge-icon {
    color: #ff6b6b;
    transform: scale(1.1);
}

.badge-name {
    font-weight: 600;
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    color: #333;
    margin-bottom: 0.5rem;
    word-break: break-word;
}

.badge-description {
    margin-bottom: 1rem;
    position: relative;
    width: 100%;
}

.badge-description small {
    color: #666;
    font-size: clamp(0.75rem, 2vw, 0.85rem);
    line-height: 1.4;
    display: block;
    margin-bottom: 0.5rem;
}

.badge-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    width: 180px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    pointer-events: none;
}

.badge-tooltip:after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #333;
}

.badge-description:hover .badge-tooltip {
    opacity: 1;
    visibility: visible;
    bottom: calc(100% + 10px);
}

.badge-progress {
    background: #f5f5f5;
    border-radius: 10px;
    height: 6px;
    margin-top: 10px;
    position: relative;
    overflow: hidden;
    width: 100%;
}

.badge-progress .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #ffd166, #ff6b6b);
    border-radius: 10px;
    transition: width 0.5s ease;
}

.badge-progress span {
    position: absolute;
    right: 0;
    top: -20px;
    font-size: 0.75rem;
    color: #666;
}

.badge-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.15);
}

/* Adaptation mobile des badges */
@media (max-width: 768px) {
    .badge-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }
    
    .badge-tooltip {
        display: none; /* Pas de tooltip sur mobile */
    }
}

@media (max-width: 480px) {
    .badge-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .badge-item {
        padding: 0.75rem;
    }
    
    .badge-icon {
        font-size: 1.8rem;
        margin-bottom: 0.5rem;
    }
    
    .badge-name {
        font-size: 0.9rem;
    }
    
    .badge-description small {
        font-size: 0.7rem;
    }
}

/* ==================== ALERTES RESPONSIVES ==================== */
.alert {
    padding: clamp(0.75rem, 2vw, 1rem) clamp(1rem, 3vw, 1.5rem);
    border-radius: var(--border-radius-sm);
    margin-bottom: 1.5rem;
    border: 1px solid transparent;
    font-size: clamp(0.9rem, 2vw, 1rem);
    word-break: break-word;
}

.alert-success {
    background-color: var(--success-light);
    border-color: #c3e6cb;
    color: var(--success-color);
}

.alert-warning {
    background-color: var(--warning-light);
    border-color: #ffeeba;
    color: var(--warning-color);
}

.alert-danger {
    background-color: var(--danger-light);
    border-color: #f5c6cb;
    color: var(--danger-color);
}

.alert-info {
    background-color: var(--info-light);
    border-color: #bee5eb;
    color: var(--info-color);
}

/* ==================== NAVIGATION RESPONSIVE ==================== */
.navbar {
    background: white;
    box-shadow: var(--shadow-sm);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: var(--widescreen);
    margin: 0 auto;
    padding: 0 clamp(1rem, 3vw, 2rem);
    gap: 1rem;
}

.navbar-brand {
    display: flex;
    align-items: center;
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    white-space: nowrap;
}

.navbar-brand i {
    margin-right: 0.5rem;
    font-size: 1.2em;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: clamp(0.5rem, 2vw, 1.5rem);
    flex-wrap: wrap;
}

.nav-link {
    color: var(--gray-700);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
    font-size: clamp(0.9rem, 2vw, 1rem);
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--primary-color);
    background-color: var(--gray-100);
}

.nav-link.active {
    color: var(--primary-color);
    background-color: var(--primary-light);
}

/* Menu mobile */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-700);
    padding: 0.5rem;
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    .navbar-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        box-shadow: var(--shadow-lg);
        border-top: 1px solid var(--gray-200);
        z-index: 999;
    }
    
    .navbar-menu.active {
        display: flex;
    }
    
    .nav-link {
        padding: 0.75rem 1rem;
        text-align: center;
        width: 100%;
    }
    
    .user-menu {
        width: 100%;
        text-align: center;
        padding: 0.75rem 1rem;
    }
}

/* ==================== SIDEBAR RESPONSIVE ==================== */
.sidebar {
    width: 250px;
    background: white;
    min-height: calc(100vh - 70px);
    box-shadow: var(--shadow-md);
    position: fixed;
    left: 0;
    top: 70px;
    padding: 2rem 0;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-item {
    margin-bottom: 0.5rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--gray-700);
    text-decoration: none;
    transition: all var(--transition-fast);
    border-left: 4px solid transparent;
    font-size: 0.95rem;
}

.sidebar-link:hover {
    background-color: var(--gray-100);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.sidebar-link.active {
    background-color: var(--primary-light);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.sidebar-link i {
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

/* Adaptation responsive */
@media (max-width: 992px) {
    .sidebar {
        width: 200px;
    }
    
    .sidebar-link {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 250px;
        z-index: 999;
        top: 0;
        height: 100vh;
        padding-top: 80px;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 998;
    }
    
    .sidebar-backdrop.active {
        display: block;
    }
}

/* ==================== CONTENU PRINCIPAL RESPONSIVE ==================== */
.main-content {
    margin-left: 250px;
    padding: clamp(1rem, 3vw, 2rem);
    min-height: calc(100vh - 70px);
    transition: margin-left 0.3s ease;
}

@media (max-width: 992px) {
    .main-content {
        margin-left: 200px;
    }
}

@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--gray-200);
}

.page-header h1 {
    margin-bottom: 0;
    word-break: break-word;
}

/* ==================== STATISTIQUES RESPONSIVES ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
    gap: clamp(1rem, 2vw, 1.5rem);
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: var(--border-radius);
    padding: clamp(1rem, 3vw, 1.5rem);
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-normal);
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: clamp(50px, 10vw, 60px);
    height: clamp(50px, 10vw, 60px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    flex-shrink: 0;
}

.stat-icon-primary {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
    color: white;
}

.stat-icon-success {
    background: linear-gradient(135deg, #a8e6cf 0%, var(--success-color) 100%);
    color: white;
}

.stat-icon-warning {
    background: linear-gradient(135deg, #ffd3b6 0%, var(--warning-color) 100%);
    color: white;
}

.stat-icon-danger {
    background: linear-gradient(135deg, #ffaaa5 0%, var(--danger-color) 100%);
    color: white;
}

.stat-content {
    min-width: 0; /* Pour permettre le texte long */
}

.stat-content h3 {
    font-size: clamp(1.5rem, 4vw, 2rem);
    margin-bottom: 0.25rem;
    color: var(--dark-color);
    line-height: 1.2;
    word-break: break-word;
}

.stat-content p {
    color: var(--gray-600);
    margin: 0;
    font-size: clamp(0.85rem, 2vw, 0.95rem);
    word-break: break-word;
}

@media (max-width: 480px) {
    .stat-card {
        flex-direction: column;
        text-align: center;
    }
    
    .stat-icon {
        margin-bottom: 0.5rem;
    }
}

/* ==================== RÈGLES RESPONSIVES ==================== */
.rule-card {
    background: white;
    border-radius: var(--border-radius);
    padding: clamp(1rem, 3vw, 1.5rem);
    margin-bottom: 1rem;
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
}

.rule-card:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
}

.rule-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.rule-title {
    font-size: clamp(1.1rem, 2.5vw, 1.25rem);
    color: var(--dark-color);
    margin: 0;
    word-break: break-word;
}

.rule-category {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: var(--gray-100);
    color: var(--gray-700);
    border-radius: 50px;
    font-size: 0.875rem;
    white-space: nowrap;
}

.rule-description {
    color: var(--gray-600);
    margin-bottom: 1rem;
    word-break: break-word;
}

.rule-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

@media (max-width: 480px) {
    .rule-header {
        flex-direction: column;
    }
    
    .rule-category {
        align-self: flex-start;
    }
}

/* ==================== FILTRES RESPONSIVES ==================== */
.filter-bar {
    background: white;
    border-radius: var(--border-radius);
    padding: clamp(0.75rem, 2vw, 1rem) clamp(1rem, 3vw, 1.5rem);
    margin-bottom: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 auto;
    min-width: 200px;
}

.filter-group .form-select,
.filter-group .form-control {
    min-width: 150px;
}

@media (max-width: 768px) {
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-group .form-select,
    .filter-group .form-control {
        width: 100%;
    }
}

/* ==================== UTILITAIRES RESPONSIVES ==================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

/* Marges responsives */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mt-5 { margin-top: 3rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mb-5 { margin-bottom: 3rem; }

/* Padding responsifs */
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }
.p-5 { padding: 3rem; }

/* Flex utilities */
.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

/* Display utilities */
.d-none { display: none; }
.d-block { display: block; }

/* Responsive display */
@media (max-width: 768px) {
    .d-none-mobile { display: none; }
    .d-block-mobile { display: block; }
    .text-center-mobile { text-align: center; }
}

@media (min-width: 769px) {
    .d-none-desktop { display: none; }
    .d-block-desktop { display: block; }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

.slide-in {
    animation: slideIn 0.5s ease;
}

/* ==================== IMPRESSION ==================== */
@media print {
    .navbar,
    .sidebar,
    .btn,
    .no-print {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
        padding: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        break-inside: avoid;
    }
}