/* ==========================================================================
   IDEAL Time Clock — kiosk styles
   Touch-first, dark IDEAL theme. Vanilla CSS only.
   ========================================================================== */

:root {
  --gold: #c8a96a;
  --gold-deep: #938165;
  --teal: #2E5960;
  --teal-bright: #3d7782;
  --bg-0: #0d1c1f;
  --bg-1: #142528;
  --bg-2: #1d3438;
  --text: #efe9dd;
  --muted: #9a9285;
  --dim: #5a5346;
  --green: #6b8e7f;   /* clocked-in indicator */
  --red: #b87253;     /* errors */

  --radius: 16px;
  --tap-min: 64px;
  --border: 1px solid rgba(255, 255, 255, 0.06);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg-0);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  /* Soft radial "aurora" glow for depth (teal + gold, low opacity) */
  background-image:
    radial-gradient(60% 55% at 12% 8%, rgba(46, 89, 96, 0.35) 0%, transparent 60%),
    radial-gradient(55% 50% at 88% 15%, rgba(200, 169, 106, 0.12) 0%, transparent 55%),
    radial-gradient(70% 60% at 50% 105%, rgba(46, 89, 96, 0.25) 0%, transparent 60%);
  background-attachment: fixed;
}

/* prevent accidental text selection / callouts on a shared kiosk */
body {
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

.wordmark {
  font-family: 'Cinzel', serif;
  color: var(--gold);
  letter-spacing: 0.03em;
}

/* ---------- layout ---------- */
.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px clamp(16px, 3vw, 40px) 64px;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 0 28px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand__icon {
  width: 52px;
  height: 52px;
  color: var(--gold);
  flex: 0 0 auto;
}

.brand__title {
  font-family: 'Cinzel', serif;
  color: var(--gold);
  font-size: clamp(1.5rem, 3.4vw, 2.2rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: 0.04em;
  margin: 0;
}

.clock {
  text-align: right;
  min-width: 200px;
}

.clock__time {
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 600;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.clock__date {
  margin-top: 6px;
  color: var(--muted);
  font-size: clamp(0.9rem, 1.6vw, 1.1rem);
  font-weight: 500;
}

/* office button (top-right area) */
.office-btn {
  position: absolute;
  top: 20px;
  right: clamp(16px, 3vw, 40px);
  z-index: 5;
}

/* ---------- buttons ---------- */
.btn {
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 12px;
  border: none;
  padding: 0 26px;
  min-height: var(--tap-min);
  cursor: pointer;
  color: var(--text);
  background: var(--bg-2);
  transition: transform 0.08s ease, filter 0.15s ease, background 0.15s ease;
  touch-action: manipulation;
}
.btn:active { transform: scale(0.97); }

.btn--primary {
  background: var(--gold);
  color: #1a1206;
  font-weight: 700;
}
.btn--primary:active { filter: brightness(0.92); }

.btn--enter {
  background: var(--green);
  color: #0c1512;
  font-weight: 700;
}
.btn--enter:active { filter: brightness(0.92); }

.btn--ghost {
  background: transparent;
  color: var(--text);
  border: 2px solid var(--teal-bright);
}
.btn--ghost:active { background: rgba(61, 119, 130, 0.18); }

.btn--sm {
  min-height: 48px;
  font-size: 0.95rem;
  padding: 0 18px;
  border-radius: 10px;
}

.btn:disabled { opacity: 0.5; cursor: default; }

/* ---------- roster ---------- */
.section-title {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin: 0 0 16px;
}

.roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.tile {
  position: relative;
  background: var(--bg-1);
  border: var(--border);
  border-left: 4px solid transparent;
  border-radius: var(--radius);
  padding: 22px 22px 20px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--text);
  transition: transform 0.1s ease, background 0.15s ease, border-color 0.15s ease;
  touch-action: manipulation;
}
.tile:active { transform: scale(0.98); background: var(--bg-2); }

/* Clocked IN — full green band/ring around the card. */
.tile--in {
  border-color: var(--green);
  border-left-color: var(--green);
  box-shadow: inset 0 0 0 1px rgba(107, 142, 127, 0.45),
              0 0 22px -8px rgba(107, 142, 127, 0.55);
}

/* Clocked OUT — full red band/ring around the card. */
.tile--out {
  border-color: var(--red);
  border-left-color: var(--red);
  box-shadow: inset 0 0 0 1px rgba(184, 114, 83, 0.40),
              0 0 22px -8px rgba(184, 114, 83, 0.50);
}

.tile__name {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.15;
  word-break: break-word;
}

.tile__status {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  color: var(--muted);
  min-height: 20px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--dim);
}
.dot--in {
  background: var(--green);
  box-shadow: 0 0 10px 1px rgba(107, 142, 127, 0.8);
}
.dot--out {
  background: var(--red);
  box-shadow: 0 0 10px 1px rgba(184, 114, 83, 0.7);
}
.tile__status--in { color: var(--green); font-weight: 600; }
.tile__status--out { color: var(--red); font-weight: 600; }

/* ---------- states (loading / error / empty) ---------- */
.state {
  text-align: center;
  padding: 80px 20px;
  color: var(--muted);
}
.state__msg { font-size: 1.15rem; margin-bottom: 24px; }
.state--error .state__msg { color: var(--red); }

.spinner {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--gold);
  margin: 0 auto 22px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- overlay / modal ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 12, 13, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 20;
  animation: fade 0.18s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.overlay[hidden] { display: none; }

.modal {
  width: 100%;
  max-width: 480px;
  background: var(--bg-1);
  border: var(--border);
  border-radius: 22px;
  padding: 32px 30px 30px;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.8);
  animation: pop 0.2s cubic-bezier(0.2, 0.8, 0.3, 1);
}
@keyframes pop { from { transform: translateY(14px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }

.modal__hi {
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  font-weight: 700;
  margin: 0 0 4px;
  line-height: 1.1;
}
.modal__state {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.4;
  margin: 0 0 20px;
  min-height: 22px;
}
.modal__state strong { color: var(--text); }

/* -------- clock-out confirm popup -------- */
.clockout-hours {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: var(--bg-2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 18px 20px;
  margin: 4px 0 20px;
}
.clockout-hours__label {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.clockout-hours__val {
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.lunch-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 16px 18px;
  margin: 0 0 22px;
  cursor: pointer;
  min-height: 64px;
  text-align: left;
}
.lunch-row input[type="checkbox"] {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  accent-color: var(--gold);
  cursor: pointer;
}
.lunch-row__text {
  font-size: 1.05rem;
  color: var(--text);
  line-height: 1.35;
}
.lunch-note { color: var(--muted); }

.pin-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--gold);
  margin: 0 0 16px;
  text-align: center;
}

/* pin dots */
.pin-dots {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin: 0 0 20px;
}
.pin-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--dim);
  background: transparent;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.1s ease;
}
.pin-dot--filled {
  background: var(--gold);
  border-color: var(--gold);
  transform: scale(1.05);
}
.pin-dots--error .pin-dot {
  border-color: var(--red);
  animation: shake 0.35s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

/* keypad */
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 8px;
}
.key {
  min-height: var(--tap-min);
  font-size: 1.7rem;
  font-weight: 600;
  border-radius: 14px;
  border: var(--border);
  background: var(--bg-2);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.07s ease, background 0.12s ease;
  touch-action: manipulation;
  font-variant-numeric: tabular-nums;
}
.key:active { transform: scale(0.94); background: var(--teal); }
.key--fn {
  font-size: 1.3rem;
  background: transparent;
  border: 2px solid var(--teal-bright);
}
.key--enter {
  background: var(--green);
  color: #0c1512;
  border: none;
  font-weight: 700;
}
.key--enter:active { filter: brightness(0.9); }

