/* Pages « BDD Produits » et « Import produits » — habillage v2 (actif seulement dans le cadre /v2). */

/* ---------- en-tête de page ---------- */
body.embed .pg-head{display:flex;align-items:flex-end;gap:16px;flex-wrap:wrap;margin:4px 0 16px}
body.embed .pg-head .t{flex:1;min-width:220px}
body.embed .pg-head h1{font-size:22px;font-weight:700;letter-spacing:-.015em;margin:0}
body.embed .pg-head p{margin:2px 0 0;color:var(--sub)}
body.embed .pg-head .pg-actions{display:flex;gap:10px;flex-wrap:wrap}

/* ---------- barre de filtres ---------- */
body.embed #page-produits-v2 .toolbar-card{margin-bottom:14px}
body.embed #page-produits-v2 .filters-row{display:flex;flex-wrap:wrap;align-items:center;gap:10px}
body.embed #pv2-search{flex:1 1 260px;min-width:200px;padding-left:38px;
  background:var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%239AA6B2' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 12px center}
body.embed #page-produits-v2 .select-sm{flex:0 1 190px;min-width:150px}
body.embed #pv2-status{font-size:13.5px;color:var(--sub);font-weight:500;margin:0 0 12px}
body.embed #pv2-status:empty{display:none}

/* ---------- barre de sélection (collante) ---------- */
body.embed #pv2-selection-bar:not([hidden]){position:sticky;top:8px;z-index:20;display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;
  background:var(--accent-soft);border-color:var(--accent);box-shadow:0 6px 18px rgba(20,30,40,.14)}
body.embed #pv2-selection-count{font-weight:600;color:var(--accent);font-size:14px}

/* ---------- cartes produit ---------- */
body.embed #pv2-grid.grid{grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:16px}
body.embed #pv2-grid .product-card{background:var(--card);border:1px solid var(--border);border-radius:var(--radius);overflow:hidden;display:flex;flex-direction:column}
body.embed #pv2-grid .product-thumb{height:170px;cursor:pointer;background:var(--chip);font-size:38px}
body.embed #pv2-grid .product-thumb img{object-fit:contain;padding:10px;background:#fff}
body.embed #pv2-grid .product-select-check{top:10px;left:10px;width:22px;height:22px;accent-color:var(--accent);cursor:pointer;opacity:.85}
body.embed #pv2-grid .product-card:hover .product-select-check,body.embed #pv2-grid .product-select-check:checked{opacity:1}
body.embed #pv2-grid .product-body{padding:14px 16px 10px;gap:3px}
body.embed .product-card .pc-brand{font-size:11.5px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--accent)}
body.embed #pv2-grid .product-title{font-size:15px;font-weight:600;line-height:1.35;color:var(--text);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
body.embed .product-card .pc-ref{font:500 12.5px/1.3 ui-monospace,"SF Mono",ui-monospace,Consolas,monospace;color:var(--sub)}
body.embed .product-card .pc-price{margin-top:8px;font-size:18px;font-weight:700;letter-spacing:-.01em;color:var(--text)}
body.embed .product-card .pc-price small{font-size:12px;font-weight:500;color:var(--sub);letter-spacing:0;margin-left:4px}
body.embed #pv2-grid .product-meta{font-size:12.5px;color:var(--sub);margin-top:2px}
body.embed #pv2-grid .product-actions{padding:6px 16px 16px;gap:8px}
body.embed #pv2-grid .product-actions .btn-edit-v2{flex:1}
body.embed #pv2-grid .product-actions .btn{min-height:38px}
body.embed #pv2-grid .product-card:has(.product-select-check:checked){border-color:var(--accent);box-shadow:0 0 0 2px var(--accent-soft)}

/* état vide / chargement */
body.embed #pv2-grid > p.muted,body.embed #iv2-results > p.muted{grid-column:1/-1;text-align:center;padding:48px 16px;border:1px dashed var(--line-strong);border-radius:var(--radius);background:var(--card)}

/* ---------- fenêtre produit ---------- */
body.embed #produit-v2-modal .modal{width:760px;padding:0;overflow:auto}
body.embed #produit-v2-modal #pv2-modal-title{position:sticky;top:0;z-index:5;margin:0;padding:18px 24px;background:var(--card);border-bottom:1px solid var(--border);font-size:18px;font-weight:700}
body.embed #produit-v2-form{padding:8px 24px 0}
body.embed #produit-v2-form label{display:flex;flex-direction:column;margin:12px 0 0;font-weight:500}
body.embed #produit-v2-form h4{font-size:12px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--sub);margin:24px 0 8px;padding-top:16px;border-top:1px solid var(--border)}
body.embed #produit-v2-form .form-grid{gap:0 14px}
body.embed #produit-v2-form .modal-actions{position:sticky;bottom:0;z-index:5;margin:20px -24px 0;padding:14px 24px;background:var(--card);border-top:1px solid var(--border);flex-wrap:wrap}
body.embed #produit-v2-form .modal-actions #btn-delete-produit-v2{margin-right:auto}
body.embed #pv2-complements-table td .input{min-width:80px;padding:5px 8px;min-height:34px}
body.embed #pv2-complements-table td:first-child .input,body.embed #pv2-complements-table td:nth-child(2) .input{min-width:130px}

