/* =============================================================
   LEP 32 Mould Progress Board – styles.css
   Excel-like shopfloor board aesthetic
   ============================================================= */

/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Verdana', 'Arial Narrow', Arial, sans-serif;
  font-size: 9px;
  background: #E8E8E8;
  color: #1A1A1A;
  overflow: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Toolbar ──────────────────────────────────────────────── */
#toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1F3864;
  color: #FFFFFF;
  padding: 4px 10px;
  height: 44px;
  flex-shrink: 0;
  border-bottom: 2px solid #0D2137;
  z-index: 100;
}

#toolbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

#logo {
  font-size: 18px;
  font-weight: 900;
  color: #00B0F0;
  letter-spacing: 1px;
  font-style: italic;
}

#board-title {
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 0.3px;
}

#planned-calendar {
  background: #2E75B6;
  color: #FFF;
  font-size: 8px;
  font-weight: bold;
  padding: 2px 6px;
  border: 1px solid #1B4F8A;
}

#toolbar-right {
  display: flex;
  gap: 6px;
  align-items: center;
}

.btn {
  background: #2E75B6;
  color: #FFF;
  border: 1px solid #1B4F8A;
  padding: 3px 8px;
  font-size: 9px;
  font-family: inherit;
  cursor: pointer;
  border-radius: 2px;
  white-space: nowrap;
}
.btn:hover     { background: #3A8FD8; }
.btn:active    { background: #1B4F8A; }
.btn--active   { background: #C00000; border-color: #900; }

/* ── Board scroll container ───────────────────────────────── */
#board-scroll {
  flex: 1;
  overflow: auto;
  position: relative;
  background: #D0D0D0;
}

/* ── Board inner (full width including left panel) ─────────── */
#board {
  display: inline-block;
  min-width: max-content;
  background: #FFFFFF;
  border: 1px solid #888;
}

/* ── Sticky time header ───────────────────────────────────── */
#board-header {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 30;
  background: #D9D9D9;
  border-bottom: 2px solid #888;
}

#header-corner {
  position: sticky;
  left: 0;
  z-index: 40;
  width: 192px;     /* matches CONFIG.leftPx */
  flex-shrink: 0;
  background: #C0C0C0;
  border-right: 2px solid #666;
  padding: 2px 4px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-weight: bold;
  font-size: 8px;
}

#header-time {
  display: flex;
  flex-direction: column;
  flex: 1;
}

#header-hours {
  display: flex;
  height: 16px;
  background: #D9D9D9;
  border-bottom: 1px solid #AAA;
}

.hour-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: bold;
  border-right: 1px solid #888;
  color: #1A1A1A;
  flex-shrink: 0;
  background: #D9D9D9;
}
.hour-cell:nth-child(even) { background: #C8C8C8; }

#header-minutes {
  display: flex;
  height: 14px;
  background: #E8E8E8;
}

.minute-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7px;
  border-right: 1px solid #CCC;
  flex-shrink: 0;
  color: #555;
  background: #E8E8E8;
}
.minute-cell--hour {
  border-right: 1px solid #888;
  color: #333;
  font-weight: bold;
}

/* ── Board body ───────────────────────────────────────────── */
#board-body { display: flex; flex-direction: column; }

/* ── Generic board row ────────────────────────────────────── */
.board-row {
  display: flex;
  flex-shrink: 0;
  border-bottom: 1px solid #CCCCCC;
}

/* ── Sticky left label ────────────────────────────────────── */
.row-label {
  position: sticky;
  left: 0;
  z-index: 20;
  width: 192px;
  flex-shrink: 0;
  border-right: 2px solid #999;
  display: flex;
  align-items: center;
  padding: 0 4px;
  font-size: 8px;
  overflow: hidden;
  background: #F2F2F2;
}

