/* ============================================================
   WP Inventory POS — Customer Display CSS
   Designed for second monitor / customer-facing tablet.
   Supports light (default) and dark themes.
   ============================================================ */

.wpip-customer-display {
  --wcd-bg:       #F8FAFC;
  --wcd-surface:  #FFFFFF;
  --wcd-border:   #E2E8F0;
  --wcd-text:     #111827;
  --wcd-muted:    #6B7280;
  --wcd-primary:  #3B82F6;
  --wcd-success:  #10B981;
  --wcd-danger:   #EF4444;
  --wcd-warning:  #F5A623;

  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--wcd-bg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--wcd-text);
  position: relative;
  overflow: hidden;
}

/* ── Dark theme ───────────────────────────────────────────── */
.wpip-customer-display.wpip-theme-dark {
  --wcd-bg:      #0F172A;
  --wcd-surface: #1E293B;
  --wcd-border:  #334155;
  --wcd-text:    #F1F5F9;
  --wcd-muted:   #94A3B8;
}

/* ── Header / Branding ────────────────────────────────────── */
.wcd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  background: var(--wcd-surface);
  border-bottom: 1px solid var(--wcd-border);
  flex-shrink: 0;
}
.wcd-logo {
  height: 48px;
  object-fit: contain;
}
.wcd-brand-name {
  font-size: 22px;
  font-weight: 600;
  color: var(--wcd-primary);
}
.wcd-status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  background: #F1F5F9;
  color: var(--wcd-muted);
  transition: all .3s;
}
.wcd-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: wcd-pulse 2s infinite;
}
.wcd-pill-active  { background: #D1FAE5; color: #065F46; }
.wcd-pill-done    { background: #DBEAFE; color: #1E40AF; }
.wcd-pill-error   { background: #FEE2E2; color: #991B1B; }
.wcd-pill-waiting { background: #F1F5F9; color: var(--wcd-muted); }
.wpip-theme-dark .wcd-pill-active  { background: rgba(16,185,129,.2); color: #34D399; }
.wpip-theme-dark .wcd-pill-done    { background: rgba(59,130,246,.2); color: #60A5FA; }
.wpip-theme-dark .wcd-pill-error   { background: rgba(239,68,68,.2);  color: #F87171; }
.wpip-theme-dark .wcd-pill-waiting { background: rgba(148,163,184,.1);color: #94A3B8; }

/* ── Idle screen ──────────────────────────────────────────── */
.wcd-idle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 60px 40px;
  text-align: center;
}
.wcd-idle-icon {
  font-size: 80px;
  margin-bottom: 24px;
  opacity: .4;
  animation: wcd-float 3s ease-in-out infinite;
}
.wcd-idle-msg {
  font-size: 22px;
  color: var(--wcd-muted);
  font-weight: 400;
}

/* ── Active transaction ───────────────────────────────────── */
.wcd-active {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}
.wcd-items-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 0 32px;
}
.wcd-items-header {
  display: grid;
  grid-template-columns: 52px 1fr 60px 100px 100px;
  gap: 8px;
  padding: 12px 0 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--wcd-muted);
  border-bottom: 1px solid var(--wcd-border);
  position: sticky;
  top: 0;
  background: var(--wcd-bg);
}
.wcd-items-list {
  padding: 8px 0;
}
.wcd-item {
  display: grid;
  grid-template-columns: 52px 1fr 60px 100px 100px;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--wcd-border);
  align-items: center;
  font-size: 15px;
  transition: background .2s;
}
.wcd-item:last-child { border-bottom: none; }
.wcd-item-new {
  animation: wcd-slide-in .35s ease forwards;
  background: rgba(59,130,246,.06);
}
.wcd-item-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--wcd-bg);
  border: 1px solid var(--wcd-border);
  flex-shrink: 0;
}
.wcd-item-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  opacity: .5;
}
.wcd-item-name  { font-weight: 500; }
.wcd-item-qty   { color: var(--wcd-muted); text-align: center; }
.wcd-item-price { text-align: right; color: var(--wcd-muted); }
.wcd-item-total { text-align: right; font-weight: 600; color: var(--wcd-text); }
.wcd-no-items   { text-align: center; color: var(--wcd-muted); padding: 40px; font-size: 15px; }

/* ── Totals ───────────────────────────────────────────────── */
.wcd-totals {
  background: var(--wcd-surface);
  border-top: 1px solid var(--wcd-border);
  padding: 20px 32px;
  flex-shrink: 0;
}
.wcd-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 15px;
  color: var(--wcd-muted);
}
.wcd-grand-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0 0;
  border-top: 2px solid var(--wcd-border);
  margin-top: 10px;
  font-size: 32px;
  font-weight: 700;
  color: var(--wcd-text);
  letter-spacing: -.5px;
}

/* ── Completed overlay ────────────────────────────────────── */
.wcd-complete,
.wcd-voided {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-align: center;
  padding: 60px 40px;
  animation: wcd-fade-in .4s ease;
}
.wcd-complete-check {
  width: 110px;
  height: 110px;
  margin-bottom: 20px;
}
.wcd-complete-check-circle {
  stroke: var(--wcd-success);
  stroke-width: 3;
  stroke-dasharray: 151;
  stroke-dashoffset: 151;
}
.wcd-complete-check-mark {
  stroke: var(--wcd-success);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 32;
  stroke-dashoffset: 32;
}
.wcd-complete-check.animate .wcd-complete-check-circle { animation: wcd-check-circle-draw .5s ease-out forwards; }
.wcd-complete-check.animate .wcd-complete-check-mark   { animation: wcd-check-mark-draw .4s .45s ease-out forwards; }
@keyframes wcd-check-circle-draw { to { stroke-dashoffset: 0; } }
@keyframes wcd-check-mark-draw   { to { stroke-dashoffset: 0; } }
.wcd-complete-title { font-size: 40px; font-weight: 700; color: var(--wcd-success); margin-bottom: 10px; }
.wcd-complete-order { font-size: 18px; color: var(--wcd-muted); margin-bottom: 20px; }
.wcd-complete-card {
  background: var(--wcd-surface);
  border: 1px solid var(--wcd-border);
  border-radius: 14px;
  padding: 16px 40px;
  margin-bottom: 24px;
}
.wcd-complete-total-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--wcd-muted);
  margin-bottom: 4px;
}
.wcd-complete-total { font-size: 34px; font-weight: 700; color: var(--wcd-text); }
.wcd-complete-footer { font-size: 20px; color: var(--wcd-muted); font-style: italic; }
.wcd-voided-icon    { font-size: 80px; margin-bottom: 20px; opacity: .7; }
.wcd-voided-title   { font-size: 28px; font-weight: 600; color: var(--wcd-danger); }

/* ── Connection indicator ─────────────────────────────────── */
.wcd-connection {
  position: fixed;
  bottom: 14px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--wcd-muted);
  background: var(--wcd-surface);
  border: 1px solid var(--wcd-border);
  border-radius: 20px;
  padding: 4px 12px;
  z-index: 10;
}
.wcd-conn-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.wcd-conn-ok  { background: var(--wcd-success); }
.wcd-conn-err { background: var(--wcd-warning); animation: wcd-pulse 1s infinite; }

/* ── Animations ───────────────────────────────────────────── */
@keyframes wcd-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .4; }
}
@keyframes wcd-float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}
@keyframes wcd-slide-in {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes wcd-fade-in {
  from { opacity: 0; transform: scale(.97); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── Fullscreen mode (when page is dedicated customer display) ── */
.wpip-customer-display--fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
}
