:root {
    --primary: #2c3e50;
    --success: #27ae60;
    --danger: #e74c3c;
    --warning: #f39c12;
    --info: #3498db;
    --light: #f0f2f5;
    --dark: #1e293b;
    --border: #e2e8f0;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--light);
    padding: 20px;
    color: #333;
    margin: 0;
}

.container {
    max-width: 1300px;
    margin: auto;
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* --- TITRE --- */
h1 {
    text-align: center;
    color: var(--primary);
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

/* --- DASHBOARD & CARTES --- */
.dashboard {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.card {
    flex: 1;
    min-width: 200px;
    padding: 20px;
    border-radius: 8px;
    color: white;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    transition: transform 0.2s;
}

.card:hover { transform: translateY(-5px); }
.card.total { background: var(--primary); }
.card.safe { background: var(--success); }
.card.warn-card { background: var(--warning); }
.card.expired { background: var(--danger); animation: blink 1.5s infinite; }

/* --- FORMULAIRE --- */
.form-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 25px;
    background: #f8fafc;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

input, select, .btn-add {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    outline: none;
    font-size: 14px;
}

.btn-add {
    background: var(--success);
    color: white;
    font-weight: bold;
    border: none;
    cursor: pointer;
    transition: 0.2s;
}

.btn-add:hover { background: #219150; }

/* --- BARRE D'OUTILS --- */
.tools-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 20px;
    gap: 15px;
}

.search-wrapper { position: relative; flex: 1; }
.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
}

#searchInput { width: 100%; padding-left: 35px; }

/* --- MENU ACTIONS --- */
.dropdown { position: relative; display: inline-block; }
.btn-dropdown {
    background: var(--dark);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background: white;
    min-width: 220px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
    z-index: 1000;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.dropdown-content a {
    color: #333;
    padding: 12px 16px;
    text-decoration: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
}

.dropdown-content a:hover { background: #f8fafc; color: var(--info); }
.show { display: block !important; }

/* --- TABLEAU & STATUTS --- */
.table-responsive {
    overflow-x: auto;
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--border);
}

table { width: 100%; border-collapse: collapse; background: white; }
th, td { padding: 15px; text-align: left; border-bottom: 1px solid #f1f5f9; }
th { background: #f8fafc; font-size: 0.75rem; text-transform: uppercase; color: #64748b; font-weight: 600; }

.badge-status {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    color: white;
    display: inline-block;
}

.status-valid { background: var(--success); }
.status-warning { background: var(--warning); }
.status-expired { background: var(--danger); }

.badge-transport {
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    text-transform: uppercase;
}

.trans-tourisme { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.trans-personnel { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* --- PAGINATION --- */
.pagination-container {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    padding-bottom: 10px;
}

.page-btn {
    min-width: 35px;
    height: 35px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: white;
    cursor: pointer;
    transition: 0.2s;
}

.page-btn.active { background: var(--info); color: white; border-color: var(--info); }
.page-btn:hover:not(.active) { background: #f1f5f9; }

/* --- HISTORIQUE & MODALES --- */
.history-list { max-height: 400px; overflow-y: auto; padding: 10px; }
.history-item {
    background: #f8fafc;
    border-left: 5px solid var(--info);
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 0 8px 8px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.history-header { display: flex; justify-content: space-between; font-size: 0.9rem; margin-bottom: 5px; }
.history-date { font-weight: bold; color: var(--primary); }

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0; top: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 25px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 25px rgba(0,0,0,0.2);
}

/* Action buttons in rows */
td button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px 8px;
    color: var(--primary);
    transition: 0.2s;
}

td button:hover { color: var(--info); transform: scale(1.1); }

/* --- ANIMATIONS --- */
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }