﻿/* ═══════════════════════════════════════════════════════════════ */
/* ─── MODALS ──────────────────────────────────────────────────── */
/* ═══════════════════════════════════════════════════════════════ */

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1050;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content {
    padding: 0;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

    .modal-header h5 {
        margin: 0;
        font-weight: 600;
        font-size: 1.25rem;
    }

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #000;
    padding: 0;
    width: auto;
    height: auto;
}

    .btn-close:hover {
        color: #666;
    }

/* ═══════════════════════════════════════════════════════════════ */
/* ─── FORMS ───────────────────────────────────────────────────── */
/* ═══════════════════════════════════════════════════════════════ */

.form-control {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    box-sizing: border-box;
}

    .form-control:focus {
        color: #495057;
        background-color: #fff;
        border-color: #80bdff;
        outline: 0;
        box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    }

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.mb-3 {
    margin-bottom: 1rem;
}

.text-danger {
    color: #dc3545;
}

.text-success {
    color: #28a745;
}

.text-small {
    font-size: 0.875rem;
}

/* ═══════════════════════════════════════════════════════════════ */
/* ─── BUTTONS ──────────────────────────────────────────────────── */
/* ═══════════════════════════════════════════════════════════════ */

.btn {
    display: inline-block;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    line-height: 1.5;
    border-radius: 6px;
    transition: all 0.3s ease;
    cursor: pointer;
}

    .btn:hover {
        opacity: 0.9;
    }

.btn-primary {
    color: #fff;
    background-color: #4a90e2;
    border-color: #4a90e2;
}

    .btn-primary:hover {
        background-color: #357abd;
        box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
    }

.btn-secondary {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}

    .btn-secondary:hover {
        background-color: #5a6268;
        border-color: #545b62;
    }

.btn-danger {
    color: #fff;
    background-color: #dc3545;
    border-color: #dc3545;
}

    .btn-danger:hover {
        background-color: #c82333;
        border-color: #bd2130;
    }

.btn-edit {
    background-color: #4a90e2;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    transition: all 0.3s ease;
}

    .btn-edit:hover {
        background-color: #357abd;
        box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
    }

.btn-add {
    padding: 8px 16px;
    background-color: #fff;
    border: 1px solid #999;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

    .btn-add:hover {
        background-color: #f5f5f5;
    }

/* ═══════════════════════════════════════════════════════════════ */
/* ─── LISTS ───────────────────────────────────────────────────── */
/* ═══════════════════════════════════════════════════════════════ */

.list-group {
    display: flex;
    flex-direction: column;
    padding-left: 0;
    margin-bottom: 0;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
}

.list-group-item {
    position: relative;
    display: block;
    padding: 0.75rem 1.25rem;
    margin-bottom: -1px;
    background-color: #fff;
    border: 1px solid #dee2e6;
    cursor: pointer;
    user-select: none;
}

    .list-group-item:first-child {
        border-top-left-radius: 0.25rem;
        border-top-right-radius: 0.25rem;
    }

    .list-group-item:last-child {
        margin-bottom: 0;
        border-bottom-left-radius: 0.25rem;
        border-bottom-right-radius: 0.25rem;
    }

    .list-group-item:hover {
        background-color: #f8f9fa;
    }

    .list-group-item input[type="checkbox"] {
        margin-right: 0.5rem;
    }

/* ═══════════════════════════════════════════════════════════════ */
/* ─── BADGES ───────────────────────────────────────────────────── */
/* ═══════════════════════════════════════════════════════════════ */

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success {
    background-color: #d4edda;
    color: #155724;
}

.badge-danger {
    background-color: #f8d7da;
    color: #721c24;
}

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */

.management-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
    padding: 20px;
    box-sizing: border-box;
    overflow: hidden;
}

/* ============================================================
   ONGLETS
   ============================================================ */

.tabs {
    display: flex;
    gap: 20px;
    border-bottom: 2px solid #ccc;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.tab {
    padding: 10px 15px;
    cursor: pointer;
    background: none;
    border: none;
    font-size: 14px;
    color: #666;
    transition: all 0.3s ease;
}

.tab-active {
    color: #000;
    font-weight: bold;
    border-bottom: 3px solid #5a67d8;
    margin-bottom: -2px;
}

/* ============================================================
   BOUTON AJOUTER
   ============================================================ */

.add-button-container {
    margin-bottom: 15px;
    flex-shrink: 0;
}

/* ============================================================
   FORMULAIRE
   ============================================================ */

.form-panel {
    width: 100%;
    padding: 25px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
    box-sizing: border-box;
}

