/* kiosk.css — Fullscreen dark kiosk UI */

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

:root {
  --bg-dark: #121212;
  --color-primary: #00bcd4;
  --color-success: #4caf50;
  --color-danger: #f44336;
  --color-warn: #ff9800;
  --color-text: #ffffff;
  --color-text-dim: rgba(255,255,255,0.6);
  --font-main: 'Segoe UI', system-ui, sans-serif;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  color: var(--color-text);
  font-family: var(--font-main);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ── Camera feed ── */
#video {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover; z-index: 1;
  transform: scaleX(-1);
}

#face-canvas {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 2; pointer-events: none;
}

/* ── Screens ── */
.screen {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 10;
  display: flex; flex-direction: column;
  align-items: center; justify-content: space-between;
  padding: 2rem;
}

.hidden { display: none !important; }

/* ── Top bar (shared between idle + detected) ── */
.top-bar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.logo-img {
  height: 28px;
  width: auto;
  mix-blend-mode: screen;
  filter: brightness(1.15);
}

.setup-logo {
  width: 180px;
  height: auto;
  margin-bottom: 0.5rem;
  border-radius: 6px;
}

.clock {
  font-size: 1.5rem; font-weight: 300;
  text-shadow: 0 2px 12px rgba(0,0,0,0.8);
}

/* ── Idle screen ── */
.screen--idle { background: transparent; }

.idle-prompt {
  font-size: 1.4rem; font-weight: 300;
  color: var(--color-text-dim);
  text-shadow: 0 2px 10px rgba(0,0,0,0.9);
  background: rgba(0,0,0,0.4);
  padding: 0.75rem 2rem;
  border-radius: 2rem;
  margin-bottom: 2rem;
}

/* ── Detected screen — camera stays visible, overlay at bottom ── */
.screen--detected {
  background: transparent;
  justify-content: space-between;
}

