/* ==========================================================================
   Office Attendance Terminal — shared theme layer
   Works alongside Tailwind (CDN) for the few things utility classes can't do:
   custom animations, terminal glow, scrollbars, print styles for reports.
   ========================================================================== */

/* ---------- design tokens (kept in sync with the Tailwind config) -------- */
:root {
  --ok: #10b981;      /* emerald-500  */
  --warn: #f59e0b;    /* amber-500    */
  --err: #f43f5e;     /* rose-500     */
  --accent: #38bdf8;  /* sky-400      */
}

/* ------------------------------- base body ------------------------------- */
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.font-terminal {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------------------------- camera + overlay --------------------------- */
.cam-shell { position: relative; }

.cam-shell video {
  transform: scaleX(-1);              /* mirror — feels natural at a kiosk */
  object-fit: cover;
  background: #0f172a;
}

/* dotted grid overlay gives the feed a "scanner" feel without hiding the face */
.cam-overlay {
  position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(56, 189, 248, .16) 1px, transparent 1.4px);
  background-size: 22px 22px;
  mix-blend-mode: screen;
}

/* scanline that sweeps while the kiosk is actively scanning */
@keyframes scanline {
  0%   { top: -6%; opacity: 0; }
  12%  { opacity: 1; }
  88%  { opacity: 1; }
  100% { top: 102%; opacity: 0; }
}
.cam-overlay .scanline {
  position: absolute; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 14px 2px rgba(56, 189, 248, .55);
  animation: scanline 2.4s linear infinite;
}
.cam-overlay.idle .scanline { animation-play-state: paused; opacity: 0; }

/* corner brackets — terminal reticle */
.cam-overlay .reticle { position: absolute; width: 34px; height: 34px; border: 2px solid rgba(56,189,248,.75); }
.cam-overlay .reticle.tl { top: 14px; left: 14px;  border-right: 0; border-bottom: 0; border-radius: 6px 0 0 0; }
.cam-overlay .reticle.tr { top: 14px; right: 14px; border-left: 0;  border-bottom: 0; border-radius: 0 6px 0 0; }
.cam-overlay .reticle.bl { bottom: 14px; left: 14px;  border-right: 0; border-top: 0; border-radius: 0 0 0 6px; }
.cam-overlay .reticle.br { bottom: 14px; right: 14px; border-left: 0;  border-top: 0; border-radius: 0 0 6px 0; }

