/* ── wps-style.css ─────────────────────────────────────────────────────────── */

#wps-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    color: #333;
    max-width: 100%;
    padding: 10px 0;
}

#wps-wrapper h2 {
    margin-bottom: 14px;
    font-size: 1.3rem;
    color: #23282d;
}

/* ── Message flash ─────────────────────────────────────────────────────────── */
#wps-message {
    padding: 10px 16px;
    border-radius: 4px;
    margin-bottom: 12px;
    font-weight: 600;
}
#wps-message.wps-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
#wps-message.wps-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* ── Mise en page 2 colonnes ───────────────────────────────────────────────── */
#container-2colonnes {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    flex-wrap: wrap;
}

/* ── Formulaire (colonne gauche) ───────────────────────────────────────────── */
#formulaire-produits {
    flex: 0 0 320px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 18px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.wps-form-table {
    width: 100%;
    border-collapse: collapse;
}

.wps-form-table td {
    padding: 6px 8px;
    vertical-align: middle;
}

.wps-form-table td:first-child {
    font-weight: 600;
    width: 100px;
    white-space: nowrap;
    color: #555;
}

.wps-form-table input[type="text"],
.wps-form-table input[type="number"],
.wps-form-table select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    box-sizing: border-box;
    background: #fafafa;
}

.wps-form-table input[readonly] {
    background: #f0f0f0;
    color: #888;
    cursor: not-allowed;
}

.wps-form-table input:focus,
.wps-form-table select:focus {
    outline: none;
    border-color: #0073aa;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(0,115,170,.15);
}

/* ── Boutons ───────────────────────────────────────────────────────────────── */
.bloc-btn {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.bloc-btn button {
    padding: 8px 14px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background .2s;
}

#btn_nouveau {
    background: #6c757d;
    color: #fff;
}
#btn_nouveau:hover { background: #545b62; }

#enreg_produit {
    background: #0073aa;
    color: #fff;
}
#enreg_produit:hover { background: #005177; }

#btn_nouv_enr_rec {
    background: #28a745;
    color: #fff;
}
#btn_nouv_enr_rec:hover { background: #1e7e34; }

/* ── Upload ────────────────────────────────────────────────────────────────── */
.bloc-upload {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #eee;
}

.bloc-upload label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #555;
}

.bloc-upload input[type="file"] {
    width: 100%;
    font-size: 13px;
}

#nom_image {
    display: block;
    font-size: 11px;
    color: #888;
    margin-top: 4px;
    word-break: break-all;
}

#image_preview img {
    display: block;
    margin-top: 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

/* ── Liste produits (colonne droite) ───────────────────────────────────────── */
#liste-produits {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ── Barre outils : recherche + pagination ─────────────────────────────────── */
#wps-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

#wps-search-wrap {
    flex: 1 1 180px;
}

#wps-search {
    width: 100%;
    padding: 7px 12px;
    border: 1px solid #ccc;
    border-radius: 20px;
    font-size: 13px;
    box-sizing: border-box;
    background: #fafafa;
    transition: border-color .2s, box-shadow .2s;
}
#wps-search:focus {
    outline: none;
    border-color: #0073aa;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(0,115,170,.15);
}

#wps-pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    font-size: 13px;
}

#wps-pagination button {
    padding: 5px 11px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 12px;
    transition: background .15s;
}
#wps-pagination button:hover:not(:disabled) { background: #eaf4fb; border-color: #0073aa; }
#wps-pagination button:disabled { opacity: .4; cursor: not-allowed; }

#wps-page-info  { font-weight: 600; color: #444; }
#wps-total-info { color: #888; font-size: 12px; }

/* ── Zone de scroll de la table ────────────────────────────────────────────── */
#wps-table-scroll {
    overflow-y: auto;
    max-height: 520px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

/* Scrollbar fine (webkit) */
#wps-table-scroll::-webkit-scrollbar { width: 6px; }
#wps-table-scroll::-webkit-scrollbar-track { background: #f5f5f5; }
#wps-table-scroll::-webkit-scrollbar-thumb { background: #bbb; border-radius: 3px; }
#wps-table-scroll::-webkit-scrollbar-thumb:hover { background: #0073aa; }

#table-produits {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: #fff;
}

#table-produits thead tr {
    position: sticky;
    top: 0;
    z-index: 2;
}

#table-produits th {
    background: #23282d;
    color: #fff;
    padding: 10px 10px;
    text-align: left;
    white-space: nowrap;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

#table-produits td {
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#table-produits tbody tr:hover {
    background: #eaf4fb;
    cursor: pointer;
}

#table-produits tbody tr:last-child td {
    border-bottom: none;
}

/* ── Tags catégories dans la liste ─────────────────────────────────────────── */
td.wps-cats { white-space: normal; max-width: 160px; }

.wps-cat-tag {
    display: inline-block;
    background: #e8f0fe;
    color: #1a56db;
    border: 1px solid #c3d4fc;
    border-radius: 12px;
    padding: 1px 8px;
    font-size: 11px;
    margin: 1px 2px 1px 0;
    white-space: nowrap;
}

/* ── Checkboxes catégories dans le formulaire ──────────────────────────────── */
.wps-categorie-list {
    max-height: 120px;
    overflow-y: auto;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 6px 8px;
    background: #fafafa;
}

.wps-categorie-list::-webkit-scrollbar { width: 4px; }
.wps-categorie-list::-webkit-scrollbar-thumb { background: #bbb; border-radius: 2px; }

label.wps-cat-check {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 0;
    font-size: 13px;
    cursor: pointer;
    font-weight: 400;
    color: #333;
}
label.wps-cat-check:hover { color: #0073aa; }
label.wps-cat-check input[type="checkbox"] {
    width: auto;
    margin: 0;
    accent-color: #0073aa;
}

.wps-btn-delete {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background .15s;
}
.wps-btn-delete:hover { background: #f8d7da; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    #container-2colonnes { flex-direction: column; }
    #formulaire-produits  { flex: 0 0 auto; width: 100%; }
    #wps-table-scroll     { max-height: 400px; }
}
