:root {
  --ink: #0D1B2A;
  --muted: #64748B;
  --line: #E2E8F0;
  --panel: #ffffff;
  --canvas: #F0FDFA;
  --teal: #0A9396;
  --green: #2EC4B6;
  --red: #d92d20;
  --amber: #b7791f;
  --dark: #023047;
  --shadow: 0 8px 32px rgba(10, 147, 150, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(46, 196, 182, 0.18), transparent 34%),
    var(--canvas);
  font-family: "Quicksand", Arial, sans-serif;
}

.phone-shell {
  width: min(100%, 440px);
}

.wifi-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  padding: 18px;
  border-radius: 24px;
  color: #fff;
  background: linear-gradient(135deg, #011627, var(--dark), var(--teal));
  box-shadow: var(--shadow);
}

.logo {
  width: 54px;
  height: 54px;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  padding: 6px;
}

.wifi-header p,
.wifi-header h1 {
  margin: 0;
}

.wifi-header p {
  margin-bottom: 4px;
  color: #d8f4ea;
  font-size: 13px;
  font-weight: 700;
}

.wifi-header h1 {
  font-size: 22px;
}

.card {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

h2 {
  margin: 0;
  font-size: 18px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--dark);
  font-size: 13px;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid #bdd8cf;
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

input:focus {
  outline: 3px solid rgba(25, 143, 159, 0.18);
  border-color: var(--teal);
}

button {
  font: inherit;
}

.primary {
  min-height: 46px;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--teal), var(--green));
  cursor: pointer;
  font-weight: 800;
}

.primary:disabled,
.primary[data-loading="true"] {
  opacity: 0.7;
  cursor: progress;
}

.text-btn {
  border: 0;
  color: var(--teal);
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}

.employee-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.employee-bar span,
.employee-bar strong {
  display: block;
}

.employee-bar span {
  color: var(--muted);
  font-size: 12px;
}

.guard-list {
  display: grid;
  gap: 8px;
}

.guard {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid #e6eee9;
  border-radius: 10px;
  background: #fbfffd;
}

.guard strong {
  font-size: 13px;
}

.guard span {
  color: var(--muted);
  font-size: 12px;
}

.guard.ok {
  border-color: #bee7d1;
  background: #f3fff8;
}

.test-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff9ed;
  color: #6d4c13;
}

.test-toggle input {
  width: 16px;
  min-height: 16px;
}

.btn-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-group small,
.btn-group span {
  display: block;
}

.btn-group small {
  margin-top: 3px;
  font-weight: 600;
  opacity: 0.85;
}

.checkout-btn {
  background: linear-gradient(135deg, var(--dark), var(--teal));
}

.status-message {
  margin-bottom: 14px;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
  font-weight: 700;
}

.status-message.success {
  color: #0b7a4b;
  border-color: #bee7d1;
}

.status-message.error {
  color: var(--red);
  border-color: #ffc9c4;
}

footer {
  text-align: center;
}

footer a {
  color: var(--teal);
  font-weight: 800;
  text-decoration: none;
}

.attendance-minimal {
  width: min(100%, 380px);
}

.attendance-minimal .attendance-only {
  min-height: 220px;
  align-content: center;
  padding: 20px;
}

.summer-badge {
  display: grid;
  gap: 4px;
  margin-bottom: 4px;
  padding: 13px 14px;
  border: 1px solid rgba(200, 155, 40, 0.35);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(255, 209, 102, 0.22), rgba(20, 152, 173, 0.07)),
    rgba(255, 255, 255, 0.85);
}

.summer-badge span {
  color: #9a5a00;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.summer-badge strong {
  color: #0b4a5a;
  font-size: 16px;
  font-weight: 700;
}

.attendance-minimal .btn-group {
  gap: 14px;
}

.attendance-minimal .btn-group .primary {
  min-height: 132px;
  border-radius: 18px;
  font-size: 18px;
}

.attendance-minimal .btn-group small {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  opacity: 1;
}

[hidden] {
  display: none !important;
}

@media (max-width: 420px) {
  body {
    padding: 10px;
  }

  .wifi-header,
  .card {
    border-radius: 12px;
    padding: 14px;
  }

  .btn-group {
    grid-template-columns: 1fr;
  }
}

/* iHRM dark mobile check-in refresh */
:root {
  --ink: #f8fbff;
  --muted: rgba(248, 251, 255, 0.64);
  --line: rgba(255, 255, 255, 0.09);
  --panel: rgba(20, 22, 42, 0.94);
  --canvas: #0b1020;
  --teal: #00d4ff;
  --green: #00e5a0;
  --red: #ff5f7e;
  --amber: #ffd166;
  --dark: #f8fbff;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.44);
}

