<?php /* views/orders.php — KREMER Régis v2.6.101 — libellés unités neutres dans Commandes */ ?>

<!-- CSS spécifique au module Commandes -->
<style>
/* ── Boutons actions tableau (SVG) ── */
.oact{width:32px;height:32px;padding:0!important;display:inline-flex;align-items:center;justify-content:center;border-radius:8px;flex-shrink:0}
.oact svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}

/* ── Layout général ── */
.orders-list-view { display:flex;flex-direction:column;gap:1rem;height:100% }
.olv-header {
    display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:.5rem;
    padding-bottom:.75rem;border-bottom:1px solid var(--border)
}
.olv-title { display:flex;align-items:center;gap:.75rem }

/* ── Stats ── */
.orders-stats {
    display:flex;gap:.5rem;flex-wrap:wrap
}
.order-stat-card {
    display:flex;flex-direction:column;align-items:center;
    background:var(--bg-card);border:1px solid var(--border);
    border-radius:var(--r-lg);padding:.6rem 1.1rem;min-width:90px;flex:1;max-width:160px
}
.osc-num  { font-size:1.5rem;font-weight:800;line-height:1 }
.osc-label{ font-size:.72rem;font-weight:600;margin-top:.2rem;text-transform:uppercase;letter-spacing:.04em }

/* ── Filtres ── */
.orders-filters {
    display:flex;gap:.5rem;flex-wrap:wrap;align-items:center
}

/* ── Formulaire plein-écran ── */
.order-form-view {
    display:flex;flex-direction:column;
    min-height:calc(100dvh - var(--safe-top) - 60px);
    margin:-1rem;                /* compenser le padding du main-content */
}
.ofv-nav {
    display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:.5rem;
    padding:.75rem 1rem;
    background:var(--bg-card);
    border-bottom:1px solid var(--border);
    position:sticky;top:0;z-index:20;
}
.ofv-nav h3 { margin:0;font-size:1rem;font-weight:700;flex:1;text-align:center }
.ofv-nav-left, .ofv-nav-right { display:flex;gap:.5rem;align-items:center }

.ofv-body {
    flex:1;overflow-y:auto;padding:1rem;
    display:grid;
    grid-template-columns:320px 1fr;
    gap:1rem;
    align-items:start;
}

/* ── Cards lignes commande ── */
.order-line-card {
    border:1px solid var(--border);border-radius:var(--r-lg);
    padding:1rem;margin-bottom:.65rem;
    background:var(--bg-elevated);position:relative;
    transition:border-color .15s,box-shadow .15s
}
.order-line-card:hover { border-color:var(--blue);box-shadow:0 0 0 3px var(--blue-pale) }
.order-line-card.is-new-prod { border-color:var(--orange);background:rgba(251,146,60,.04) }
.order-line-card.is-new-prod:hover { box-shadow:0 0 0 3px rgba(251,146,60,.15) }

.olc-badge {
    display:inline-flex;align-items:center;gap:4px;
    padding:2px 9px;border-radius:99px;
    font-size:.72rem;font-weight:700;letter-spacing:.02em
}

/* ── Réception ── */
.recv-line-card {
    border:1px solid var(--border);border-radius:var(--r-lg);
    padding:1rem;margin-bottom:.65rem;background:var(--bg-elevated)
}
.recv-line-card.is-done { opacity:.6 }

/* ── Section title ── */
.section-title {
    margin:0 0 .75rem 0;font-size:.8rem;font-weight:700;
    color:var(--text-muted);text-transform:uppercase;letter-spacing:.06em
}

