/* Style fournisseur harmonisé avec Liste des lieux/clients */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap');

body {
    font-family: 'Poppins', Arial, sans-serif;
    color: #333;
    background: linear-gradient(135deg, #f9f9f9, #e3f2fd);
    margin: 0;
    padding: 0;
}

h1 {
    text-align: center;
    color: #444;
    margin-top: 0;
    margin-bottom: 30px;
    font-size: 28px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

header + h1,
.navbar + h1,
.user_CupiDose_gestioncommercial_header + h1 {
    margin-top: 40px;
}

h2 {
    color: #444;
    margin-top: 32px;
    margin-bottom: 18px;
    text-align: center;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

h3 {
    color: #333;
    margin: 25px 0 15px 0;
    font-size: 18px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

.content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.main-content {
    padding: 0 20px;
}

.page-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 0 auto 24px;
    flex-wrap: wrap;
}

.btn-open-form {
    width: auto;
    min-width: 240px;
    margin-top: 0;
}

.btn-cancel-edit {
    min-width: 220px;
}

.user-info {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 15px 20px;
    border-radius: 10px;
    text-align: center;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 20px;
}

.online-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    background: #28a745;
    border-radius: 50%;
    margin-right: 8px;
}

.role-badge {
    background-color: #6f42c1;
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85em;
    margin-left: 10px;
    font-weight: bold;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-Entreprise, .role-entreprise { background: linear-gradient(135deg, #dc3545, #c82333); }
.role-Dirigeant, .role-dirigeant { background: linear-gradient(135deg, #fd7e14, #e55a00); }
.role-Lieutenant, .role-lieutenant { background: linear-gradient(135deg, #6f42c1, #5a2d91); }
.role-Responsable, .role-responsable { background: linear-gradient(135deg, #20c997, #198754); }
.role-Vendeur, .role-vendeur { background: linear-gradient(135deg, #0d6efd, #0b5ed7); }
.role-Livreur, .role-livreur { background: linear-gradient(135deg, #198754, #146c43); }
.role-Guetteur, .role-guetteur { background: linear-gradient(135deg, #ffc107, #ffca2c); color: #000; }
.role-Préparateur, .role-préparateur, .role-Preparateur, .role-preparateur { background: linear-gradient(135deg, #6610f2, #520dc2); }
.role-Ravitailleur, .role-ravitailleur { background: linear-gradient(135deg, #d63384, #b02a5b); }
.role-Standartdiste, .role-standartdiste { background: linear-gradient(135deg, #495057, #343a40); }

.logout-link {
    color: #dc3545;
    text-decoration: none;
    margin-left: 15px;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.logout-link:hover {
    background-color: #dc3545;
    color: white;
    text-decoration: none;
}

.success-message {
    color: #155724;
    font-weight: 600;
    text-align: center;
    margin: 20px auto;
    background: #d4edda;
    padding: 15px 20px;
    border: 2px solid #c3e6cb;
    border-radius: 8px;
    max-width: 650px;
    box-shadow: 0 4px 15px rgba(21, 87, 36, 0.2);
}

.error-message {
    color: #721c24;
    font-weight: 600;
    text-align: center;
    margin: 20px auto;
    background: #f8d7da;
    padding: 15px 20px;
    border: 2px solid #f5c6cb;
    border-radius: 8px;
    max-width: 650px;
    box-shadow: 0 4px 15px rgba(114, 28, 36, 0.2);
}

.fournisseur-form {
    max-width: 760px;
    margin: 0 auto 40px auto;
    padding: 40px;
    background: #ffffff;
    border: 2px solid #dee2e6;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.fournisseur-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.field-group {
    grid-column: span 1;
}

.full-width {
    grid-column: span 2;
}

.section-title {
    margin: 8px 0 0 0;
}

form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

form input[type="text"],
form input[type="email"],
form input[type="number"],
form textarea {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 20px;
    border: 2px solid #ced4da;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.3s ease;
    background-color: #fff;
    box-sizing: border-box;
}

form input:focus,
form textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
    transform: translateY(-1px);
}

form textarea {
    resize: vertical;
    min-height: 95px;
    line-height: 1.5;
}

.form-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 10px;
}

.form-buttons .btn-primary {
    flex: 1;
}

.btn-primary {
    width: 100%;
    padding: 16px 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: 2px solid #6c757d;
    font-weight: 600;
    font-size: 14px;
    border-radius: 8px;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 150px;
}

.btn-secondary:hover {
    background: #5a6268;
    border-color: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.table-container {
    width: 100%;
    overflow-x: auto;
    margin: 30px auto 40px auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    border: 1px solid #e5e7eb;
}

.table-header {
    padding: 18px 20px 10px;
}

.table-header h2 {
    margin: 0;
    text-align: left;
    font-size: 20px;
    color: #1f2937;
}

table {
    width: 100%;
    min-width: 3600px;
    border-collapse: collapse;
    background: #ffffff;
    font-size: 14px;
    margin: 0;
    font-family: 'Poppins', sans-serif;
}

table th {
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%) !important;
    color: #0f172a !important;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 14px 12px;
    text-align: center;
    border-bottom: 2px solid #e2e8f0;
    font-size: 12px;
    position: sticky;
    top: 0;
    z-index: 10;
}

table td {
    padding: 12px 10px;
    text-align: center;
    border-bottom: 1px solid #eef2f7;
    border-right: 1px solid #f1f5f9;
    vertical-align: middle;
    font-size: 13px;
    color: #1f2937;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: #ffffff !important;
}

table td:last-child {
    border-right: none;
}

table tbody tr:nth-child(even) {
    background: #f9fbff !important;
}

table tbody tr:hover {
    background: #eef6ff !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

table td:empty::after {
    content: '—';
    color: #c7cdd6;
}

table th:last-child,
table td:last-child {
    min-width: 210px;
    white-space: nowrap;
}

.action-btns {
    display: flex;
    gap: 6px;
    justify-content: center;
    align-items: center;
}

.btn-action {
    padding: 6px 14px;
    font-size: 11px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
    text-decoration: none;
}

.btn-action.btn-edit {
    background: #ffc107;
    color: #212529;
}

.btn-action.btn-edit:hover {
    background: #e0a800;
    color: #212529;
}

.btn-action.btn-delete {
    background: #dc3545;
    color: #fff;
}

.btn-action.btn-delete:hover {
    background: #c82333;
}

/* Harmonisation visuelle moderne */
.fournisseur-form {
    border: 1px solid #e5e7eb;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.12);
}

.section-title {
    margin-top: 16px;
    margin-bottom: 6px;
    text-align: left;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: #334155;
    border-top: 1px dashed #dbe3ee;
    padding-top: 14px;
}

/* Tableau fournisseurs - style aligné clients/lieux */
.table-container {
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.fournisseurs-table {
    min-width: 3000px;
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0;
}

.fournisseurs-table th,
.fournisseurs-table td {
    border-bottom: 1px solid #e8eef5;
    border-right: 0;
    padding: 11px 10px;
}

.fournisseurs-table th {
    font-size: 11px;
    letter-spacing: 0.45px;
    color: #334155 !important;
    background: linear-gradient(180deg, #f8fafc 0%, #edf3fa 100%) !important;
    border-bottom: 1px solid #dbe5f3;
}

.fournisseurs-table td {
    font-size: 12px;
    color: #1e293b;
    max-width: 230px;
}

.fournisseurs-table tbody tr:nth-child(even) {
    background: #fbfdff !important;
}

.fournisseurs-table tbody tr:hover {
    background: #f1f6ff !important;
    transform: none;
    box-shadow: none;
}

.fournisseurs-table .col-primary {
    font-weight: 700;
    color: #0f172a;
}

.fournisseurs-table .col-date {
    font-variant-numeric: tabular-nums;
    color: #64748b;
}

.fiabilite-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    border: 1px solid transparent;
    min-width: 86px;
}

.fiabilite-badge.is-high {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}

.fiabilite-badge.is-medium {
    background: #fef3c7;
    color: #92400e;
    border-color: #fcd34d;
}

.fiabilite-badge.is-low {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
}

.fiabilite-badge.is-unknown {
    background: #e2e8f0;
    color: #334155;
    border-color: #cbd5e1;
}

.action-btns {
    gap: 8px;
}

.btn-action {
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 10px;
}

.btn-action.btn-edit {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
}

.btn-action.btn-edit:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: #fff;
}

.btn-action.btn-delete {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.btn-action.btn-delete:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

/* Modal formulaire fournisseur */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(6, 24, 64, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1300;
    padding: 24px;
    backdrop-filter: blur(3px);
}

.modal-fournisseur {
    position: relative;
    width: min(980px, 96vw);
    max-height: 92vh;
    overflow: auto;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff, #f7fbff);
    box-shadow: 0 30px 80px rgba(2, 6, 23, 0.45);
    padding: 20px 22px;
}

.modal-title {
    margin: 0 46px 16px 0;
    text-align: center;
    color: #333;
    font-size: 24px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(15,30,60,0.08);
    background: #fff;
    color: #1f2d3d;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(15, 30, 60, 0.08);
}

.modal-fournisseur .fournisseur-form {
    max-width: 650px;
    margin: 0 auto 40px auto;
    padding: 40px;
    background: #ffffff;
    border: 2px solid #dee2e6;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.modal-fournisseur .field-group label {
    font-weight: 600;
    color: #333;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-fournisseur .field-group input,
.modal-fournisseur .field-group textarea {
    border: 2px solid #ced4da;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 500;
    box-shadow: none;
}

.modal-fournisseur .field-group input:focus,
.modal-fournisseur .field-group textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
    transform: translateY(-1px);
}

.modal-fournisseur .section-title {
    color: #333;
    margin: 25px 0 15px 0;
    font-size: 18px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    border-top: none;
    padding-top: 0;
}

.modal-fournisseur .fournisseur-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.modal-fournisseur .field-group {
    grid-column: span 1;
}

.modal-fournisseur .full-width {
    grid-column: span 2;
}

.modal-fournisseur .form-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 10px;
}

.modal-fournisseur .form-buttons .btn-primary {
    flex: 1;
}

.modal-fournisseur .form-buttons .btn-primary,
.modal-fournisseur .form-buttons .btn-secondary {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

@media (max-width: 992px) {
    .fournisseur-form {
        padding: 30px;
    }
}

@media (max-width: 768px) {
    .content,
    .main-content {
        padding: 12px;
    }

    .page-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-open-form,
    .btn-cancel-edit {
        width: 100%;
        min-width: 0;
    }

    h1 {
        font-size: 22px;
    }

    h2 {
        font-size: 18px;
    }

    .fournisseur-form {
        padding: 24px;
        margin-bottom: 25px;
    }

    .modal-fournisseur {
        width: min(100%, 96vw);
        max-height: 95vh;
        padding: 14px;
    }

    .modal-fournisseur .fournisseur-form {
        margin: 0;
        padding: 30px;
        max-width: none;
    }

    .fournisseur-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .modal-fournisseur .fournisseur-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .full-width {
        grid-column: span 1;
    }

    .modal-fournisseur .full-width {
        grid-column: span 1;
    }

    .form-buttons {
        flex-direction: column;
    }

    .modal-fournisseur .form-buttons {
        flex-direction: column;
    }

    .btn-secondary,
    .btn-primary {
        width: 100%;
    }

    .modal-fournisseur .btn-secondary,
    .modal-fournisseur .btn-primary {
        width: 100%;
    }

    .action-btns {
        flex-direction: column;
        gap: 4px;
    }

    .btn-action {
        width: 100%;
        font-size: 10px;
        padding: 6px 10px;
    }
}
