/* Reset & base */
body {
    margin: 0;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    background: #f5f7fa;
    color: #222;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

h1, h2, h3 {
    font-weight: 600;
    letter-spacing: -.5px;
}

/* Table */
table {
    border-collapse: collapse;
    width: 100%;
    background: #fff;
    margin: 0;
    box-shadow: 0 2px 10px rgba(80,100,120,.07);
    border-radius: 12px;
    overflow: hidden;
}
th, td {
    padding: 12px 14px;
    text-align: left;
}
th {
    font-weight: 500;
    background: #f0f4f8;
    color: #09328B;
    font-size: 1em;
}
tr {
    border-bottom: 1px solid #f0f4f8;
}
tr:last-child {
    border-bottom: none;
}
tbody tr:hover {
    background: #f6faff;
}

/* SIDEBAR - Correction complète pour position et responsive */
.sidebar {
    width: 230px;
    background: linear-gradient(180deg, #0f2557 90%, #09328B 100%);
    color: #fff;
    min-height: 100vh;
    z-index: 20;
    box-shadow: 2px 0 14px rgba(20,40,60,.10);
    display: block;
    padding: 0;
    left: 0;
    top: 0;
    transition: left 0.2s, box-shadow 0.2s;
    overflow-y: auto;
    position: fixed; /* FIXED for true sidebar behavior */
    height: 100vh;
}
.sidebar .logo {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 28px 22px 18px 22px;
    font-size: 1.3em;
    font-weight: 700;
    letter-spacing: -.5px;
}
.sidebar nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.sidebar nav ul li {
    margin: 0;
}
.sidebar nav ul li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 22px;
    font-size: 1.07em;
    border-left: 4px solid transparent;
    transition: background .17s, border-color .17s, color .17s;
    color: #fff;
    font-weight: 500;
}
.sidebar nav ul li.active a,
.sidebar nav ul li a:hover {
    background: #fff1;
    border-left: 4px solid #FFD700;
    color: #FFD700;
}
.sidebar i {
    color: #fff !important;
}

/* Sidebar scrollable on desktop */
.sidebar {
    overflow-y: auto;
}

/* SIDEBAR RESPONSIVE */
@media (max-width: 900px) {
    .sidebar {
        position: fixed !important;
        left: 0; top: 0; bottom: 0;
        width: 230px;
        height: 100vh;
        min-height: 100vh;
        display: none !important;
        z-index: 999;
        box-shadow: 0 2px 15px #09328B33;
    }
    .sidebar.show {
        display: block !important;
        animation: slideSidebar .18s cubic-bezier(.7,.1,.7,1);
    }
    @keyframes slideSidebar {
        from { left: -230px; opacity: 0; }
        to { left: 0; opacity: 1; }
    }
    main { margin-left: 0 !important; }
    .sidebar-menu-btn { display: block !important; position:fixed; top:19px; left:15px; z-index:110; }
    .sidebar-close { display: block !important; }
}
@media (min-width: 900px) {
    .sidebar {
        display: block !important;
        position: fixed !important;
        left: 0; top: 0; bottom: auto;
        height: 100vh;
        z-index: 20;
    }
    .sidebar-menu-btn { display: none !important; }
    .sidebar-close { display: none !important; }
    main { margin-left: 230px !important; }
}

/* main layout */
main {
    margin-left: 0;
    padding: 38px 34px 24px 34px;
    min-height: 100vh;
    background: #f5f7fa;
    transition: margin-left 0.2s;
}

/* Ajout : forcer le main à ne pas être décalé sur mobile même si inline style ou autre surcharge */
@media (max-width: 900px) {
    main {
        margin-left: 0 !important;
    }
}

/* Ajout : s'assurer que la sidebar reste masquée sur mobile hors .show */
@media (max-width: 900px) {
    .sidebar:not(.show) {
        display: none !important;
    }
}

/* Card + grid */
.card, .card-grid > .card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 14px rgba(20,40,60,.13);
    padding: 30px 28px;
    margin-bottom: 32px;
    transition: box-shadow .22s;
    position: relative;
    border: 1.5px solid #f0f4f8;
}
.card:hover, .card-grid > .card:hover {
    box-shadow: 0 6px 24px rgba(20,40,60,.18);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px,1fr));
    gap: 28px;
}