.detected-bottom {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.detected-bar {
  width: 100%;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(10px);
  border-radius: 1.25rem;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.detected-info { flex: 1; min-width: 0; }

.detected-label {
  font-size: 0.75rem;
  color: var(--color-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.15rem;
}

.detected-name {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.punch-btn {
  border: none; border-radius: 3rem;
  padding: 0.9rem 2rem;
  font-size: 1.2rem; font-weight: 700;
  color: #fff; font-family: inherit;
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  transition: transform 0.1s, opacity 0.2s, background 0.3s;
}
.punch-btn:active { transform: scale(0.96); opacity: 0.9; }

.punch-btn--in {
  background: var(--color-success);
  box-shadow: 0 4px 16px rgba(76,175,80,0.4);
}

.punch-btn--out {
  background: #e53935;
  box-shadow: 0 4px 16px rgba(229,57,53,0.4);
}

.not-you-btn {
  align-self: flex-start;
  font-size: 0.8rem;
  color: var(--color-text-dim);
  text-decoration: none;
  background: rgba(255,255,255,0.08);
  padding: 0.35rem 0.85rem;
  border-radius: 2rem;
  margin-left: 0.5rem;
  margin-bottom: 0.25rem;
}
.not-you-btn:hover { color: #fff; }

/* ── Idle scan button ── */
.idle-bottom {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding-bottom: 1.5rem;
}

.scan-btn {
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 3rem;
  padding: 1.2rem 3.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 28px rgba(0,188,212,0.5);
  transition: transform 0.1s, opacity 0.2s;
  width: 80%;
  max-width: 320px;
}
.scan-btn:active { transform: scale(0.96); opacity: 0.85; }

.idle-or {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0.75rem 0;
}

.scan-btn--secondary {
  background: none;
  border: 1.5px solid rgba(255,255,255,0.25);
  border-radius: 3rem;
  color: rgba(255,255,255,0.7);
  font-size: 1rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  padding: 0.65rem 2rem;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.scan-btn--secondary:active {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border-color: rgba(255,255,255,0.5);
}

/* ── Settings gear button (idle screen) ── */
.settings-btn {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  background: rgba(255,255,255,0.08);
  border: none;
  color: rgba(255,255,255,0.3);
  font-size: 1.4rem;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
}
.settings-btn:active { color: rgba(255,255,255,0.8); background: rgba(255,255,255,0.15); }

/* ── Scanning screen ── */
.screen--scanning { background: transparent; }

.scanning-bottom {
  width: 100%;
  display: flex;
  justify-content: center;
  padding-bottom: 1rem;
}

.scanning-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  border-radius: 2rem;
  padding: 0.85rem 2rem;
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--color-primary);
}

.scanning-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-primary);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

/* ── Close/dismiss button (on unknown + multiface screens) ── */
.screen-close-btn {
  background: rgba(255,255,255,0.2);
  border: 1.5px solid rgba(255,255,255,0.4);
  border-radius: 2rem;
  color: #fff;
  font-size: 1rem;
  font-family: inherit;
  padding: 0.65rem 1.75rem;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: background 0.2s;
}
.screen-close-btn:active { background: rgba(255,255,255,0.3); }

/* ── Fallback "Enter ID" button (on unknown + multiface screens) ── */
.fallback-id-btn {
  margin-top: 1rem;
  background: rgba(255,255,255,0.15);
  border: 1.5px solid rgba(255,255,255,0.4);
  border-radius: 2rem;
  color: #fff;
  font-size: 1rem;
  font-family: inherit;
  padding: 0.7rem 1.8rem;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 0.2s;
}
.fallback-id-btn:hover { background: rgba(255,255,255,0.25); }
.fallback-id-btn:active { transform: scale(0.97); }

/* ── Multiple faces screen ── */
.screen--multiface {
  background: rgba(255,152,0,0.88);
  animation: fadeIn 0.3s ease;
}

.multiface-content {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; gap: 1rem;
}

.multiface-icon { font-size: 5rem; }
.multiface-text { font-size: 2rem; font-weight: 700; }
.multiface-sub { font-size: 1.1rem; opacity: 0.9; text-align: center; padding: 0 2rem; }

/* ── Matched screen ── */
.screen--matched {
  background: rgba(76,175,80,0.92);
  animation: fadeIn 0.3s ease;
}

.matched-content {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; gap: 1rem;
}

.matched-icon { font-size: 5rem; line-height: 1; }
.matched-name { font-size: 3rem; font-weight: 700; text-align: center; }
.matched-status { font-size: 1.8rem; font-weight: 300; opacity: 0.9; }
.matched-time { font-size: 1.4rem; opacity: 0.8; }

/* ── Unknown screen ── */
.screen--unknown {
  background: rgba(244,67,54,0.92);
  animation: fadeIn 0.3s ease;
}

.unknown-content {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; gap: 1rem;
}

.unknown-icon { font-size: 5rem; }
.unknown-text { font-size: 2.5rem; font-weight: 700; }
.unknown-sub { font-size: 1.2rem; opacity: 0.8; }

/* ── Setup screen ── */
.screen--setup {
  background: #1a1a2e;
  align-items: center; justify-content: center;
}

.setup-card {
  background: rgba(255,255,255,0.07);
  border-radius: 1rem; padding: 2.5rem;
  width: 100%; max-width: 400px; text-align: center;
}

.setup-card h1 { font-size: 1.8rem; margin-bottom: 0.5rem; }
.setup-card > p { color: var(--color-text-dim); margin-bottom: 2rem; font-size: 0.95rem; }

.setup-field { text-align: left; margin-bottom: 1.25rem; }
.setup-field label { display: block; font-size: 0.8rem; color: var(--color-text-dim); margin-bottom: 0.4rem; }
.setup-field input {
  width: 100%; padding: 0.75rem 1rem;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
  border-radius: 0.5rem; color: #fff; font-size: 0.95rem; font-family: inherit;
}
.setup-field input:focus { outline: none; border-color: var(--color-primary); }

.setup-btn {
  width: 100%; padding: 0.85rem; background: var(--color-primary);
  border: none; border-radius: 0.5rem; color: #fff;
  font-size: 1rem; font-family: inherit; cursor: pointer; margin-top: 0.5rem;
}
.setup-btn:hover { opacity: 0.9; }
.setup-error { color: #f88; font-size: 0.85rem; margin-top: 0.75rem; min-height: 1.2em; }
.setup-cancel { display: block; text-align: center; margin-top: 0.5rem; color: rgba(255,255,255,0.5); font-size: 0.9rem; text-decoration: none; }
/* ── Manual entry screen ── */
.screen--manual {
  background: rgba(10,10,20,0.92);
  backdrop-filter: blur(12px);
  align-items: center;
  justify-content: center;
}

.manual-card {
  width: 100%; max-width: 380px;
  display: flex; flex-direction: column;
  align-items: center; gap: 1rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 1.5rem;
  padding: 2.5rem 2rem;
}

.manual-logo {
  width: 140px; height: auto;
  mix-blend-mode: screen;
  filter: brightness(1.2);
  margin-bottom: 0.5rem;
}

.manual-label {
  font-size: 1.1rem;
  color: var(--color-text-dim);
  text-align: center;
}

.manual-input {
  width: 100%;
  padding: 0.85rem 1.1rem;
  background: rgba(255,255,255,0.08);
  border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: 0.75rem;
  color: #fff; font-size: 1.15rem;
  font-family: inherit; text-align: center;
  letter-spacing: 0.06em;
}
.manual-input:focus {
  outline: none;
  border-color: var(--color-primary);
  background: rgba(0,188,212,0.08);
}

.manual-error {
  min-height: 1.2em;
  font-size: 0.85rem;
  color: #f88;
  text-align: center;
}

.manual-submit-btn {
  width: 100%;
  padding: 0.9rem;
  background: var(--color-primary);
  border: none; border-radius: 0.75rem;
  color: #fff; font-size: 1.1rem; font-weight: 700;
  font-family: inherit; cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}
.manual-submit-btn:active { transform: scale(0.97); opacity: 0.9; }

.manual-cancel-btn {
  font-size: 0.85rem;
  color: var(--color-text-dim);
  text-decoration: none;
  padding: 0.3rem 0.75rem;
  border-radius: 2rem;
  background: rgba(255,255,255,0.07);
}
.manual-cancel-btn:hover { color: #fff; }

/* ── Error screen ── */
.screen--error { background: rgba(18,18,18,0.96); }

.error-content {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; gap: 1.5rem;
}

.error-icon { font-size: 4rem; color: var(--color-warn); }
.error-text { font-size: 1.5rem; text-align: center; }

.retry-btn {
  background: var(--color-primary); color: #fff;
  border: none; padding: 0.75rem 2.5rem;
  border-radius: 2rem; font-size: 1.1rem;
  cursor: pointer; font-family: inherit;
}

/* ── Loading overlay ── */
.loading-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg-dark);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1.5rem;
}

.loading-spinner {
  width: 48px; height: 48px;
  border: 4px solid rgba(255,255,255,0.1);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

#loading-text { color: var(--color-text-dim); font-size: 1rem; }

/* ── Offline banner ── */
.offline-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  background: var(--color-warn); color: #000;
  text-align: center; padding: 0.5rem 1rem;
  font-size: 0.9rem; font-weight: 600;
}

/* ── Punch toast ── */
.punch-toast {
  position: fixed;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(6rem);
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.75rem;
  border-radius: 1.25rem;
  min-width: 280px;
  max-width: 90vw;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), opacity 0.25s ease;
  pointer-events: none;
}
.punch-toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.punch-toast--in  { background: rgba(40,167,69,0.92); }
.punch-toast--out { background: rgba(33,150,243,0.92); }

.toast-icon { font-size: 1.8rem; line-height: 1; }
.toast-body { flex: 1; }
.toast-name { font-size: 1.15rem; font-weight: 700; }
.toast-status { font-size: 0.85rem; opacity: 0.85; margin-top: 0.1rem; }
.toast-time { font-size: 1.3rem; font-weight: 300; opacity: 0.9; }

/* ── Animations ── */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes spin { to { transform: rotate(360deg); } }