/* ── Responsive mobile ── */
@media(max-width:840px){
    .ofv-body { grid-template-columns:1fr }
    .ofv-nav h3 { display:none }
    .order-form-view { margin:-1rem }
    .ofv-nav-right button span { display:none }
}
@media(max-width:560px){
    .orders-stats { gap:.35rem }
    .order-stat-card { min-width:70px;padding:.5rem .7rem }
    .osc-num { font-size:1.2rem }
    .ofv-nav-right { flex-wrap:wrap;justify-content:flex-end }
    .orders-filters { flex-direction:column;align-items:stretch }
    .orders-filters select { width:100% }
}
/* ── UX catalogue produits (BC) ── */
.ol-prod-tools{display:grid;grid-template-columns:1fr 1.2fr;gap:.5rem;margin:.25rem 0 .5rem}
.ol-prod-results{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.5rem;margin-top:.5rem}
@media (min-width: 980px){ .ol-prod-results{grid-template-columns:repeat(3,minmax(0,1fr));} }
.ol-prod-item{display:flex;gap:.6rem;align-items:center;padding:.55rem;border:1px solid var(--border);border-radius:12px;background:var(--card);cursor:pointer;text-align:left}
.ol-prod-item:hover{border-color:color-mix(in srgb, var(--blue) 35%, var(--border))}
.ol-prod-img{width:44px;height:44px;border-radius:10px;object-fit:cover;border:1px solid var(--border);background:var(--bg2);flex:0 0 auto}
.ol-prod-img.ph{display:flex;align-items:center;justify-content:center;color:var(--text-muted);font-size:18px}
.ol-prod-meta{display:flex;flex-direction:column;gap:.15rem;min-width:0}
.ol-prod-name{font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ol-prod-sku{font-size:12px;color:var(--text-muted)}
.ol-prod-cat{font-size:12px;color:var(--text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ol-prod-empty{padding:.6rem;border:1px dashed var(--border);border-radius:12px;color:var(--text-muted);background:var(--bg2)}
.ol-prod-preview{display:flex;gap:.6rem;align-items:center;margin-top:.5rem;padding:.5rem;border:1px solid var(--border);border-radius:12px;background:var(--bg2)}
.ol-prev-img{width:44px;height:44px;border-radius:10px;object-fit:cover;border:1px solid var(--border);background:var(--card);flex:0 0 auto}
.ol-prev-img.ph{display:flex;align-items:center;justify-content:center;color:var(--text-muted);font-size:18px}
.ol-prev-name{font-weight:700}
.ol-prev-sku{font-size:12px;color:var(--text-muted)}

.ol-prod-pick{display:grid;grid-template-columns:minmax(0,1fr) minmax(220px,320px);gap:.5rem;align-items:start}
.sm-prod-overlay{backdrop-filter:blur(10px);max-width:min(980px,calc(100vw - 24px));}
.sm-prod-item{border:1px solid var(--border);border-radius:14px;background:var(--bg-card);transition:transform .15s ease,border-color .15s ease,box-shadow .15s ease}
.sm-prod-item:hover{transform:translateY(-1px);border-color:color-mix(in srgb, var(--blue) 38%, var(--border));box-shadow:0 10px 24px rgba(15,23,42,.08)}
.sm-prod-item img{width:56px;height:56px;border-radius:12px;object-fit:cover;background:var(--bg-elevated)}
@media(max-width:980px){
  .orders-filters > *{flex:1 1 calc(50% - .5rem)}
  .ol-prod-pick{grid-template-columns:1fr}
}
@media(max-width:640px){
  .olv-header,.orders-filters{align-items:stretch}
  .orders-filters > *{flex:1 1 100%}
  .ofv-nav{padding:.75rem}
  .ofv-nav > *{width:100%}
  .ofv-nav h3{text-align:left}
  .ofv-nav-right{width:100%;justify-content:stretch}
  .ofv-nav-right .btn{flex:1 1 0}
}


/* ── MageStock v2.3.1 — Commandes : images, validation, accessibilité ── */
.order-step-list{display:grid;grid-template-columns:1fr;gap:.35rem;margin-bottom:.65rem}
.order-step{display:flex;align-items:center;min-height:34px;padding:.35rem .55rem;border-radius:10px;background:var(--bg-elevated);border:1px solid var(--border);font-size:.78rem;font-weight:700;color:var(--text-muted)}
.order-step.is-ok{background:var(--green-pale);border-color:color-mix(in srgb,var(--green) 35%,var(--border));color:var(--green)}
.order-step.is-warn{background:rgba(245,158,11,.08);border-color:rgba(245,158,11,.25);color:var(--orange)}
.order-validation-panel{border:1px solid var(--border);border-radius:12px;padding:.65rem .75rem;background:var(--bg-elevated);font-size:.82rem;line-height:1.4}
.order-validation-panel ul{margin:.35rem 0 0 1rem;padding:0}
.order-validation-panel.is-ok{background:var(--green-pale);border-color:color-mix(in srgb,var(--green) 35%,var(--border));color:var(--green)}
.order-validation-panel.is-warning{background:rgba(245,158,11,.08);border-color:rgba(245,158,11,.25);color:var(--orange)}
.order-validation-panel.is-error{background:rgba(239,68,68,.08);border-color:rgba(239,68,68,.28);color:var(--red)}
.ol-product-preview{margin:.55rem 0 .65rem}
.ol-product-preview-empty{border:1px dashed var(--border);border-radius:12px;padding:.65rem;color:var(--text-muted);background:var(--bg-elevated);font-size:.82rem}
.order-product-summary,.recv-product-head{display:flex;gap:.75rem;align-items:center;border:1px solid var(--border);border-radius:14px;padding:.65rem;background:var(--bg-card)}
.order-product-thumb{width:64px;height:64px;border-radius:12px;object-fit:cover;border:1px solid var(--border);background:var(--bg-elevated);flex:0 0 auto}
.order-product-thumb--empty{display:flex;align-items:center;justify-content:center;font-size:24px;color:var(--text-muted)}
.order-product-summary-body,.recv-product-title{min-width:0;flex:1}
.order-product-title{font-weight:800;line-height:1.25;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.order-product-meta{font-size:.78rem;color:var(--text-muted);margin-top:.15rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.order-product-extra{display:flex;gap:.5rem;flex-wrap:wrap;margin-top:.35rem;font-size:.78rem;color:var(--text-muted)}
.recv-product-card.is-done{opacity:.72}
.recv-progress{height:7px;border-radius:999px;background:var(--bg-elevated);overflow:hidden;margin:.65rem 0;border:1px solid var(--border)}
.recv-progress span{display:block;height:100%;background:var(--green);border-radius:999px}
.oact{min-width:44px;min-height:44px}
.ofv-nav .btn,.ofv-add-btn,.ofv-inline-row .btn{min-height:44px}
@media(max-width:600px){
  .order-product-summary,.recv-product-head{align-items:flex-start}
  .order-product-thumb{width:58px;height:58px}
  .order-product-title,.order-product-meta{white-space:normal}
  .ofv-add-btns{position:sticky;bottom:calc(var(--safe-bottom,0px) + .5rem);z-index:12;box-shadow:0 12px 30px rgba(15,23,42,.16)}
  .ol-row-4,.ol-row-3,.ol-row-2h{grid-template-columns:1fr!important}
}

</style>

<!-- Racine SPA — tout le contenu est injecté ici par JS -->
<div id="ordersRoot" class="orders-page" style="height:100%"></div>