/* ---------- modification groupée ---------- */
body.embed #bulk-edit-modal .modal{width:560px}
body.embed #bulk-edit-modal .form-grid{grid-template-columns:200px 1fr;gap:10px 14px;align-items:center;margin-top:14px}
body.embed #bulk-edit-modal .form-grid label{color:var(--text);font-size:14px;min-height:38px}
body.embed #bulk-edit-modal input[type=checkbox],body.embed #pack-modal input[type=checkbox]{width:18px;height:18px;accent-color:var(--accent)}
body.embed #bulk-edit-modal .input:disabled{background:var(--chip);opacity:.6}

/* ---------- packs ---------- */
body.embed #pack-modal .modal{width:720px}
body.embed #pack-modal .cart-list{max-height:none}
body.embed #pack-list .cart-item{padding:12px 14px;font-size:14px;border:1px solid var(--border);background:var(--card);border-radius:var(--radius-sm)}

/* ---------- Import produits ---------- */
body.embed .iv2-drop{display:flex;flex-direction:column;gap:14px;align-items:flex-start}
body.embed .iv2-steps{display:flex;gap:18px;flex-wrap:wrap;margin:0;padding:0;list-style:none;counter-reset:s}
body.embed .iv2-steps li{counter-increment:s;display:flex;align-items:center;gap:8px;font-size:13.5px;color:var(--sub)}
body.embed .iv2-steps li::before{content:counter(s);display:grid;place-items:center;width:22px;height:22px;border-radius:50%;background:var(--accent-soft);color:var(--accent);font-weight:700;font-size:12px}
body.embed .iv2-file-row{display:flex;gap:10px;flex-wrap:wrap;align-items:center;width:100%}
body.embed #iv2-file{flex:1 1 320px;padding:10px 12px;border-style:dashed;background:var(--chip);cursor:pointer}
body.embed #iv2-progress{color:var(--accent)}

body.embed #iv2-results > .card{padding:16px 18px;margin-bottom:12px}
body.embed #iv2-results .card > strong{font-size:15px}
body.embed #iv2-results .card > label.filters-row{display:flex;align-items:flex-start;gap:12px;cursor:pointer}
body.embed #iv2-results input[type=checkbox]{width:18px;height:18px;accent-color:var(--accent);flex:none;margin-top:2px}
body.embed #iv2-results .card:has(.iv2-new-check:checked){border-color:var(--ok)}
body.embed #iv2-results .card:has(.badge.warn){border-left:4px solid var(--warn)}
body.embed .iv2-photos{display:flex;gap:12px;margin:10px 0}
body.embed .iv2-photo-box{display:flex;flex-direction:column;gap:4px;align-items:center;justify-content:center;min-width:110px;min-height:90px;padding:8px;border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--chip)}
body.embed .iv2-photo-box img{max-height:90px;border-radius:4px}
body.embed #iv2-results .table{width:100%;border:1px solid var(--border);border-radius:var(--radius-sm);overflow:hidden;border-collapse:separate;border-spacing:0}
body.embed .iv2-final-cell{font-weight:600;color:var(--ok);background:var(--ok-soft)}

body.embed #iv2-apply-card:not([hidden]){position:sticky;bottom:12px;z-index:20;display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;
  box-shadow:0 8px 24px rgba(20,30,40,.18);border-color:var(--accent)}
body.embed #iv2-apply-card #iv2-summary{margin:0;font-weight:600;color:var(--text)}
body.embed #iv2-apply-card .btn.full{width:auto;min-width:220px}

@media (max-width:720px){
  body.embed .content{padding:8px 14px 28px}
  body.embed #pv2-grid.grid{grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:12px}
  body.embed #pv2-grid .product-thumb{height:130px}
  body.embed #bulk-edit-modal .form-grid{grid-template-columns:1fr}
  body.embed #produit-v2-modal .modal{width:96vw}
}

/* lignes ordonnables (compléments, champs libres) : boutons d'ordre à gauche, toujours visibles */
body.embed .row-act,.row-act{display:inline-flex;align-items:center;gap:4px;white-space:nowrap}
body.embed .row-grip,.row-grip{cursor:grab;color:var(--sub);font-size:18px;line-height:1;padding:0 4px;user-select:none;touch-action:none}
body.embed .row-grip:active,.row-grip:active{cursor:grabbing}
body.embed .row-act .icon-btn,.row-act .icon-btn{width:30px;height:30px;font-size:12px}
body.embed .row-act .row-del,.row-act .row-del{color:var(--danger)}
body.embed tr.row-dragging,tr.row-dragging,.row-dragging{opacity:.5;outline:2px dashed var(--accent)}
body.embed .comp-th-act,.comp-th-act{width:1%;white-space:nowrap}
body.embed #pv2-complements-table td.comp-act,#pv2-complements-table td.comp-act{padding-left:8px;padding-right:4px}
body.embed .pv2-ligne-extra-row,.pv2-ligne-extra-row{align-items:center}

/* Perf : les cartes hors écran ne sont ni mises en page ni dessinées (milliers de produits) */
#pv2-grid .product-card{content-visibility:auto;contain-intrinsic-size:auto 340px}
