/* =========================================================
   AVIZO - APPLICATION DE GESTION
   Style professionnel - Application métier
   ========================================================= */


/* =========================================================
   VARIABLES
   ========================================================= */

:root {
    --primary: #1f4e79;
    --primary-dark: #163a5c;
    --primary-light: #eaf2f8;

    --secondary: #64748b;

    --success: #198754;
    --success-light: #e8f5ee;

    --warning: #d99a00;
    --warning-light: #fff7df;

    --danger: #dc3545;
    --danger-light: #fdebec;

    --info: #0d6efd;
    --info-light: #eaf2ff;

    --background: #f4f6f9;
    --surface: #ffffff;

    --border: #e2e8f0;

    --text: #1e293b;
    --text-light: #64748b;

    --radius: 10px;
    --shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    --shadow-hover: 0 6px 18px rgba(15, 23, 42, 0.10);
}


/* =========================================================
   GLOBAL
   ========================================================= */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;

    background: var(--background);
    color: var(--text);

    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;

    font-size: 15px;
    line-height: 1.6;
}


/* =========================================================
   LIENS
   ========================================================= */

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
}


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

h1,
h2,
h3,
h4,
h5 {
    color: var(--text);
    font-weight: 600;
}

h1 {
    font-size: 28px;
    margin-bottom: 24px;
}

h2 {
    font-size: 21px;
    margin-bottom: 18px;
}

h3 {
    font-size: 18px;
}


/* =========================================================
   CONTENEUR PRINCIPAL
   ========================================================= */

.container,
.container-fluid {
    max-width: 1400px;
}


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

.navbar {
    background: var(--surface) !important;

    border-bottom: 1px solid var(--border);

    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);

    min-height: 64px;
}

.navbar-brand {
    color: var(--primary) !important;

    font-size: 21px;
    font-weight: 700;

    letter-spacing: -0.3px;
}

.navbar-nav .nav-link {
    color: var(--text-light) !important;

    font-weight: 500;

    padding: 9px 14px !important;

    border-radius: 7px;

    transition:
        background 0.2s ease,
        color 0.2s ease;
}

.navbar-nav .nav-link:hover {
    color: var(--primary) !important;
    background: var(--primary-light);
}

.navbar-nav .nav-link.active {
    color: var(--primary) !important;
    background: var(--primary-light);
}


/* =========================================================
   PAGE
   ========================================================= */

.page-container {
    padding: 30px 20px 50px;
}

.page-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 25px;
}

.page-header h1 {
    margin: 0;
}

.page-header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}


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

.card {
    border: 1px solid var(--border);

    border-radius: var(--radius);

    background: var(--surface);

    box-shadow: var(--shadow);

    margin-bottom: 24px;

    overflow: hidden;
}

.card-header {
    background: #fff;

    border-bottom: 1px solid var(--border);

    padding: 17px 20px;

    font-weight: 600;

    color: var(--text);
}

.card-body {
    padding: 22px;
}

.card-footer {
    background: #fafbfc;

    border-top: 1px solid var(--border);

    padding: 15px 20px;
}

.card:hover {
    box-shadow: var(--shadow-hover);
}


/* =========================================================
   AFFAIRE
   ========================================================= */

.affaire-header {
    display: flex;

    justify-content: space-between;
    align-items: center;

    gap: 20px;

    padding: 24px;

    background: var(--surface);

    border: 1px solid var(--border);

    border-radius: var(--radius);

    box-shadow: var(--shadow);

    margin-bottom: 24px;
}

.affaire-title {
    margin: 0;

    color: var(--primary);

    font-size: 25px;
    font-weight: 700;
}

.affaire-number {
    color: var(--text-light);

    font-size: 14px;

    margin-top: 4px;
}

.affaire-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}


/* =========================================================
   INFORMATIONS
   ========================================================= */

.info-grid {
    display: grid;

    grid-template-columns:
        repeat(auto-fit, minmax(250px, 1fr));

    gap: 16px;
}

.info-item {
    padding: 15px;

    background: #fafbfc;

    border: 1px solid var(--border);

    border-radius: 8px;
}

