﻿/* YABOX OS — ui.components.css V258
   Composants UI standards + overrides inline-style legacy
   Ce fichier charge APRÈS dashboard.css pour avoir la spécificité finale */

/* ══════════════════════════════════════════════════════════════
   SECTION WRAPPERS — File du jour
   ══════════════════════════════════════════════════════════════ */
.sec-wrap { margin-bottom: 12px; }
.sec-hdr {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; background: var(--bg);
  border-radius: 9px; margin-bottom: 8px; cursor: pointer;
  border: 1px solid var(--border);
}
.sec-bar {
  width: 3px; height: 18px; border-radius: 2px; flex-shrink: 0;
}
.sec-lbl {
  font-weight: 700; font-size: 13px; color: var(--text);
  display: flex; align-items: center; gap: 7px;
}
.sec-cnt {
  font-size: 11px; font-weight: 700; padding: 2px 8px;
  border-radius: 10px; margin-left: 4px;
}
.sec-hint { font-size: 11px; color: var(--text2); margin-top: 1px; }
.sec-cnt{ display:inline-flex;align-items:center; }
.filters {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap; padding: 10px 0; margin-bottom: 8px;
}
/* -- FILTERS BAR : width:100% override for direct filter controls -- */
.filters {
  flex-direction: row;
  flex-wrap: wrap;
  overflow-x: visible;
  overflow-y: visible;
}
.filters .yabox-input,
.filters select,
.filters input {
  width: auto !important;
  flex: 0 0 auto !important;
  min-width: 140px;
  max-width: 200px;
}
.filters > div,
.filters > button {
  flex: 0 0 auto;
}
.filters > button.yabox-input {
  width: auto !important;
  flex: 0 0 auto !important;
  min-width: 140px;
  max-width: 200px;
  height: 34px;
  font-size: 12px;
  padding: 0 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}
.filters > div > button.yabox-input {
  width: 100% !important;
  max-width: 100% !important;
  height: 34px;
  font-size: 12px;
  padding: 0 8px;
  white-space: nowrap;
  box-sizing: border-box;
}
.fclear {
  font-size: 11px; color: var(--text2); cursor: pointer;
  padding: 4px 10px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--bg);
}
.fclear:hover { color: var(--red); border-color: var(--red); }

/* ══════════════════════════════════════════════════════════════
   ORDER CARD ENHANCEMENTS — override inline border-color/bg
   ══════════════════════════════════════════════════════════════ */
.ocard {
  background: var(--white); border: 1px solid var(--border);
  border-radius: 10px; padding: 13px 15px; margin-bottom: 9px;
  transition: all .12s; position: relative;
}
.ocard:hover { box-shadow: 0 2px 10px rgba(0,0,0,.07); transform: translateY(-1px); }

/* Priority color accents via inline border-color — keep them but lighten */
.ocard[style*="background:"] { /* inline bg override — keep it but ensure text readability */ }

/* TAG BADGES — tgh() generates these */
.tag {
  display: inline-flex; align-items: center;
  font-size: 10px; font-weight: 600;
  padding: 2px 8px; border-radius: 9px;
  white-space: nowrap; line-height: 1.4;
}
/* Ensure inline-style tags get correct base sizing even if CSS overridden */
span.tag { font-size: 10px !important; }