body {
  position: relative;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 84% 12%, rgba(255, 209, 102, 0.34), transparent 13%),
    radial-gradient(circle at 82% 10%, rgba(0, 212, 255, 0.18), transparent 32%),
    radial-gradient(circle at 10% 22%, rgba(167, 139, 250, 0.14), transparent 30%),
    linear-gradient(180deg, #080b16 0%, #0b1020 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: 0;
}

body::before {
  top: 20px;
  right: 28px;
  width: 82px;
  height: 82px;
  border-radius: 999px;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.85) 0 10%, transparent 11%),
    radial-gradient(circle, #ffd166 0 48%, rgba(255, 209, 102, 0.12) 49% 68%, transparent 69%);
  box-shadow: 0 0 42px rgba(255, 209, 102, 0.24);
  animation: summerFloat 7s ease-in-out infinite;
}

body::after {
  left: -20%;
  right: -20%;
  bottom: 0;
  height: 32vh;
  background:
    radial-gradient(ellipse at 18% 68%, rgba(0, 229, 160, 0.14), transparent 34%),
    radial-gradient(ellipse at 64% 82%, rgba(0, 212, 255, 0.16), transparent 40%),
    repeating-linear-gradient(108deg, transparent 0 34px, rgba(255, 255, 255, 0.035) 35px 37px);
  opacity: 0.84;
  animation: summerWave 12s linear infinite;
}

.phone-shell {
  position: relative;
  z-index: 1;
}

.wifi-header {
  border: 1px solid rgba(0, 212, 255, 0.20);
  border-radius: 18px;
  background:
    radial-gradient(circle at right top, rgba(0, 229, 160, 0.20), transparent 36%),
    linear-gradient(135deg, rgba(0, 212, 255, 0.18), rgba(167, 139, 250, 0.10)),
    rgba(20, 22, 42, 0.96);
}

.logo {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px var(--line);
}

.wifi-header p {
  color: var(--muted);
}

.card,
.guard,
.status-message {
  border-color: var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.guard {
  background: rgba(255, 255, 255, 0.04);
}

.guard.ok {
  border-color: rgba(0, 229, 160, 0.24);
  background: rgba(0, 229, 160, 0.08);
}

label,
.guard strong,
h2,
.employee-bar strong {
  color: #fff;
}

.guard span,
.employee-bar span {
  color: var(--muted);
}

input {
  border-color: var(--line);
  color: #fff;
  background: rgba(7, 10, 22, 0.72);
}

input::placeholder {
  color: rgba(248, 251, 255, 0.34);
}

input:focus {
  outline-color: rgba(0, 212, 255, 0.13);
  border-color: rgba(0, 212, 255, 0.72);
}

.primary {
  border-radius: 999px;
  color: #06111e;
  background: linear-gradient(135deg, var(--teal), var(--green));
  box-shadow: 0 14px 28px rgba(0, 212, 255, 0.20);
}

.checkout-btn {
  color: #fff;
  background: linear-gradient(135deg, #7c3aed, #00d4ff);
}

.text-btn,
footer a {
  color: var(--teal);
}

.employee-bar {
  border-bottom-color: var(--line);
}

.test-toggle {
  background: rgba(255, 209, 102, 0.10);
  color: #ffe39a;
}

.status-message.success {
  color: var(--green);
  border-color: rgba(0, 229, 160, 0.26);
  background: rgba(0, 229, 160, 0.08);
}

.status-message.error {
  color: #ff9bad;
  border-color: rgba(255, 95, 126, 0.26);
  background: rgba(255, 95, 126, 0.09);
}

.selfie-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  /* env(safe-area-inset-*) đảm bảo không bị che bởi notch/home bar iPhone */
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  padding-top: max(12px, env(safe-area-inset-top));
  background: rgba(3, 7, 18, 0.88);
  overflow-y: auto;
}

.selfie-card {
  width: min(100%, 420px);
  /* Quan trọng: giới hạn chiều cao để card không vượt quá màn hình */
  max-height: calc(100dvh - 24px);
  max-height: calc(100vh - 24px); /* fallback cho trình duyệt cũ */
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(20, 22, 42, 0.98);
  box-shadow: var(--shadow);
  overflow: hidden;
}

#selfieVideo {
  width: 100%;
  /* Dùng flex-shrink để video tự co lại khi không đủ chỗ */
  flex: 1 1 auto;
  min-height: 0;
  /* Giới hạn chiều cao tối đa để luôn còn chỗ cho nút bên dưới */
  max-height: calc(100dvh - 160px);
  max-height: calc(100vh - 160px); /* fallback */
  border-radius: 14px;
  object-fit: cover;
  background: #050816;
  transform: scaleX(-1);
}

