/* ============================================
   machine.css — 기계화면 전용 스타일
   원본: mia machine.html
   접두사: mch-
   ============================================ */

/* main override */
main:has(.mch-body) {
  overflow: hidden !important;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ── 3-Column Layout ── */
.mch-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* ── Worker Panel (Left 280px) ── */
.mch-worker-panel {
  width: 280px;
  flex-shrink: 0;
  background: white;
  border-right: 1px solid var(--tint);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mch-worker-section {
  padding: 1.25rem;
  border-bottom: 1px solid var(--tint);
}
.mch-worker-section-title {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* QR Scan Area */
.mch-qr-scan-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
.mch-qr-icon-box {
  width: 80px;
  height: 80px;
  border-radius: 16px;
  background: var(--background);
  border: 2px dashed var(--tint);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--light);
  transition: all 0.3s;
  cursor: pointer;
}
.mch-qr-icon-box:hover {
  border-color: #3B82F6;
  color: #3B82F6;
  background: rgba(59,130,246,0.05);
}
.mch-qr-icon-box.mch-scanned {
  border-style: solid;
  border-color: #22C55E;
  color: #22C55E;
  background: rgba(34,197,94,0.05);
}
.mch-qr-scan-text {
  font-size: 0.75rem;
  color: var(--light);
  text-align: center;
}
.mch-qr-scan-btn {
  width: 100%;
  padding: 0.625rem;
  border-radius: 8px;
  border: 1px solid #3B82F6;
  background: #3B82F6;
  color: white;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
}
.mch-qr-scan-btn:hover { background: #2563EB; }
.mch-qr-scan-btn.mch-logout {
  background: white;
  color: #EF4444;
  border-color: #EF4444;
}
.mch-qr-scan-btn.mch-logout:hover { background: #FEF2F2; }

/* Current Worker Card */
.mch-worker-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--background);
  border-radius: 10px;
  border: 1px solid var(--tint);
}
.mch-worker-card.mch-active {
  border-color: #22C55E;
  background: rgba(34,197,94,0.04);
}
.mch-worker-card.mch-empty {
  border-style: dashed;
  justify-content: center;
  padding: 1.25rem;
}
.mch-worker-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}
.mch-worker-avatar.mch-on { background: linear-gradient(135deg, #22C55E, #16A34A); color: white; }
.mch-worker-avatar.mch-off { background: var(--bg-light); color: var(--light); }
.mch-worker-info { flex: 1; min-width: 0; }
.mch-worker-name { font-size: 0.875rem; font-weight: 600; color: var(--brand); }
.mch-worker-meta { font-size: 0.6875rem; color: var(--light); margin-top: 1px; }
.mch-worker-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.mch-worker-status-dot.mch-on { background: #22C55E; animation: mchLiveDot 1.5s ease-in-out infinite; }
.mch-worker-status-dot.mch-off { background: var(--tint); }

/* Work Action Buttons */
.mch-work-action-btn {
  width: 100%;
  padding: 0.875rem;
  border-radius: 10px;
  font-size: 0.9375rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
}
.mch-work-action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.mch-work-action-btn.mch-btn-start { background: #3B82F6; color: white; }
.mch-work-action-btn.mch-btn-start:not(:disabled):hover { background: #2563EB; }
.mch-work-action-btn.mch-btn-hold { background: white; color: #D97706; border: 2px solid #F59E0B; }
.mch-work-action-btn.mch-btn-hold:not(:disabled):hover { background: #FFFBEB; }
.mch-work-action-btn.mch-btn-done { background: #22C55E; color: white; }
.mch-work-action-btn.mch-btn-done:not(:disabled):hover { background: #16A34A; }

/* Toast */
.mch-no-worker-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #1F2937;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: mchToastIn 0.3s ease, mchToastOut 0.3s ease 2.7s forwards;
}

@keyframes mchToastIn { from { opacity: 0; transform: translateX(-50%) translateY(-10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes mchToastOut { to { opacity: 0; transform: translateX(-50%) translateY(-10px); } }

/* QR Modal */
.mch-qr-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
}
.mch-qr-modal-overlay.mch-show { display: flex; }
.mch-qr-modal {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  width: 380px;
  max-width: 90vw;
  box-shadow: 0 24px 80px rgba(0,0,0,0.2);
  text-align: center;
}
.mch-qr-modal h3 { font-size: 1.125rem; font-weight: 700; color: var(--brand); margin-bottom: 0.5rem; }
.mch-qr-modal p { font-size: 0.8125rem; color: var(--light); margin-bottom: 1.5rem; }
.mch-qr-worker-list { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1.5rem; }
.mch-qr-worker-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--tint);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}
.mch-qr-worker-option:hover { border-color: #3B82F6; background: rgba(59,130,246,0.03); }
.mch-qr-worker-option .mch-w-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #3B82F6, #1E40AF);
  color: white; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.8125rem;
}
.mch-qr-worker-option .mch-w-name { font-size: 0.875rem; font-weight: 600; color: var(--brand); }
.mch-qr-worker-option .mch-w-role { font-size: 0.6875rem; color: var(--light); }
.mch-qr-modal-cancel {
  padding: 0.5rem 1.5rem;
  border: 1px solid var(--tint);
  border-radius: 8px;
  background: white;
  color: var(--tertiary);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.mch-qr-modal-cancel:hover { background: var(--background); }

/* ── Viewer + List wrapper ── */
.mch-viewer-and-list { flex: 1; display: flex; overflow: hidden; }

/* ── PDF Viewer ── */
.mch-pdf-viewer {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-light);
  padding: 1.5rem;
  display: flex;
  justify-content: center;
}
.mch-pdf-viewer::-webkit-scrollbar { width: 6px; }
.mch-pdf-viewer::-webkit-scrollbar-track { background: transparent; }
.mch-pdf-viewer::-webkit-scrollbar-thumb { background: var(--tint); border-radius: 3px; }
.mch-pdf-paper {
  background: white;
  width: 100%;
  max-width: 800px;
  min-height: 600px;
  border-radius: 4px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.08);
  padding: 3rem;
  font-size: 0.875rem;
  color: var(--brand);
  align-self: flex-start;
}
.mch-pdf-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 2px solid var(--brand);
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
}
.mch-pdf-header-left { display: flex; flex-direction: column; justify-content: flex-end; }
.mch-pdf-title { font-size: 1.5rem; font-weight: 800; letter-spacing: 6px; color: var(--brand); }
.mch-pdf-company { font-size: 0.8125rem; color: var(--tertiary); margin-top: 0.25rem; }
.mch-pdf-header-date { font-size: 0.75rem; color: var(--light); margin-top: 0.25rem; }
.mch-pdf-info-table { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; }
.mch-pdf-info-table th { background: var(--background); padding: 0.5rem 0.75rem; text-align: left; font-weight: 600; font-size: 0.75rem; color: var(--tertiary); border: 1px solid var(--tint); width: 100px; min-width: 100px; max-width: 100px; box-sizing: border-box; }
.mch-pdf-info-table td { padding: 0.5rem 0.75rem; border: 1px solid var(--tint); font-size: 0.8125rem; }
.mch-pdf-product-table { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; }
.mch-pdf-product-table th { background: var(--brand); color: white; padding: 0.625rem 0.75rem; font-size: 0.75rem; font-weight: 600; text-align: center; border: 1px solid var(--secondary); }
.mch-pdf-product-table td { padding: 0.5rem 0.75rem; border: 1px solid var(--tint); text-align: center; font-size: 0.8125rem; }
.mch-pdf-note { background: var(--background); border-radius: 8px; padding: 1rem; margin-bottom: 1.5rem; }
.mch-pdf-footer { display: flex; justify-content: space-between; padding-top: 1.5rem; border-top: 1px solid var(--tint); font-size: 0.75rem; color: var(--light); }
.mch-pdf-stamps { display: flex; gap: 0; flex-shrink: 0; }
.mch-pdf-stamp-box { width: 70px; text-align: center; border: 1px solid var(--tint); }
.mch-pdf-stamp-box .mch-stamp-label { padding: 4px; font-size: 0.625rem; font-weight: 600; background: var(--background); border-bottom: 1px solid var(--tint); color: var(--tertiary); }
.mch-pdf-stamp-box .mch-stamp-area { height: 50px; display: flex; align-items: center; justify-content: center; font-size: 0.6875rem; color: var(--light); }
.mch-pdf-status-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 6px; font-size: 0.6875rem; font-weight: 700; margin-left: 0.5rem; vertical-align: middle; }
.mch-pdf-empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 400px; color: var(--light); text-align: center; }
.mch-pdf-empty-state i { font-size: 3rem; margin-bottom: 1rem; color: var(--tint); }
.mch-pdf-empty-state p { font-size: 0.9375rem; font-weight: 500; }
.mch-pdf-empty-state .mch-sub { font-size: 0.75rem; margin-top: 0.25rem; color: var(--tint); }

/* ── Work List Panel (Right 320px) ── */
.mch-work-list-panel {
  width: 320px;
  flex-shrink: 0;
  background: white;
  border-left: 1px solid var(--tint);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.mch-list-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--tint); }
.mch-list-title { font-size: 0.9375rem; font-weight: 700; color: var(--brand); margin-bottom: 0.5rem; }
.mch-list-stats { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.mch-list-stat-chip { font-size: 0.625rem; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.mch-list-items { flex: 1; overflow-y: auto; padding: 0.5rem; }
.mch-list-items::-webkit-scrollbar { width: 4px; }
.mch-list-items::-webkit-scrollbar-track { background: transparent; }
.mch-list-items::-webkit-scrollbar-thumb { background: var(--tint); border-radius: 2px; }
.mch-list-card {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--tint);
  border-radius: 8px;
  margin-bottom: 0.375rem;
  cursor: pointer;
  transition: all 0.2s;
  overflow: hidden;
  background: white;
}
.mch-list-card:hover { border-color: var(--light); box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.mch-list-card.mch-selected { border-color: #3B82F6; background: rgba(59,130,246,0.03); }
.mch-list-card.mch-status-urgent { border-color: #FCA5A5; background: #FFF8F8; animation: mchUrgentPulse 2s ease-in-out infinite; }
.mch-list-card.mch-status-urgent.mch-selected { border-color: #EF4444; }
.mch-list-card.mch-status-hold { border-color: #FDE68A; background: #FFFEF5; }
.mch-list-card.mch-status-done { opacity: 0.5; }
.mch-list-card-bar { width: 4px; flex-shrink: 0; }
.mch-list-card-body { flex: 1; padding: 0.625rem 0.75rem; display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.mch-list-card-top { display: flex; align-items: center; gap: 0.5rem; }
.mch-list-card-badge { font-size: 0.5625rem; font-weight: 700; padding: 1px 6px; border-radius: 4px; }
.mch-list-card-id { font-size: 0.75rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; color: var(--brand); }
.mch-list-card-partner { font-size: 0.6875rem; color: var(--tertiary); margin-left: auto; }
.mch-list-card-detail { display: flex; align-items: center; gap: 0.75rem; font-size: 0.6875rem; color: var(--light); }
.mch-list-card-actions { display: flex; gap: 0.25rem; margin-top: 0.25rem; }
.mch-list-action-btn {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.5625rem;
  font-weight: 600;
  border: 1px solid var(--tint);
  background: white;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.mch-list-action-btn:hover { background: var(--background); }
.mch-list-action-btn.mch-primary { background: #3B82F6; color: white; border-color: #3B82F6; }
.mch-list-action-btn.mch-primary:hover { background: #2563EB; }
.mch-list-action-btn.mch-success { background: #22C55E; color: white; border-color: #22C55E; }
.mch-list-action-btn.mch-success:hover { background: #16A34A; }
.mch-list-action-btn.mch-warning { color: #D97706; border-color: #F59E0B; }
.mch-list-action-btn.mch-warning:hover { background: #FFFBEB; }

@keyframes mchUrgentPulse {
  0%, 100% { border-color: #FCA5A5; box-shadow: 0 0 0 0 rgba(239,68,68,0); }
  50% { border-color: #EF4444; box-shadow: 0 0 0 3px rgba(239,68,68,0.1); }
}

/* ── Progress mini bar ── */
.mch-mini-progress { display: flex; align-items: center; gap: 6px; }
.mch-mini-progress-bar { width: 80px; height: 5px; border-radius: 3px; background: var(--bg-light); overflow: hidden; }
.mch-mini-progress-fill { height: 100%; border-radius: 3px; background: #3B82F6; transition: width 0.4s ease; }
.mch-mini-progress-text { font-size: 0.6875rem; font-weight: 600; color: var(--tertiary); font-family: 'JetBrains Mono', monospace; min-width: 32px; }

/* ── Live clock ── */
.mch-live-clock { font-family: 'JetBrains Mono', monospace; font-size: 0.8125rem; color: var(--tertiary); font-weight: 500; }

/* ── Empty state ── */
.mch-empty-state { text-align: center; padding: 3rem 1rem; color: var(--light); }
.mch-empty-state i { font-size: 2.5rem; margin-bottom: 0.75rem; }
.mch-empty-state p { font-size: 0.875rem; }

@keyframes mchLiveDot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