.info-label {
    display: block;

    margin-bottom: 4px;

    color: var(--text-light);

    font-size: 12px;

    font-weight: 600;

    text-transform: uppercase;

    letter-spacing: 0.4px;
}

.info-value {
    color: var(--text);

    font-size: 15px;

    font-weight: 500;
}


/* =========================================================
   TABLEAUX
   ========================================================= */

.table-responsive {
    border-radius: var(--radius);

    border: 1px solid var(--border);

    background: var(--surface);

    box-shadow: var(--shadow);

    overflow-x: auto;
}

.table {
    margin-bottom: 0;

    vertical-align: middle;
}

.table thead th {
    background: #f8fafc;

    color: #475569;

    border-bottom: 1px solid var(--border);

    font-size: 12px;

    font-weight: 700;

    text-transform: uppercase;

    letter-spacing: 0.4px;

    padding: 14px 16px;

    white-space: nowrap;
}

.table tbody td {
    padding: 14px 16px;

    border-color: var(--border);

    color: var(--text);
}

.table tbody tr {
    transition: background 0.15s ease;
}

.table tbody tr:hover {
    background: #f8fafc;
}


/* =========================================================
   AVIS
   ========================================================= */

.avis-section {
    margin-top: 30px;
}

.avis-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 15px;

    margin-bottom: 16px;
}

.avis-header h2 {
    margin: 0;
}

.avis-description {
    max-width: 350px;

    color: var(--text-light);

    white-space: normal;
}

.avis-type {
    display: inline-flex;

    align-items: center;

    justify-content: center;

    min-width: 40px;

    padding: 5px 10px;

    border-radius: 6px;

    background: var(--primary-light);

    color: var(--primary);

    font-size: 12px;

    font-weight: 700;
}


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

.badge {
    display: inline-flex;

    align-items: center;

    justify-content: center;

    padding: 5px 10px;

    border-radius: 20px;

    font-size: 12px;

    font-weight: 600;
}

.badge.bg-warning {
    background: var(--warning-light) !important;

    color: #8a6500 !important;
}

.badge.bg-success {
    background: var(--success-light) !important;

    color: #137344 !important;
}

.badge.bg-danger {
    background: var(--danger-light) !important;

    color: #b42333 !important;
}

.badge.bg-info {
    background: var(--info-light) !important;

    color: #0759c7 !important;
}


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

.btn {
    border-radius: 7px;

    font-size: 14px;

    font-weight: 500;

    padding: 8px 14px;

    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        background 0.15s ease;
}

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

.btn-primary {
    background: var(--primary);

    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);

    border-color: var(--primary-dark);
}

.btn-success {
    background: var(--success);

    border-color: var(--success);
}

.btn-warning {
    color: #5f4700;
}

.btn-danger {
    background: var(--danger);

    border-color: var(--danger);
}

.btn-info {
    color: white;

    background: var(--info);

    border-color: var(--info);
}


/* =========================================================
   GROUPE D'ACTIONS
   ========================================================= */

.action-buttons {
    display: flex;

    gap: 6px;

    flex-wrap: wrap;
}

.action-buttons .btn {
    white-space: nowrap;
}


/* =========================================================
   FORMULAIRES
   ========================================================= */

.form-card {
    max-width: 900px;

    margin: 0 auto;

    background: var(--surface);

    border: 1px solid var(--border);

    border-radius: var(--radius);

    box-shadow: var(--shadow);

    padding: 28px;
}

.form-label {
    color: #475569;

    font-weight: 600;

    font-size: 14px;

    margin-bottom: 7px;
}

.form-control,
.form-select {
    min-height: 44px;

    border: 1px solid #cbd5e1;

    border-radius: 7px;

    color: var(--text);

    background: #fff;

    padding: 9px 12px;

    font-size: 14px;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);

    box-shadow:
        0 0 0 3px rgba(31, 78, 121, 0.12);
}

textarea.form-control {
    min-height: 130px;

    resize: vertical;
}

input[type="file"].form-control {
    padding: 8px;
}


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

.errorlist {
    margin: 6px 0 0;

    padding: 0;

    list-style: none;

    color: var(--danger);

    font-size: 13px;
}

.is-invalid {
    border-color: var(--danger) !important;
}