.form-panel-header {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

    .form-panel-header h5 {
        margin: 0;
        color: #333;
        font-weight: 700;
        font-size: 18px;
    }

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
    background-color: #fff;
    box-sizing: border-box;
}

    .form-control:focus {
        outline: none;
        border-color: #4a90e2;
        box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
        background-color: #fff;
    }

.form-check {
    display: flex;
    align-items: center;
}

.form-check-input {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    cursor: pointer;
    accent-color: #4a90e2;
}

.form-check-label {
    margin: 0;
    cursor: pointer;
    font-size: 14px;
    color: #555;
}

.form-section-title {
    font-weight: 700;
    font-size: 14px;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 15px;
}

.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.group-checkbox {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

    .group-checkbox:hover {
        border-color: #4a90e2;
        background-color: #f5f8ff;
    }

    .group-checkbox input[type="checkbox"] {
        width: 16px;
        height: 16px;
        margin-right: 8px;
        cursor: pointer;
        accent-color: #4a90e2;
    }

    .group-checkbox span {
        font-size: 13px;
        color: #333;
        flex: 1;
    }

    .group-checkbox input[type="checkbox"]:checked + span {
        font-weight: 600;
        color: #4a90e2;
    }

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
    justify-content: flex-start;
}

.alert {
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 20px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ============================================================
   TABLEAU - Responsive
   ============================================================ */

.table-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

    .table thead {
        background-color: #f8f9fa;
        border-bottom: 2px solid #dee2e6;
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .table th {
        padding: 16px;
        text-align: left;
        font-weight: 600;
        color: #333;
        font-size: 14px;
        user-select: none;
        border-bottom: 2px solid #ddd;
        white-space: nowrap;
    }

        .table th:hover {
            background-color: #efefef;
            cursor: pointer;
        }

    .table td {
        padding: 12px 16px;
        border-bottom: 1px solid #f0f0f0;
        font-size: 14px;
        color: #555;
    }

    .table tbody tr {
        transition: background-color 0.2s ease;
    }

        .table tbody tr:hover {
            background-color: #f8f9fa;
        }

        .table tbody tr:nth-child(even) {
            background-color: #fafafa;
        }

        .table tbody tr:last-child td {
            border-bottom: none;
        }

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

.loading,
.empty {
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

/* ============================================================
   RESPONSIVE - Tablette (max-width: 1024px)
   ============================================================ */

@media (max-width: 1024px) {
    /* Masquer colonnes sauf Prénom, Nom, Actions */
    .table th:nth-child(3),
    .table th:nth-child(4),
    .table th:nth-child(5),
    .table th:nth-child(6),
    .table th:nth-child(7),
    .table td:nth-child(3),
    .table td:nth-child(4),
    .table td:nth-child(5),
    .table td:nth-child(6),
    .table td:nth-child(7) {
        display: none;
    }

    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .table th,
    .table td {
        padding: 12px 10px;
        font-size: 13px;
    }

    .groups-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
}

/* ============================================================
   RESPONSIVE - Mobile (max-width: 768px)
   ============================================================ */

@media (max-width: 768px) {
    .management-container {
        padding: 15px;
        height: calc(100vh - 120px);
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .groups-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .form-panel {
        padding: 20px;
        margin-bottom: 15px;
    }

    .form-actions {
        flex-direction: column;
    }

        .form-actions .btn {
            width: 100%;
        }

    .table th,
    .table td {
        padding: 10px 8px;
        font-size: 12px;
    }

    .btn-edit {
        padding: 6px 10px;
        font-size: 12px;
    }

    .tabs {
        gap: 10px;
        margin-bottom: 15px;
    }

    .tab {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* ============================================================
   RESPONSIVE - Petit mobile (max-width: 480px)
   ============================================================ */

@media (max-width: 480px) {
    .management-container {
        padding: 10px;
        height: calc(100vh - 100px);
    }

    .form-panel {
        padding: 15px;
    }

    .form-panel-header h5 {
        font-size: 16px;
    }

    .form-label {
        font-size: 12px;
    }

    .table th,
    .table td {
        padding: 8px 6px;
        font-size: 11px;
    }

    .btn-edit {
        padding: 5px 8px;
        font-size: 11px;
    }

    .badge {
        padding: 3px 6px;
        font-size: 11px;
    }

    .tabs {
        gap: 8px;
    }

    .tab {
        padding: 6px 10px;
        font-size: 12px;
    }
}
/* ============================================================
   affichage max avec class:content-wrapper
   ============================================================ */

.content-wrapper {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .content-wrapper {
        padding: 0 15px;
    }
}

@media (max-width: 480px) {
    .content-wrapper {
        padding: 0 10px;
    }
}