/* OnPunch Kiosk — Apple industrial minimal + OnPunch brand */

:root {
  --op-green:       #14B86A;
  --op-trust-blue:  #002B49;
  --op-teal:        #00A896;
  --op-dark:        #0F172A;
  --op-gray:        #64748B;
  --op-bg:          #F8FAFC;
  --op-danger:      #EF4444;
  --op-warning:     #F59E0B;
  --op-info:        #3B82F6;
  --op-border:      #E2E8F0;
  --op-radius-card: 16px;
  --op-radius-btn:  12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #0f172a;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 430px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--op-bg);
  display: flex;
  flex-direction: column;
}

/* ── Brand header ─────────────────────────────────────────────────────────── */
.op-brand {
  padding: 28px 24px 18px;
  background: #fff;
  border-bottom: 1px solid var(--op-border);
  text-align: center;
  flex-shrink: 0;
}
.op-brand-name {
  font-size: 26px;
  font-weight: 600;
  color: var(--op-trust-blue);
  letter-spacing: -0.015em;
  line-height: 1.2;
}
.op-brand-logo {
  max-height: 60px;
  width: auto;
  object-fit: contain;
}
.op-brand-clock {
  margin-top: 6px;
  font-size: 36px;
  font-weight: 700;
  color: var(--op-trust-blue);
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-family: 'Inter Tight', 'Inter', sans-serif;
  min-height: 44px;
}
.op-brand-clock-date {
  font-size: 13px;
  font-weight: 500;
  color: var(--op-gray);
  letter-spacing: 0.01em;
  margin-top: 2px;
}

/* ── Screens ──────────────────────────────────────────────────────────────── */
.op-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 32px 24px 20px;
}
.op-screen.hidden { display: none; }
.op-screen-center {
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* ── Idle screen ──────────────────────────────────────────────────────────── */
#screen-idle {
  align-items: center;
  justify-content: center;
  gap: 36px;
}

/* Camera preview — fills the reticle box */
#qr-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 26px;
  transform: scaleX(-1); /* mirror front camera so it feels natural */
}

/* ── Scan target / reticle ───────────────────────────────────────────────── */
.op-scan-target {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.op-scan-reticle {
  position: relative;
  width: 280px;
  height: 280px;
  border: 3px solid var(--op-teal);
  border-radius: 28px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 0 0 4px rgba(0,168,150,0.12), 0 8px 32px rgba(0,0,0,0.25);
  animation: op-reticle-pulse 3s ease-in-out infinite;
}

/* Bottom hint overlay inside camera frame */
.op-scanhint {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,0.55));
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  letter-spacing: 0.03em;
  z-index: 2;
}

@keyframes op-reticle-pulse {
  0%, 100% {
    border-color: var(--op-teal);
    box-shadow: 0 0 0 0 rgba(0, 168, 150, 0);
  }
  50% {
    border-color: rgba(0, 43, 73, 0.6);
    box-shadow: 0 0 0 8px rgba(0, 168, 150, 0.06);
  }
}

/* Corner accents — sit above the video feed */
.op-scan-reticle .sc {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 3.5px solid #fff;
  z-index: 3;
}
.op-scan-reticle .sc.tl { top: 10px;  left: 10px;  border-right: none; border-bottom: none; border-radius: 6px 0 0 0; }
.op-scan-reticle .sc.tr { top: 10px;  right: 10px; border-left:  none; border-bottom: none; border-radius: 0 6px 0 0; }
.op-scan-reticle .sc.bl { bottom: 10px; left: 10px;  border-right: none; border-top:    none; border-radius: 0 0 0 6px; }
.op-scan-reticle .sc.br { bottom: 10px; right: 10px; border-left:  none; border-top:    none; border-radius: 0 0 6px 0; }

.op-scan-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--op-gray);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ── Idle bottom actions ─────────────────────────────────────────────────── */
.op-idle-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 300px;
}

/* Primary pill: USE PIN */
.op-pill-btn {
  width: 100%;
  padding: 17px 0;
  border-radius: 999px;
  background: var(--op-trust-blue);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}