.pin-error {
  color: var(--red);
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  min-height: 22px;
  margin: 10px 0 0;
}

.modal__actions {
  margin-top: 18px;
  display: flex;
  justify-content: center;
}
.modal__actions .btn { width: 100%; }

/* ---------- confirmation ---------- */
.confirm {
  text-align: center;
  max-width: 560px;
}
.confirm__check {
  width: 110px;
  height: 110px;
  margin: 0 auto 24px;
  border-radius: 50%;
  background: rgba(107, 142, 127, 0.16);
  border: 3px solid var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green);
  animation: pop 0.3s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.confirm__check svg { width: 60px; height: 60px; }
.confirm__msg {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 28px;
}
.confirm__msg .accent { color: var(--green); }
.confirm__sub {
  display: block;
  margin-top: 14px;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--gold);
}

/* screen visibility helper */
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---------- sign-in page ---------- */
.signin-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.signin-card {
  width: 100%;
  max-width: 460px;
  background: var(--bg-1);
  border: var(--border);
  border-radius: 24px;
  padding: 48px 40px 44px;
  text-align: center;
  box-shadow: 0 30px 90px -40px rgba(0, 0, 0, 0.8);
}
.signin-card .brand__icon {
  width: 64px; height: 64px;
  margin: 0 auto 20px;
  display: block;
}
.signin-card h1 {
  font-family: 'Cinzel', serif;
  color: var(--gold);
  font-size: clamp(1.8rem, 6vw, 2.4rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  margin: 0 0 12px;
}
.signin-card p {
  color: var(--muted);
  font-size: 1.05rem;
  margin: 0 0 32px;
  line-height: 1.5;
}
.google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: var(--tap-min);
  background: var(--gold);
  color: #1a1206;
  font-weight: 700;
  font-size: 1.15rem;
  border-radius: 14px;
  text-decoration: none;
  transition: filter 0.15s ease, transform 0.08s ease;
}
.google-btn:active { transform: scale(0.98); filter: brightness(0.93); }
.google-btn svg { width: 24px; height: 24px; }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .header { justify-content: center; text-align: center; }
  .clock { text-align: center; min-width: 0; }
  .roster-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
  .tile__name { font-size: 1.25rem; }
}