/* ── Section header row ───────────────────────────────────── */
.section-header-row { border-bottom: 2px solid #888; }

.section-header-label {
  background: #595959 !important;
  color: #FFFFFF;
  font-weight: bold;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-right: 2px solid #333;
}

.section-header-timeline {
  border-top: none;
}

/* ── Op-number row ────────────────────────────────────────── */
.op-number-row { background: #FAFAFA; }
.op-label { font-size: 7px; color: #666; font-style: italic; }

/* ── Process row ──────────────────────────────────────────── */
.process-label {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1px;
}

.va-text {
  font-size: 7px;
  color: #444;
  white-space: nowrap;
  writing-mode: horizontal-tb;
}

.mould-name {
  font-size: 10px;
  font-weight: bold;
  color: #1A1A1A;
}

/* ── Process timeline (position:relative container) ───────── */
.process-timeline {
  position: relative;
  flex-shrink: 0;
  /* Vertical slot gridlines via CSS background */
  background-image:
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 21px,
      #D8D8D8 21px,
      #D8D8D8 22px
    ),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 85px,
      #AAAAAA 85px,
      #AAAAAA 86px
    );
  background-size: 22px 100%, 88px 100%;
}

/* ── Process block ────────────────────────────────────────── */
.process-block {
  position: absolute;
  display: flex;
  align-items: center;
  padding: 0 3px;
  border: 1px solid rgba(0,0,0,0.35);
  border-radius: 1px;
  overflow: hidden;
  user-select: none;
  box-shadow: 1px 1px 2px rgba(0,0,0,0.2);
  transition: box-shadow 0.1s;
  gap: 3px;
}
.process-block:hover { box-shadow: 0 0 0 2px #333, 1px 1px 3px rgba(0,0,0,0.4); z-index: 10; }
.process-block:active { cursor: grabbing; }
.process-block--locked { cursor: not-allowed; opacity: 0.85; }

.process-label-text {
  font-size: 8px;
  font-weight: bold;
  color: rgba(0,0,0,0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  text-shadow: 0 0 3px rgba(255,255,255,0.6);
}

.op-badge {
  font-size: 7px;
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(0,0,0,0.25);
  border-radius: 2px;
  padding: 0 2px;
  font-weight: bold;
  flex-shrink: 0;
  pointer-events: none;
}

/* ── Operator required row ────────────────────────────────── */
.opr-row { background: #F5F5F5; }
.opr-label { font-size: 7px; color: #555; }

/* ── Crane row ────────────────────────────────────────────── */
.crane-row   { background: #F0F0F0; border-bottom: 1px solid #CCCCCC; }
.crane-label { font-size: 7px; color: #666; }

/* ── Slot grid (operator-required / crane / manning data) ─── */
.slot-grid {
  display: flex;
  flex-shrink: 0;
}

.slot-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7px;
  border-right: 1px solid #D8D8D8;
  flex-shrink: 0;
  color: #333;
}
.slot-cell--hour { border-right: 1px solid #AAAAAA; }

/* ── Manning section ──────────────────────────────────────── */
#manning-container { border-top: 3px double #555; }

.manning-bar-row { background: #FAFAFA; }

.manning-bar-label {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  font-size: 7px;
  color: #333;
  font-weight: bold;
}
.small-text { font-size: 6.5px; font-weight: normal; color: #666; }

.manning-bar-timeline {
  position: relative;
  flex-shrink: 0;
  background: #FAFAFA;
  border-bottom: 2px solid #333;
  /* vertical guide lines same as process-timeline */
  background-image:
    repeating-linear-gradient(90deg, transparent 0, transparent 21px, #DDDDDD 21px, #DDDDDD 22px),
    repeating-linear-gradient(90deg, transparent 0, transparent 85px, #AAAAAA 85px, #AAAAAA 86px);
  background-size: 22px 100%, 88px 100%;
}

.manning-bar {
  position: absolute;
  width: 21px;
  transition: height 0.15s ease;
}

.manning-data-row { }
.manning-data-label {
  font-size: 7px;
  color: #333;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
}

.manning-data-grid .slot-cell { font-size: 7px; font-weight: bold; }

/* ── Scrollbar styling ────────────────────────────────────── */
#board-scroll::-webkit-scrollbar        { width: 12px; height: 12px; }
#board-scroll::-webkit-scrollbar-track  { background: #CCC; }
#board-scroll::-webkit-scrollbar-thumb  { background: #888; border: 2px solid #CCC; border-radius: 2px; }
#board-scroll::-webkit-scrollbar-thumb:hover { background: #555; }
#board-scroll::-webkit-scrollbar-corner { background: #CCC; }

/* ── Drag ghost visual ────────────────────────────────────── */
.process-block[style*="opacity: 0.55"] {
  outline: 2px dashed #333;
  z-index: 999 !important;
}