.op-pill-btn:active { background: #001c30; }

/* Ghost secondary: SYSTEM */
.op-ghost-btn {
  background: transparent;
  border: 1.5px solid #cbd5e1;
  border-radius: 999px;
  padding: 11px 28px;
  font-size: 13px;
  font-weight: 500;
  color: #94a3b8;
  letter-spacing: 0.05em;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: border-color 0.15s, color 0.15s;
}
.op-ghost-btn:active { border-color: #94a3b8; color: var(--op-gray); background: #f1f5f9; }

/* ── Scan / manual error line ─────────────────────────────────────────────── */
.op-error {
  color: var(--op-danger);
  font-size: 13px;
  font-weight: 500;
  min-height: 18px;
}

/* ── Manual entry screen ─────────────────────────────────────────────────── */
.op-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--op-gray);
  margin-bottom: 12px;
}
.op-input {
  width: 100%;
  max-width: 280px;
  border: 1px solid var(--op-border);
  border-radius: var(--op-radius-btn);
  padding: 14px 16px;
  font-size: 18px;
  text-align: center;
  margin-bottom: 16px;
  font-family: 'Inter Tight', 'Inter', sans-serif;
  color: var(--op-dark);
}
.op-input:focus { outline: 2px solid var(--op-trust-blue); border-color: transparent; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.op-btn {
  border-radius: var(--op-radius-btn);
  padding: 15px 0;
  font-size: 16px;
  font-weight: 600;
  width: 100%;
  max-width: 280px;
  border: none;
  cursor: pointer;
}
.op-btn-primary  { background: var(--op-trust-blue); color: #fff; }
.op-btn-primary:active { background: #001c30; }
.op-btn-secondary {
  background: #fff;
  color: var(--op-dark);
  border: 1px solid var(--op-border);
  margin-top: 10px;
}
.op-textbtn {
  background: none;
  border: none;
  color: var(--op-gray);
  font-size: 13px;
  font-weight: 500;
  margin-top: 16px;
  padding: 8px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Punch status screen ─────────────────────────────────────────────────── */
.op-status-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(20, 184, 106, 0.1);
  color: var(--op-green);
  font-size: 32px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}
.op-status-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--op-dark);
  margin: 0 0 8px;
}
.op-shift {
  font-size: 15px;
  font-weight: 500;
  color: var(--op-gray);
  margin-bottom: 32px;
  font-family: 'Inter Tight', 'Inter', sans-serif;
}
.op-result-message {
  font-size: 14px;
  color: var(--op-gray);
  max-width: 300px;
  line-height: 1.5;
}
#screen-result[data-color="green"] {
  background: linear-gradient(160deg, #dcfce7 0%, #f0fdf4 100%);
}
#screen-result[data-color="green"] #result-icon {
  font-size: 80px;
  color: #16a34a;
}
#screen-result[data-color="green"] #result-title {
  color: #15803d;
  font-size: 32px;
}
.op-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 280px;
  margin-bottom: 8px;
}
.op-action-btn {
  border-radius: var(--op-radius-btn);
  padding: 16px 0;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  border: none;
  cursor: pointer;
}
.op-action-btn.green   { background: var(--op-green); }
.op-action-btn.warning { background: var(--op-warning); }
.op-action-btn.danger  { background: var(--op-danger); }
.op-action-btn.info    { background: var(--op-info); }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.op-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-top: 1px solid var(--op-border);
  background: #fff;
  flex-shrink: 0;
}
.op-footer.hidden { display: none; }
.op-footer-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #94a3b8;
}
.op-footer-link {
  font-size: 12px;
  color: #94a3b8;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Policy ack modal ─────────────────────────────────────────────────────── */
.op-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
}
.op-modal.hidden { display: none; }
.op-modal-card {
  background: #fff;
  border-radius: var(--op-radius-card);
  padding: 28px 24px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}
.op-modal-title  { font-size: 18px; font-weight: 700; margin: 0 0 12px; color: var(--op-dark); }
.op-modal-text   { font-size: 14px; color: var(--op-gray); margin: 0 0 12px; line-height: 1.5; }
.op-modal-list {
  background: var(--op-bg);
  border-radius: var(--op-radius-btn);
  padding: 14px 16px;
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--op-dark);
  list-style: none;
  line-height: 1.6;
}
.op-modal-list li + li { margin-top: 4px; }
.op-modal-actions { display: flex; flex-direction: column; }

/* ── SYSTEM modal — frosted glass ────────────────────────────────────────── */
.op-system-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}
.op-system-overlay.hidden { display: none; }

.op-system-card {
  background: rgba(255, 255, 255, 0.96);
  border-radius: 28px;
  padding: 36px 28px 28px;
  width: 100%;
  max-width: 320px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.op-system-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--op-trust-blue);
  letter-spacing: -0.01em;
  text-align: center;
}

/* PIN dot row */
.op-sys-dots {
  display: flex;
  gap: 18px;
}
.op-sys-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  background: transparent;
  transition: background 0.12s, border-color 0.12s, transform 0.08s;
}
.op-sys-dot.filled {
  background: var(--op-trust-blue);
  border-color: var(--op-trust-blue);
  transform: scale(1.1);
}
.op-sys-dot.shake {
  animation: op-dot-shake 0.35s ease;
}
@keyframes op-dot-shake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-4px); }
  40%     { transform: translateX(4px); }
  60%     { transform: translateX(-4px); }
  80%     { transform: translateX(2px); }
}

/* iOS-style numeric keypad */
.op-sys-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  width: 100%;
}
.op-sys-key {
  aspect-ratio: 1;
  border-radius: 50%;
  background: #f1f5f9;
  border: none;
  font-size: 24px;
  font-weight: 500;
  color: var(--op-trust-blue);
  cursor: pointer;
  font-family: 'Inter Tight', 'Inter', sans-serif;
  transition: background 0.1s, transform 0.08s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.op-sys-key:active { background: #dde3ea; transform: scale(0.94); }
.op-sys-key-del {
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fde8e8;
  border: none;
  font-size: 26px;
  color: #dc2626;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, transform 0.08s;
}
.op-sys-key-del:active { background: #fca5a5; transform: scale(0.92); }
.op-sys-key-empty {
  /* placeholder for grid alignment */
}

/* Feedback line (error or idle countdown) */
.op-sys-feedback {
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
  min-height: 16px;
  letter-spacing: 0.02em;
}
.op-sys-feedback.error { color: var(--op-danger); font-weight: 500; }

.op-sys-cancel {
  width: 100%;
  background: #f1f5f9;
  border: none;
  border-radius: 12px;
  color: #334155;
  font-size: 18px;
  font-weight: 700;
  padding: 16px 0;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  letter-spacing: 0.01em;
}
.op-sys-cancel:active { background: #e2e8f0; color: #0f172a; }

/* ── Connection status pill ──────────────────────────────────────────────── */
.op-conn-badge {
  position: fixed;
  top: 12px;
  right: 12px;
  background: var(--op-warning);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  z-index: 200;
}
.op-conn-badge.hidden { display: none; }

/* ── Utilities ───────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