.selfie-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  /* Không bao giờ bị co lại — nút luôn hiển thị */
  flex-shrink: 0;
}

.secondary {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  font-weight: 800;
}

@keyframes summerFloat {
  0%, 100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(-8px, 10px, 0) scale(1.04);
  }
}

@keyframes summerWave {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(9%, 0, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  body::before,
  body::after {
    animation: none;
  }
}

/* Vitalia public website inspired light check-in screen */
:root {
  --ink: #10233f;
  --muted: #637083;
  --line: #d9e8ee;
  --panel: rgba(255, 255, 255, 0.95);
  --canvas: #f4fbfb;
  --teal: #1498ad;
  --green: #22c7a9;
  --red: #d94a4a;
  --amber: #c38a18;
  --dark: #10233f;
  --shadow: 0 24px 70px rgba(25, 93, 112, 0.14);
}

body {
  color: var(--ink);
  background:
    radial-gradient(circle at 84% 12%, rgba(34, 199, 169, 0.16), transparent 28%),
    radial-gradient(circle at 10% 22%, rgba(20, 152, 173, 0.10), transparent 30%),
    linear-gradient(180deg, #ffffff 0%, #f4fbfb 100%) !important;
}

body::before {
  opacity: 0.28;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.95) 0 10%, transparent 11%),
    radial-gradient(circle, rgba(34, 199, 169, 0.34) 0 48%, rgba(20, 152, 173, 0.12) 49% 68%, transparent 69%) !important;
}

body::after {
  opacity: 0.45;
  background:
    radial-gradient(ellipse at 18% 68%, rgba(34, 199, 169, 0.10), transparent 34%),
    radial-gradient(ellipse at 64% 82%, rgba(20, 152, 173, 0.10), transparent 40%),
    repeating-linear-gradient(108deg, transparent 0 34px, rgba(20, 152, 173, 0.035) 35px 37px) !important;
}

.wifi-header,
.card,
.guard,
.status-message,
.selfie-card,
.employee-bar {
  color: var(--ink);
  border-color: rgba(20, 152, 173, 0.16) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(250, 254, 253, 0.95)) !important;
  box-shadow: var(--shadow) !important;
}

.logo {
  background: #ffffff !important;
  box-shadow: inset 0 0 0 1px rgba(20, 152, 173, 0.16), 0 10px 24px rgba(25, 93, 112, 0.10) !important;
}

.wifi-header p,
.guard span,
.employee-bar span {
  color: var(--muted) !important;
}

label,
.guard strong,
h2,
.employee-bar strong {
  color: var(--ink) !important;
}

input {
  color: var(--ink) !important;
  background: #ffffff !important;
  border-color: rgba(20, 152, 173, 0.22) !important;
}

input::placeholder {
  color: #637083 !important;
}

input:focus {
  border-color: rgba(20, 152, 173, 0.74) !important;
  box-shadow: 0 0 0 4px rgba(34, 199, 169, 0.13) !important;
}

.primary {
  color: #ffffff !important;
  background: linear-gradient(135deg, #0f6f7d, #12856f) !important;
  box-shadow: 0 14px 30px rgba(15, 111, 125, 0.22) !important;
}

.checkout-btn {
  color: #ffffff !important;
  background: linear-gradient(135deg, #0f6f7d, #12856f) !important;
}

.secondary {
  color: #11768a !important;
  background: rgba(255, 255, 255, 0.86) !important;
  border-color: rgba(20, 152, 173, 0.24) !important;
}

.text-btn,
footer a {
  color: var(--teal) !important;
}

.guard.ok,
.status-message.success {
  color: #0d7f68 !important;
  border-color: rgba(34, 199, 169, 0.26) !important;
  background: rgba(34, 199, 169, 0.10) !important;
}

.status-message.error {
  color: #bd3434 !important;
  border-color: rgba(217, 74, 74, 0.24) !important;
  background: #fff7f7 !important;
}

.selfie-modal {
  background: rgba(244, 251, 251, 0.88) !important;
}

#selfieVideo {
  background: #e9f5f6 !important;
}

/* ── LIGHT THEME: summer-badge & wifi checkin contrast fixes ── */
.summer-badge {
  background:
    linear-gradient(135deg, rgba(255, 209, 102, 0.18), rgba(20, 152, 173, 0.08)) !important;
  border-color: rgba(255, 180, 60, 0.38) !important;
}

.summer-badge span {
  color: #a05c00 !important;
  font-weight: 900;
}

.summer-badge strong {
  color: #0c4a5c !important;
  font-size: 16px;
  font-weight: 800;
}
/* ────────────────────────────────────────────────── */
