/* ========================================
   RESET
======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: #f5f7fb;
    color: #1f2937;
    line-height: 1.6;
}

/* ========================================
   LAYOUT
======================================== */

.container {
    width: 90%;
    max-width: 1200px;
    margin: 40px auto;
}

/* ========================================
   NAVBAR
======================================== */

.navbar {
    background: #1e3a8a;
    padding: 16px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.navbar .container {
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar h1 {
    color: white;
    font-size: 22px;
}

.navbar a {
    color: white;
    text-decoration: none;
    margin-left: 20px;
    font-weight: 500;
}

.navbar a:hover {
    text-decoration: underline;
}

/* ========================================
   TITRES
======================================== */

h1 {
    margin-bottom: 25px;
    font-size: 30px;
    color: #111827;
}

h2 {
    margin-bottom: 15px;
    color: #1f2937;
}

/* ========================================
   BOUTONS
======================================== */

.btn {
    display: inline-block;
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: 0.2s;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-success {
    background: #16a34a;
    color: white;
}

.btn-success:hover {
    background: #15803d;
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

/* ========================================
   ACTIONS
======================================== */

.actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.actions-right {
    display: flex;
    gap: 10px;
}

/* ========================================
   TABLE
======================================== */

.table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #1e3a8a;
    color: white;
}

th,
td {
    padding: 14px 16px;
    text-align: left;
}

tbody tr {
    border-bottom: 1px solid #e5e7eb;
}

tbody tr:hover {
    background: #f8fafc;
}

tbody tr:last-child {
    border-bottom: none;
}

/* ========================================
   BADGES
======================================== */

.badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

/* ========================================
   CARDS
======================================== */

.card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* ========================================
   FORMULAIRE
======================================== */

.form-card {
    max-width: 700px;
    margin: 40px auto;
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 7px;
    font-weight: 600;
    color: #374151;
}

.form-control {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    transition: 0.2s;
}

.form-control:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

/* ========================================
   ALERTES
======================================== */

.alert {
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* ========================================
   DETAIL
======================================== */

.detail-list {
    list-style: none;
}

.detail-list li {
    padding: 14px 0;
    border-bottom: 1px solid #e5e7eb;
}

.detail-list li:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: bold;
    color: #6b7280;
    display: inline-block;
    width: 150px;
}

/* ========================================
   EMPTY STATE
======================================== */

.empty {
    text-align: center;
    padding: 50px 20px;
    color: #6b7280;
}

.empty p {
    margin-bottom: 20px;
}

/* ========================================
   RESPONSIVE
======================================== */

@media (max-width: 768px) {

    .container {
        width: 95%;
        margin: 25px auto;
    }

    .navbar .container {
        flex-direction: column;
        gap: 10px;
    }

    .navbar a {
        margin: 0 8px;
    }

    .actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .table-container {
        overflow-x: auto;
    }

    table {
        min-width: 700px;
    }

    .form-card {
        padding: 20px;
    }
}

/* ========================================
   ADDITIONAL UTILITIES & HELPERS
======================================== */

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 6px;
}

.actions-cell {
    display: flex;
    gap: 8px;
    align-items: center;
}

.actions-cell form {
    margin: 0;
    display: inline-block;
}

.field-error {
    color: #dc2626;
    font-size: 13px;
    margin-top: 5px;
    font-weight: 500;
}

.form-control.is-invalid {
    border-color: #dc2626;
    background-color: #fffaf0;
}

.form-control.is-invalid:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.alert-info {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.alert ul {
    margin-left: 20px;
    margin-top: 8px;
}

.flash-messages {
    margin-bottom: 25px;
}

.text-muted {
    color: #6b7280;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 600;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ========================================
   SEARCH FORM & FILTERS
======================================== */

.search-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
    border: 1px solid #e5e7eb;
}

.search-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 15px;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    align-items: flex-end;
}

.search-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    justify-content: flex-end;
    align-items: center;
}

/* ========================================
   PAGINATION
======================================== */

.pagination-wrapper {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.pagination-item {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: white;
    color: #374151;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: 0.2s;
}

.pagination-item:hover:not(.disabled):not(.active) {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #111827;
}

.pagination-item.active {
    background: #1e3a8a;
    border-color: #1e3a8a;
    color: white;
}

.pagination-item.disabled {
    opacity: 0.45;
    pointer-events: none;
    cursor: not-allowed;
    background: #f9fafb;
}

.pagination-info {
    color: #6b7280;
    font-size: 13px;
}