/* =========================================================
   MESSAGES DJANGO
   ========================================================= */

.alert {
    border-radius: 8px;

    border: 1px solid transparent;

    padding: 13px 16px;

    font-size: 14px;

    margin-bottom: 20px;
}

.alert-success {
    color: #146c43;

    background: var(--success-light);

    border-color: #b7dfc8;
}

.alert-danger {
    color: #b42333;

    background: var(--danger-light);

    border-color: #f3b7bd;
}

.alert-warning {
    color: #8a6500;

    background: var(--warning-light);

    border-color: #f1df9b;
}

.alert-info {
    color: #0759c7;

    background: var(--info-light);

    border-color: #b7d2fa;
}


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

.avis-detail-card {
    max-width: 1000px;

    margin: 0 auto;
}

.avis-detail-header {
    display: flex;

    justify-content: space-between;

    align-items: center;

    gap: 20px;

    padding: 20px;

    border-bottom: 1px solid var(--border);
}

.avis-detail-title {
    margin: 0;

    color: var(--primary);

    font-size: 22px;

    font-weight: 700;
}

.avis-detail-body {
    padding: 24px;
}

.avis-description-box {
    background: #f8fafc;

    border: 1px solid var(--border);

    border-radius: 8px;

    padding: 18px;

    white-space: pre-wrap;

    line-height: 1.7;
}


/* =========================================================
   PHOTO AVIS
   ========================================================= */

.avis-photo-container {
    margin-top: 20px;

    text-align: center;
}

.avis-photo {
    max-width: 100%;

    max-height: 500px;

    object-fit: contain;

    border-radius: 8px;

    border: 1px solid var(--border);

    box-shadow: var(--shadow);
}


/* =========================================================
   CONFIRMATION SUPPRESSION
   ========================================================= */

.delete-card {
    max-width: 600px;

    margin: 50px auto;

    padding: 30px;

    text-align: center;

    background: var(--surface);

    border: 1px solid #f1c5ca;

    border-radius: var(--radius);

    box-shadow: var(--shadow);
}

.delete-card h1 {
    color: var(--danger);

    font-size: 24px;
}

.delete-card p {
    color: var(--text-light);

    margin-bottom: 25px;
}

.delete-actions {
    display: flex;

    justify-content: center;

    gap: 10px;
}


/* =========================================================
   FOOTER
   ========================================================= */

footer {
    margin-top: 50px;

    padding: 20px;

    border-top: 1px solid var(--border);

    background: var(--surface);

    color: var(--text-light);

    text-align: center;

    font-size: 13px;
}


/* =========================================================
   UTILITAIRES
   ========================================================= */

.text-muted {
    color: var(--text-light) !important;
}

.section-title {
    display: flex;

    align-items: center;

    gap: 10px;

    margin-bottom: 18px;
}

.section-title::before {
    content: "";

    display: block;

    width: 4px;

    height: 22px;

    background: var(--primary);

    border-radius: 3px;
}


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

@media (max-width: 768px) {

    .page-container {
        padding: 20px 12px 40px;
    }

    h1 {
        font-size: 23px;
    }

    h2 {
        font-size: 19px;
    }

    .page-header {
        flex-direction: column;

        align-items: flex-start;
    }

    .affaire-header {
        flex-direction: column;

        align-items: flex-start;
    }

    .avis-header {
        flex-direction: column;

        align-items: flex-start;
    }

    .form-card {
        padding: 20px;
    }

    .table thead th,
    .table tbody td {
        padding: 10px;
    }

    .action-buttons {
        flex-direction: column;

        align-items: stretch;
    }

    .action-buttons .btn {
        width: 100%;
    }
}


/* =========================================================
   PETITS ÉCRANS
   ========================================================= */

@media (max-width: 480px) {

    body {
        font-size: 14px;
    }

    .page-container {
        padding: 15px 10px 30px;
    }

    .card-body {
        padding: 16px;
    }

    .form-card {
        padding: 16px;
    }

    .affaire-actions,
    .page-header-actions {
        width: 100%;
    }

    .affaire-actions .btn,
    .page-header-actions .btn {
        flex: 1;
    }
}


