/* File: /public_html/mte/assets/css/stats_upl.css
   Purpose: UPL wallboard — dark mode, TV-friendly
   Notes: Works with DOM rendered by assets/js/stats_upl.js
*/

/* ====== Dark page surface ====== */
:root {
  --page-pad: 16px;
  --surface-0: #0f172a;  /* slate-900 */
  --surface-2: #0b1220;  /* deep header */
  --panel:     #111827;  /* table/blocks */
  --border:    rgba(148,163,184,.25); /* slate-400 @ 25% */
  --text:      #f1f5f9;  /* slate-100 */
  --muted:     #94a3b8;  /* slate-400 */
}

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--surface-0);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ====== Root container ====== */
.page {
  min-height: 100%;
  padding: var(--page-pad);
  display: flex;
  justify-content: center;
  align-items: stretch;
}

#upl-root {
  position: relative; /* anchor arrows */
  width: 100%;
  max-width: 1400px;
}

/* Show that the wallboard is click-navigable (left=prev, right=next) */
#upl-root.manual-nav { cursor: ew-resize; }

/* ====== Title bar ====== */
.upl-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 12px;
  box-shadow: 0 10px 15px rgba(0,0,0,.25);
}

.upl-title h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

#upl-meta {
  color: var(--muted);
  font-size: 13px;
}

/* ====== Table ====== */
#upl-root table {
  width: 100%;
  border-collapse: collapse;      /* keep header/body grid aligned */
  table-layout: fixed;            /* stable column widths */
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 15px rgba(0,0,0,.25);
}

#upl-root thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

#upl-root tbody td {
  font-size: 13px;
  color: var(--text);
  vertical-align: middle;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  height: 40px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#upl-root tbody tr:last-child td { border-bottom: 0; }

/* Subtle row hover */
#upl-root tbody tr:hover td { background: rgba(148,163,184,.06); }

/* ====== Columns ====== */
#upl-root td[data-field="no"] {
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

#upl-root td[data-field="submitted_at"] {
  color: var(--muted);
  white-space: nowrap;
}

#upl-root td[data-field="part_name"] {
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;      /* two-line clamp by default */
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Marquee for very long part names (JS wraps text in a <span>.
   Do NOT change <td> display; keep table layout intact.) */
#upl-root td.marquee-text {
  white-space: nowrap;
  overflow: hidden;
  -webkit-line-clamp: unset;
  -webkit-box-orient: unset;
}
#upl-root td.marquee-text > span {
  display: inline-block;
  /* CHANGE: Halved the padding to reduce initial delay before text appears. */
  padding-left: 50%;
  padding-right: 50%;
  /* CHANGE: Increased duration to slow down the scroll speed. */
  animation: upl-marquee 25s linear infinite;
}
@keyframes upl-marquee {
  0%   { transform: translateX(0%); }
  100% { transform: translateX(-100%); }
}

/* Stage strip columns (thin) */
#upl-root th[data-col="Awaiting approval"],
#upl-root th[data-col="Not processed yet"],
#upl-root th[data-col="RFQ"],
#upl-root th[data-col="Quotation check"],
#upl-root th[data-col="Quot. submit"],
#upl-root th[data-col="Proses PR"],
#upl-root th[data-col="Proses PO"],
#upl-root th[data-col="PO"],
#upl-root th[data-col="GR"],
#upl-root th[data-col="BSD"]{
  text-align: center;
  width: 46px; min-width: 46px; max-width: 46px;
  padding: 8px 4px;
  border-left: 1px solid var(--border);
}

#upl-root td[data-field^="st_"] {
  width: 46px; min-width: 46px; max-width: 46px;
  text-align: center;
  padding: 0;
  height: 40px;
  border-left: 1px solid var(--border);
}

/* ====== Loading / Error ====== */
.state {
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-weight: 600;
  font-size: 1.1rem;
  min-height: 40vh;
}
.state.show { display: flex; }
.state.error { color: #f87171; }

/* ====== Overlay navigation arrows ====== */
.upl-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(15,23,42,.72);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  z-index: 10;
  opacity: .7;
  transition: opacity .15s ease, background .15s ease, transform .15s ease;
  user-select: none;
}
.upl-nav:hover { opacity: 1; background: rgba(15,23,42,.9); }
.upl-nav:active { transform: translateY(-50%) scale(0.98); }
/* CHANGE: Position arrows outside the main content container. */
.upl-nav.left  { left: -52px; }
.upl-nav.right { right: -52px; }