/* pulsing status LED */
@keyframes ledpulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.led { width: .6rem; height: .6rem; border-radius: 9999px; display: inline-block; }
.led-live  { background: var(--ok);   box-shadow: 0 0 10px 2px rgba(16,185,129,.7); animation: ledpulse 1.6s infinite; }
.led-scan  { background: var(--accent); box-shadow: 0 0 10px 2px rgba(56,189,248,.7); animation: ledpulse 1s infinite; }
.led-off   { background: #64748b; }

/* ---------------------------- feedback cards ----------------------------- */
@keyframes popin {
  from { transform: translateY(14px) scale(.96); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
.feedback-pop { animation: popin .32s cubic-bezier(.2,.9,.3,1.2); }

@keyframes flashok {
  0%,100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
  35%     { box-shadow: 0 0 34px 6px rgba(16,185,129,.55); }
}
.flash-ok { animation: flashok 1.1s ease-out; }

@keyframes flasherr {
  0%,100% { box-shadow: 0 0 0 0 rgba(244,63,94,0); }
  35%     { box-shadow: 0 0 34px 6px rgba(244,63,94,.55); }
}
.flash-err { animation: flasherr 1.1s ease-out; }

/* ----------------------- centered action choice prompt -------------------- */
.action-choice-overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 3rem);
  background: rgba(2, 6, 23, .86);
  backdrop-filter: blur(12px);
}
.action-choice-overlay.hidden { display: none; }
.action-choice-panel {
  width: min(780px, 100%);
  padding: clamp(1.25rem, 4vw, 2.4rem);
  border: 1px solid rgba(251, 113, 133, .72);
  border-radius: 1.6rem;
  color: #e2e8f0;
  background:
    radial-gradient(circle at 12% 0%, rgba(244, 63, 94, .18), transparent 38%),
    linear-gradient(145deg, rgba(30, 20, 39, .99), rgba(15, 23, 42, .98));
  box-shadow: 0 0 0 1px rgba(244, 63, 94, .12), 0 24px 90px rgba(244, 63, 94, .24);
  animation: actionchoicein .3s cubic-bezier(.2, .9, .3, 1.12);
}
@keyframes actionchoicein {
  from { transform: translateY(14px) scale(.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.action-choice-heading {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.action-choice-icon {
  flex: 0 0 auto;
  width: clamp(3.25rem, 8vw, 4.5rem);
  height: clamp(3.25rem, 8vw, 4.5rem);
  display: grid;
  place-items: center;
  border: 1px solid rgba(251, 113, 133, .38);
  border-radius: 1rem;
  color: #fda4af;
  background: rgba(244, 63, 94, .12);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
}
.action-choice-eyebrow {
  margin: 0;
  color: #cbd5e1;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .17em;
  text-transform: uppercase;
}
.action-choice-name {
  margin: .25rem 0 0;
  color: #fda4af;
  font-size: clamp(1.55rem, 4vw, 2.35rem);
  line-height: 1.05;
  font-weight: 800;
}
.action-choice-subtitle {
  margin: .45rem 0 0;
  color: #cbd5e1;
  font-size: .95rem;
}
.action-choice-message {
  margin: 1.5rem 0 0;
  color: #e2e8f0;
  font-size: 1rem;
  line-height: 1.5;
}
.action-choice-hint {
  margin: .75rem 0 0;
  color: #94a3b8;
  font-size: .82rem;
  line-height: 1.5;
}
.action-choice-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .7rem;
  margin-top: 1.3rem;
}
.action-choice-button {
  min-height: 5.25rem;
  padding: .85rem 1rem;
  border: 1px solid rgba(125, 211, 252, .55);
  border-radius: .95rem;
  color: #e0f2fe;
  background: rgba(56, 189, 248, .1);
  text-align: left;
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .2s;
}
.action-choice-button:hover, .action-choice-button:focus-visible {
  border-color: rgba(125, 211, 252, .95);
  background: rgba(56, 189, 248, .2);
  transform: translateY(-1px);
  outline: none;
}
.action-choice-button strong {
  display: block;
  font-size: .96rem;
}
.action-choice-button span {
  display: block;
  margin-top: .35rem;
  color: #94a3b8;
  font-size: .72rem;
  line-height: 1.35;
}

/* ------------------------- full-screen success prompt ---------------------- */
.success-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 3rem);
  background: rgba(2, 6, 23, .86);
  backdrop-filter: blur(12px);
  overflow-y: auto;
}
.success-overlay.hidden { display: none; }
.success-panel {
  width: min(900px, 100%);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding: clamp(1.25rem, 4vw, 2.75rem);
  border: 1px solid rgba(52, 211, 153, .7);
  border-radius: 2rem;
  color: #e2e8f0;
  background:
    radial-gradient(circle at 12% 0%, rgba(16, 185, 129, .2), transparent 38%),
    linear-gradient(145deg, rgba(15, 23, 42, .98), rgba(6, 78, 59, .94));
  box-shadow: 0 0 0 1px rgba(16, 185, 129, .12), 0 24px 90px rgba(16, 185, 129, .28);
  animation: successpanelin .35s cubic-bezier(.2, .9, .3, 1.15);
}
@keyframes successpanelin {
  from { transform: translateY(18px) scale(.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.success-heading {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.success-check {
  flex: 0 0 auto;
  width: clamp(3.5rem, 9vw, 5.5rem);
  height: clamp(3.5rem, 9vw, 5.5rem);
  display: grid;
  place-items: center;
  border: 2px solid rgba(110, 231, 183, .8);
  border-radius: 1.5rem;
  color: #d1fae5;
  background: rgba(16, 185, 129, .2);
  font-size: clamp(2.3rem, 6vw, 4rem);
  font-weight: 800;
  box-shadow: 0 0 32px rgba(16, 185, 129, .3);
}
.success-eyebrow {
  margin: 0;
  color: #a7f3d0;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.success-name {
  margin: .2rem 0 0;
  color: #f0fdf4;
  font-size: clamp(1.8rem, 5vw, 3.4rem);
  line-height: 1.05;
  font-weight: 800;
}
.success-subtitle {
  margin: .45rem 0 0;
  color: #bbf7d0;
  font-size: clamp(.85rem, 2vw, 1.05rem);
}
.success-content {
  display: grid;
  grid-template-columns: minmax(220px, .9fr) 1.1fr;
  gap: clamp(1rem, 3vw, 2rem);
  align-items: stretch;
  margin-top: clamp(1.25rem, 4vw, 2.25rem);
}
.success-photo-frame {
  min-height: 220px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(167, 243, 208, .35);
  border-radius: 1.35rem;
  background: rgba(2, 6, 23, .48);
}
.success-photo {
  width: 100%;
  height: 100%;
  min-height: 220px;
  max-height: 330px;
  object-fit: cover;
}
.success-photo-placeholder {
  display: grid;
  place-items: center;
  gap: .5rem;
  min-height: 220px;
  color: #a7f3d0;
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.success-photo-placeholder span:first-child {
  display: grid;
  place-items: center;
  width: 4.5rem;
  height: 4.5rem;
  border: 2px solid rgba(110, 231, 183, .65);
  border-radius: 999px;
  font-size: 2.25rem;
}
.success-details {
  display: grid;
  align-content: center;
  gap: .65rem;
}
.success-detail {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .8rem 0;
  border-bottom: 1px solid rgba(167, 243, 208, .16);
}
.success-detail span {
  color: #94a3b8;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.success-detail b {
  color: #ecfdf5;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .9rem;
  text-align: right;
}
.success-next {
  margin: 1.5rem 0 0;
  color: #bbf7d0;
  font-size: .9rem;
  text-align: center;
}
.success-dismiss {
  display: block;
  margin: 1.25rem auto 0;
  padding: .75rem 1.5rem;
  border: 1px solid rgba(167, 243, 208, .45);
  border-radius: .85rem;
  color: #d1fae5;
  background: rgba(16, 185, 129, .16);
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .2s;
}
.success-dismiss:hover, .success-dismiss:focus-visible {
  border-color: rgba(167, 243, 208, .9);
  background: rgba(16, 185, 129, .3);
  transform: translateY(-1px);
  outline: none;
}

/* ------------------------------ misc chrome ------------------------------ */
.card { backdrop-filter: blur(6px); }

/* sleek thin scrollbars for the reports table */
.thin-scroll::-webkit-scrollbar { height: 8px; width: 8px; }
.thin-scroll::-webkit-scrollbar-track { background: transparent; }
.thin-scroll::-webkit-scrollbar-thumb { background: rgba(100,116,139,.45); border-radius: 8px; }
.thin-scroll::-webkit-scrollbar-thumb:hover { background: rgba(100,116,139,.7); }

/* staggered row fade-in for reports */
@keyframes rowin { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: none;} }
.row-in { animation: rowin .3s ease both; }

/* ------------------------------- print sheet ------------------------------ */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .no-print { display: none !important; }
  .print-card { box-shadow: none !important; border: 1px solid #cbd5e1 !important; }
  table { border-collapse: collapse; }
  thead th { background: #f1f5f9 !important; color: #000 !important; }
  tbody td, thead th { border-bottom: 1px solid #e2e8f0 !important; color: #000 !important; }
  @page { size: A4 landscape; margin: 12mm; }
}

/* gentle reduce-motion respect */
@media (prefers-reduced-motion: reduce) {
  .cam-overlay .scanline, .led, .feedback-pop, .flash-ok, .flash-err, .row-in, .success-panel, .action-choice-panel { animation: none !important; }
}

@media (max-width: 640px) {
  .success-content { grid-template-columns: 1fr; }
  .success-photo-frame, .success-photo, .success-photo-placeholder { min-height: 180px; }
  .success-photo { max-height: 240px; }
  .action-choice-actions { grid-template-columns: 1fr; }
}