/* OCTA ACTION BUTTONS */
.octa {
  display: flex; align-items: center; justify-content: center;
  gap: 5px; padding: 7px 12px; border-radius: 7px;
  border: none; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .12s; white-space: nowrap;
  font-family: inherit; text-decoration: none;
  min-width: 80px; text-align: center;
}
.octa:hover { opacity: .87; transform: scale(.98); }
.octa:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* DOTS — no-answer counter */
.ddots { padding: 4px 0; }
.drow { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.dlbl { font-size: 10px; color: var(--text2); margin-left: 4px; }

/* ══════════════════════════════════════════════════════════════
   STATUS / ETAT TAGS — uniform colors
   ══════════════════════════════════════════════════════════════ */
.tag-livraison  { background: var(--green-bg); color: var(--green-txt); border: 1px solid #BBF7D0; }
.tag-retour     { background: var(--red-bg);   color: var(--red-txt);   border: 1px solid #FCA5A5; }
.tag-attente    { background: var(--orange-bg);color: var(--orange-txt);border: 1px solid #FCD34D; }
.tag-conf       { background: var(--violet-bg);color: var(--violet-txt);border: 1px solid #DDD6FE; }
.tag-new        { background: var(--blue-bg);  color: var(--blue-txt);  border: 1px solid #BFDBFE; }
.tag-closed     { background: var(--bg);       color: var(--text2);     border: 1px solid var(--border); }
.tag-double     { background: #FFFBEB;         color: #92400E;           border: 1px solid #FCD34D; }
.tag-risk       { background: var(--red-bg);   color: var(--red-txt);   border: 1px solid #FCA5A5; }

/* ══════════════════════════════════════════════════════════════
   DATE PICKER POPUP — fix inline styles
   ══════════════════════════════════════════════════════════════ */
#dp-popup {
  display: none; position: absolute; top: 38px; left: 0;
  z-index: 999; background: var(--white);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; min-width: 280px;
  box-shadow: 0 4px 20px rgba(0,0,0,.1);
}
#dp-popup.open { display: block; }
.dp-presets { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 10px; }
.dp-preset-btn {
  padding: 3px 10px; border-radius: 14px; border: 1px solid var(--border);
  background: transparent; color: var(--text2); font-size: 11px;
  cursor: pointer; font-family: inherit; transition: all .1s;
}
.dp-preset-btn.active, .dp-preset-btn:hover {
  background: var(--blue); border-color: var(--blue); color: var(--on-accent);
}
.dp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.dp-label { font-size: 11px; color: var(--text2); display: block; margin-bottom: 3px; }
.dp-input {
  width: 100%; padding: 6px 8px; border: 1px solid var(--border);
  border-radius: 6px; font-family: inherit; font-size: 12px;
  color: var(--text); background: var(--white); outline: none;
}
.dp-input:focus { border-color: var(--blue); }
.dp-actions { display: flex; gap: 8px; justify-content: flex-end; }
.dp-cancel {
  padding: 5px 12px; border-radius: 7px; border: 1px solid var(--border);
  background: transparent; color: var(--text2); cursor: pointer; font-family: inherit;
}
.dp-apply {
  padding: 5px 12px; border-radius: 7px; border: none;
  background: var(--blue); color: var(--on-accent); cursor: pointer;
  font-family: inherit; font-weight: 600;
}

/* ══════════════════════════════════════════════════════════════
   INLINE-STYLE RESCUE — generic helpers to reduce inline styles
   These classes replace the most common inline style patterns
   ══════════════════════════════════════════════════════════════ */
/* Loading / empty states */
.loading-center {
  padding: 48px; text-align: center; color: var(--text2);
  font-size: 13px;
}
.loading-icon { font-size: 28px; margin-bottom: 8px; display: block; }

/* Info banner (inline blue banners in queue) */
.info-banner {
  background: var(--blue-bg); border: 1px solid #BFDBFE;
  border-radius: 9px; padding: 9px 13px; margin-bottom: 11px;
  font-size: 12px; color: var(--blue-txt); font-weight: 600;
}
.success-banner {
  background: var(--green-bg); border: 1px solid #BBF7D0;
  border-radius: 9px; padding: 9px 13px; margin-bottom: 11px;
  font-size: 12px; color: var(--green-txt); font-weight: 600;
}
.warning-banner {
  background: var(--orange-bg); border: 1px solid #FCD34D;
  border-radius: 9px; padding: 9px 13px; margin-bottom: 11px;
  font-size: 12px; color: var(--orange-txt); font-weight: 600;
}

/* ══════════════════════════════════════════════════════════════
   SHIMMER SKELETON — loading states
   ══════════════════════════════════════════════════════════════ */
@keyframes shimmer {
  0%   { background-color: var(--border); }
  50%  { background-color: var(--bg); }
  100% { background-color: var(--border); }
}
.skeleton {
  background: var(--border); border-radius: 8px;
  animation: shimmer 1.2s infinite;
}
.skeleton-card {
  height: 88px; border-radius: 10px; margin-bottom: 8px;
  animation: shimmer 1.2s infinite;
}

/* ══════════════════════════════════════════════════════════════
   KPI ENHANCEMENTS — new design tokens
   ══════════════════════════════════════════════════════════════ */
.kpis { background: var(--white); }
#cai-kbar .kpi { background: var(--bg); border: 1px solid var(--border); }
#cai-kbar .kpil { color: var(--text2); }

/* ══════════════════════════════════════════════════════════════
   TOPBAR REFINEMENTS
   ══════════════════════════════════════════════════════════════ */
/* Sync info text */
#last-sync-info {
  font-size: 10px !important; color: var(--text3) !important;
  max-width: 150px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
/* Notif button */
#btn-notif { position: relative; padding: 6px 10px !important; }
#notif-badge.show, #notif-count.show {
  display: flex !important;
  position: absolute; top: 3px; right: 3px;
  background: var(--red); color: var(--on-accent); border-radius: 50%;
  width: 15px; height: 15px; font-size: 9px; font-weight: 700;
  align-items: center; justify-content: center; line-height: 1;
}
/* Sidebar footer layout */
.agent-info { display: flex; align-items: center; gap: 8px; padding: 5px 4px; }
.agent-info > div[style] { flex: 1; min-width: 0; } /* override inline flex:1 */

/* ══════════════════════════════════════════════════════════════
   CONFIRMATION AI MODULE — cai-* classes
   ══════════════════════════════════════════════════════════════ */
.cai-section {
  background: var(--white); border: 1px solid var(--border);
  border-radius: 10px; margin-bottom: 10px; overflow: hidden;
}
.cai-section .sec-body { padding: 12px 14px; }
.cai-acts {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  padding: 12px 14px; border-top: 1px solid var(--border);
}
.cai-act, .conf-action-btn {
  padding: 9px 8px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: inherit; text-align: center;
  transition: all .12s; display: flex; align-items: center;
  justify-content: center; gap: 5px;
}
.cai-act:hover, .conf-action-btn:hover {
  border-color: var(--border2); transform: translateY(-1px);
}
.cai-act.confirm  { background: var(--green);  color: var(--on-accent); border-color: var(--green); }
.cai-act.recall   { background: var(--blue-bg); color: var(--blue-txt); border-color: #BFDBFE; }
.cai-act.noanswer { background: var(--orange-bg); color: var(--orange-txt); border-color: #FCD34D; }
.cai-act.cancel   { background: var(--red-bg); color: var(--red-txt); border-color: #FCA5A5; }
.cai-act.fake     { background: #FFF1F2; color: #BE123C; border-color: #FFE4E6; }
.cai-act.waiting  { background: var(--bg); color: var(--text2); border-color: var(--border); }

/* ══════════════════════════════════════════════════════════════
   STOCK / PRODUITS MODULE
   ══════════════════════════════════════════════════════════════ */
.an-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px; margin-bottom: 10px;
}
.an-kpi {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 9px; padding: 11px 13px;
}
.an-kpi-val { font-size: 22px; font-weight: 800; color: var(--text); }
.an-kpi-lbl { font-size: 11px; color: var(--text2); margin-top: 3px; }
.an-sec { margin-bottom: 14px; }

/* Tbtn / Tbadge — internal table buttons */
.tbtn {
  padding: 4px 10px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--bg); font-size: 11px;
  color: var(--text2); cursor: pointer; font-family: inherit;
}
.tbtn:hover { border-color: var(--border2); color: var(--text); }
.tbadge {
  font-size: 10px; font-weight: 600; padding: 2px 8px;
  border-radius: 9px; white-space: nowrap;
}

/* V304: finance/caisse modal buttons must stay clickable above modal content. */
.sselbtn {
  pointer-events: auto;
  position: relative;
  z-index: 2;
}
.sselbtn * { pointer-events: none; }

/* ══════════════════════════════════════════════════════════════
   DISPATCH / TRACKING MODULE
   ══════════════════════════════════════════════════════════════ */
.dispatch-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.dispatch-col { min-width: 0; }
.dispatch-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: 10px; padding: 13px; margin-bottom: 8px;
}
.dispatch-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.dispatch-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* ══════════════════════════════════════════════════════════════
   FINANCE MODULE
   ══════════════════════════════════════════════════════════════ */
.finance-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px;
  margin-bottom: 14px;
}
.finance-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: 10px; padding: 13px;
}
.finance-card .kpiv { font-size: 22px; }

/* ══════════════════════════════════════════════════════════════
   NOTIF + TV DASHBOARD BUTTON in sidebar
   ══════════════════════════════════════════════════════════════ */
.dbtn {
  background: none; border: none; cursor: pointer;
  font-size: 15px; padding: 5px; border-radius: 6px;
  color: var(--text3); transition: all .12s;
}
.dbtn:hover { background: var(--bg-hover); color: var(--text); }

/* ══════════════════════════════════════════════════════════════
   SEARCH DROPDOWN — uniform
   ══════════════════════════════════════════════════════════════ */
.search-drop { font-size: 12.5px; }
.search-grp-hdr { font-size: 10px; letter-spacing: .5px; }
.search-item-title { color: var(--text); }
.search-item-sub { color: var(--text2); }
.search-item-tag {
  font-size: 10px; padding: 2px 7px; border-radius: 5px;
  background: var(--bg); border: 1px solid var(--border);
}

/* ══════════════════════════════════════════════════════════════
   GENERIC HELPERS — replace most common inline patterns
   ══════════════════════════════════════════════════════════════ */
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap-8 { display: flex; align-items: center; gap: 8px; }
.text-muted { color: var(--text2); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 10px; }
.fw-700 { font-weight: 700; }
.mt-8 { margin-top: 8px; }
.mb-8 { margin-bottom: 8px; }
.p-center { padding: 40px; text-align: center; color: var(--text2); }
.spin { display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════════
   INLINE-STYLE OVERRIDES — force new design tokens
   When JS generates inline styles with hardcoded hex values,
   these rules use higher specificity to apply our tokens
   ══════════════════════════════════════════════════════════════ */
/* Force white background on cards even if inline bg set */
#app .cbox, #app .ocard {
  /* inherit from JS-set style, but ensure vars are used */
  color: var(--text);
}
/* Ensure kpis always use our grid */
#app .kpis { display: grid; }

/* Confirmation AI panel: ensure detail and list use new spacing */
#cai-list .ocard { margin-bottom: 8px; }
#cai-detail { overflow-y: auto; }

/* Filter bar: override inline display:none on topbar */
#srch-wrap input { font-size: 12px; }

/* Tabs area — override display:none set by JS until module loads */
#tabs { display: none; }

/* Page-sub inline text */
.page-sub { font-size: 12px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── yabox-btn alias for ui.components.css ── */
.yabox-btn {
  display:inline-flex;align-items:center;gap:5px;padding:7px 13px;
  border-radius:8px;border:1px solid var(--border);background:var(--white);
  color:var(--text);font-size:12.5px;font-weight:500;cursor:pointer;
  transition:all .12s;font-family:inherit;white-space:nowrap;
}
.yabox-btn:hover{border-color:var(--blue);color:var(--blue);}
.yabox-btn-primary{background:var(--blue);border-color:var(--blue);color:var(--on-accent);}
/* V296 Roles & Permissions */
.roles-page{
  display:flex;
  flex-direction:column;
  gap:16px;
}
.roles-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:14px;
}
.roles-title{
  font-size:15px;
  font-weight:800;
  color:var(--text);
}
.roles-subtitle{
  font-size:12px;
  color:var(--text2);
  margin-top:2px;
}
.roles-actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.role-user-section{
  margin-bottom:14px;
}
.role-section-title{
  margin-bottom:8px;
  color:var(--text2);
  font-size:11px;
  font-weight:700;
  letter-spacing:0;
  text-transform:uppercase;
}
.role-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  margin-bottom:12px;
}
.role-card{
  border:1px solid color-mix(in srgb, var(--role-color, var(--blue)) 28%, var(--border));
  border-radius:8px;
  background:linear-gradient(180deg,color-mix(in srgb, var(--role-color, var(--blue)) 7%, var(--white)),var(--white));
  padding:12px;
}
.role-system-card{
  display:flex;
  flex-direction:column;
  gap:5px;
  min-height:112px;
}
.role-card-title{
  color:var(--role-color, var(--blue));
  font-size:13px;
  font-weight:800;
}
.role-card-desc{
  color:var(--text2);
  font-size:11px;
  line-height:1.35;
  flex:1;
}
.role-create-btn{
  min-height:30px;
  align-self:flex-start;
  font-size:12px;
  font-weight:700;
}
.role-table-wrap{
  overflow-x:auto;
  border:1px solid var(--border);
  border-radius:8px;
}
.role-permission-table{
  width:100%;
  min-width:620px;
  border-collapse:collapse;
  font-size:11px;
}
.role-permission-table thead tr{
  background:var(--bg);
}
.role-permission-table th,
.role-permission-table td{
  padding:7px 8px;
  border-bottom:1px solid var(--border);
}
.role-permission-table th{
  text-align:left;
  color:var(--text2);
  font-weight:800;
}
.role-permission-table th:not(:first-child),
.role-table-center{
  text-align:center;
}
.role-table-label{
  font-weight:600;
}
.role-custom-card{
  margin-bottom:8px;
}
.role-custom-head{
  display:flex;
  align-items:center;
  gap:8px;
  margin-bottom:10px;
}
.role-color-dot{
  width:12px;
  height:12px;
  border-radius:999px;
  background:var(--role-color, var(--blue));
  flex:0 0 auto;
}
.role-custom-title{
  font-size:14px;
  font-weight:800;
}
.role-permission-count{
  border-radius:8px;
  background:var(--bg);
  color:var(--text2);
  padding:2px 8px;
  font-size:11px;
}
.role-card-actions{
  display:flex;
  gap:6px;
  margin-left:auto;
}
.role-icon-btn{
  min-width:34px;
  padding:4px 10px;
  font-size:11px;
}
.role-danger-btn{
  border-color:var(--red);
  color:var(--red);
}
.role-permission-tags{
  display:flex;
  flex-wrap:wrap;
  gap:4px;
}
.role-permission-tag{
  border-radius:8px;
  background:var(--bg);
  color:var(--text2);
  padding:2px 7px;
  font-size:10px;
  line-height:1.4;
}
.role-permission-tag.is-on{
  background:#ECFDF5;
  color:var(--green);
}
.role-user-modal{
  overflow:hidden;
  border-radius:12px;
  background:var(--white);
}
.role-user-form{
  display:grid;
  gap:12px;
  max-height:72vh;
  overflow-y:auto;
}
.role-form-row{
  display:grid;
  gap:10px;
}
.role-form-row-2{
  grid-template-columns:repeat(2,minmax(0,1fr));
}
.role-form-row-3{
  grid-template-columns:repeat(3,minmax(0,1fr));
}
.role-user-input,
#ru-name,
#ru-email,
#ru-user,
#ru-pwd{
  min-height:38px;
}
.role-color-input{
  width:100%;
  height:38px;
  border:1.5px solid var(--border);
  border-radius:8px;
  background:var(--white);
  cursor:pointer;
}
.role-check-grid{
  display:grid;
  gap:7px;
  padding:9px;
  border:1px solid var(--border);
  border-radius:8px;
  background:var(--bg);
}
.role-check-grid-inline{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}
.role-hub-grid{
  grid-template-columns:repeat(3,minmax(0,1fr));
  max-height:132px;
  overflow-y:auto;
}
.role-check{
  display:flex;
  align-items:center;
  gap:6px;
  color:var(--text);
  font-size:12px;
}
.role-check-small{
  font-size:11px;
}
.role-check input,
.role-active-toggle input{
  accent-color:var(--blue);
}
.role-active-toggle{
  display:flex;
  align-items:center;
  gap:8px;
  color:var(--text);
  font-size:13px;
}
@media (max-width: 720px){
  .roles-header{
    align-items:flex-start;
    flex-direction:column;
  }
  .roles-actions,
  .roles-actions .obtn{
    width:100%;
  }
  .role-grid,
  .role-form-row-2,
  .role-form-row-3,
  .role-hub-grid{
    grid-template-columns:1fr;
  }
  .role-create-btn{
    align-self:stretch;
  }
  .role-custom-head{
    align-items:flex-start;
    flex-wrap:wrap;
  }
  .role-card-actions{
    width:100%;
    margin-left:0;
  }
  .role-icon-btn{
    flex:1;
  }
}