/* Boutons */
.btn {
    background: linear-gradient(90deg,#FFD700 70%,#fbdc64 100%);
    color: #09328B;
    border: none;
    border-radius: 8px;
    padding: 9px 24px;
    font-size: 1em;
    font-weight: 600;
    box-shadow: 0 2px 9px rgba(240,200,70,.12);
    cursor: pointer;
    transition: background .13s, box-shadow .19s, color .13s;
    margin-right: 10px;
    margin-bottom: 6px;
    outline: none;
}
.btn:hover, .btn:focus {
    background: linear-gradient(90deg,#FFD700 85%,#fff8e5 100%);
    box-shadow: 0 4px 16px rgba(240,200,70,.18);
    color: #0f2557;
}

/* Inputs */
input[type="text"], input[type="email"], input[type="number"], input[type="password"], input[type="month"], select {
    border: 1.5px solid #e3e7ef;
    border-radius: 8px;
    padding: 8px 13px;
    font-size: 1em;
    background: #f9fbfd;
    margin-bottom: 6px;
    margin-right: 6px;
    transition: border-color .14s;
}
input:focus, select:focus {
    border-color: #FFD700;
    outline: none;
}

form {
    margin: 0;
}

.notif-badge {
    background: #FFD700;
    color: #09328B;
    border-radius: 10px;
    padding: 2.5px 9px;
    font-size: 0.92em;
    font-weight: 700;
    margin-left: 7px;
    box-shadow: 0 1px 6px #FFD70055;
}

::-webkit-scrollbar {
    width: 8px;
    background: #f0f4f8;
}
::-webkit-scrollbar-thumb {
    background: #e3e7ef;
    border-radius: 8px;
}

/* Ajout spécifique pour l'add-form améliorée */
.add-form {
    background: linear-gradient(90deg,#f9fbfd 80%,#e3e7ef 100%);
    border-radius: 18px;
    padding: 34px 32px 18px 32px;
    max-width: 520px;
    margin-bottom: 32px;
    box-shadow: 0 4px 18px #09328B22;
    border: 2px solid #e3e7ef;
}
.add-form h3 {
    text-align: left;
    color: #09328B;
    margin-bottom: 21px;
    font-size: 1.3em;
    font-weight: 700;
}
.add-form label {
    font-weight: 600;
    color: #0f2557;
    margin-bottom: 3px;
    display: block;
}
.add-form .form-row {
    display: flex;
    gap: 20px;
}
.add-form .form-col {
    flex:1;
    min-width: 160px;
}
.add-form .btn {
    width: 100%;
    margin-top: 18px;
    font-size: 1.07em;
    padding: 11px 0;
}
@media (max-width:600px) {
    .add-form .form-row { flex-direction: column; gap:0;}
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.input-pass-visu { position:relative; }
.input-pass-visu input { padding-right:36px !important; }
.input-pass-visu .toggle-pw { position:absolute; top:7px; right:10px; background:none; border:none; color:#09328B; cursor:pointer; font-size:1.1em; }

@media (max-width: 900px) {
    .action-buttons {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }
    .action-buttons .btn {
        min-width: 100%;
        max-width: 100%;
        padding: 11px 0;
        font-size: 1.05em;
    }
}

/* Icon colors */
.fa-users, .fa-money-bill-transfer, .fa-credit-card, .fa-clock-rotate-left, .fa-file, .fa-bell, .fa-gear, .fa-address-book {
    color: #09328B;
    margin-right: 7px;
}
.fa-right-from-bracket {
    color: #d32f2f;
}

/* Success/Error messages */
div[style*="color:#09328B;"], div[style*="color:#d32f2f;"], .message-success, .message-error {
    font-weight: 500;
    margin-bottom: 18px;
    padding: 7px 14px;
    border-radius: 8px;
    background: #f9fbfd;
    box-shadow: 0 2px 8px #09328B11;
    border-left: 4px solid #FFD700;
}
div[style*="color:#d32f2f;"], .message-error {
    border-left: 4px solid #d32f2f;
}

/* Table action buttons */
table button.btn {
    padding: 4px 12px;
    font-size: 0.97em;
    margin-bottom: 0;
}
td > form {
    display: inline-block;
}

/* Pagination links */
main a[href*="page="] {
    background: #09328B;
    color: #fff;
    border-radius: 5px;
    padding: 5px 13px;
    font-weight: 600;
    margin-right: 5px;
    text-decoration: none;
    transition: background .13s;
}
main a[href*="page="]:hover {
    background: #FFD700;
    color: #09328B;
}