* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', sans-serif; background: #f0f2f5; color: #333; }

/* LOGIN */
body.login-page { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: #1a3a5c; }
.login-box { background: #fff; padding: 40px; border-radius: 12px; width: 100%; max-width: 420px; box-shadow: 0 8px 32px rgba(0,0,0,0.2); }
.login-logo { font-size: 48px; text-align: center; margin-bottom: 10px; }
.login-logo-img { display: block; width: 100%; max-width: 120px; height: auto; margin: 0 auto 10px; }
.login-box h1 { text-align: center; color: #1a3a5c; font-size: 24px; margin-bottom: 4px; }
.login-subtitle { text-align: center; color: #888; margin-bottom: 24px; font-size: 14px; }

/* NAVBAR */
.navbar { background: #1a3a5c; color: #fff; display: flex; align-items: center; padding: 0 24px; height: 60px; gap: 20px; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.nav-brand { font-weight: 700; font-size: 18px; white-space: nowrap; margin-right: 16px; display: flex; align-items: center; gap: 8px; }
.nav-logo-img { height: 32px; width: auto; }
.nav-links { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav-links a { color: #cce0ff; text-decoration: none; padding: 6px 12px; border-radius: 6px; font-size: 14px; transition: background 0.2s; }
.nav-links a:hover { background: rgba(255,255,255,0.15); color: #fff; }
.nav-user { display: flex; align-items: center; gap: 12px; font-size: 14px; white-space: nowrap; }
.btn-logout { background: #e74c3c; color: #fff !important; padding: 6px 14px; border-radius: 6px; text-decoration: none; font-size: 13px; }
.btn-logout:hover { background: #c0392b; }

/* CONTAINER */
.container { max-width: 1400px; margin: 0 auto; padding: 24px; }
/* Élargit automatiquement le container sur les pages contenant un tableau marqué "table-wide" */
.container:has(.table-wide) { max-width: 98%; }

/* PAGE HEADER */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 28px; color: #1a3a5c; }
.page-header p { color: #666; margin-top: 4px; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card { background: #fff; border-radius: 10px; padding: 24px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,0.08); border-top: 4px solid #1a3a5c; }
.stat-icon { font-size: 32px; margin-bottom: 8px; }
.stat-number { font-size: 36px; font-weight: 700; color: #1a3a5c; }
.stat-label { color: #888; font-size: 13px; margin: 4px 0 12px; }
.stat-link { color: #2980b9; font-size: 13px; text-decoration: none; }
.stat-link:hover { text-decoration: underline; }

/* QUICK ACTIONS */
.quick-actions h2 { font-size: 20px; color: #1a3a5c; margin-bottom: 16px; }
.actions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.action-card { background: #fff; border: 2px solid #e0e8f0; border-radius: 10px; padding: 20px; text-align: center; text-decoration: none; color: #1a3a5c; font-weight: 600; font-size: 15px; transition: all 0.2s; }
.action-card:hover { background: #1a3a5c; color: #fff; border-color: #1a3a5c; }
.action-card span { display: block; font-size: 28px; margin-bottom: 8px; }

/* FORMULAIRES */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; color: #444; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 10px 14px; border: 1px solid #ddd; border-radius: 6px;
    font-size: 14px; transition: border 0.2s; font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: #2980b9; box-shadow: 0 0 0 3px rgba(41,128,185,0.1);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* BOUTONS */
.btn { display: inline-block; padding: 10px 20px; border-radius: 6px; border: none; cursor: pointer; font-size: 14px; font-weight: 600; text-decoration: none; transition: all 0.2s; }
.btn-primary { background: #1a3a5c; color: #fff; }
.btn-primary:hover { background: #2980b9; }
.btn-success { background: #27ae60; color: #fff; }
.btn-success:hover { background: #219a52; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-warning { background: #f39c12; color: #fff; }
.btn-warning:hover { background: #d68910; }
.btn-secondary { background: #95a5a6; color: #fff; }
.btn-secondary:hover { background: #7f8c8d; }
.btn-full { width: 100%; text-align: center; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* TABLEAUX */
.table-container { background: #fff; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); overflow: hidden; }
.table-header { padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #eee; }
.table-header h2 { font-size: 18px; color: #1a3a5c; }
table { width: 100%; border-collapse: collapse; }
th { background: #f8fafc; padding: 12px 16px; text-align: left; font-size: 13px; color: #666; font-weight: 600; border-bottom: 1px solid #eee; }
td { padding: 12px 16px; border-bottom: 1px solid #f0f0f0; font-size: 14px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

/* TABLEAU COMPACT (pour pages avec beaucoup de colonnes) */
.table-compact th { padding: 10px 8px; font-size: 12px; white-space: nowrap; }
.table-compact td { padding: 8px; font-size: 13px; }

/* BADGES */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-success { background: #d4efdf; color: #1e8449; }
.badge-warning { background: #fdebd0; color: #ca6f1e; }
.badge-danger  { background: #fadbd8; color: #c0392b; }
.badge-info    { background: #d6eaf8; color: #1a5276; }
.badge-secondary { background: #eaecee; color: #555; }

/* ALERTES */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #d4efdf; color: #1e8449; border-left: 4px solid #27ae60; }
.alert-danger  { background: #fadbd8; color: #c0392b; border-left: 4px solid #e74c3c; }
.alert-info    { background: #d6eaf8; color: #1a5276; border-left: 4px solid #2980b9; }
.alert-warning { background: #fdebd0; color: #ca6f1e; border-left: 4px solid #f39c12; }

/* CARD GENERIQUE */
.card { background: #fff; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); padding: 24px; margin-bottom: 24px; }
.card h2 { font-size: 18px; color: #1a3a5c; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #eee; }

/* FOOTER */
.footer { text-align: center; padding: 20px; color: #aaa; font-size: 13px; margin-top: 40px; }

/* PAGINATION */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 20px; }
.pagination a, .pagination span { padding: 6px 12px; border-radius: 6px; font-size: 13px; text-decoration: none; border: 1px solid #ddd; color: #333; }
.pagination a:hover { background: #1a3a5c; color: #fff; border-color: #1a3a5c; }
.pagination .active { background: #1a3a5c; color: #fff; border-color: #1a3a5c; }

/* TOOLTIPS — s'applique à tout élément cliquable ayant un attribut title */
.btn[title], a[title], button[title] { position: relative; }
.btn[title]:hover::after, a[title]:hover::after, button[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a3a5c;
    color: #fff;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.btn[title]:hover::before, a[title]:hover::before, button[title]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 1px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1a3a5c;
    z-index: 1000;
    pointer-events: none;
}
