/* CreativeTicketCheckIn — mobile-first QR scan UI */

:root {
  --checkin-safe-top: env(safe-area-inset-top, 0px);
  --checkin-safe-bottom: env(safe-area-inset-bottom, 0px);
  --checkin-safe-left: env(safe-area-inset-left, 0px);
  --checkin-safe-right: env(safe-area-inset-right, 0px);
  --checkin-header-h: 3.25rem;
  --checkin-ok: #1b7f4a;
  --checkin-deny: #b42318;
  --portal-ui-font: "Segoe UI", SegoeUI, Tahoma, Arial, sans-serif;
  --bs-font-sans-serif: "Segoe UI", SegoeUI, Tahoma, Arial, sans-serif;
  --bs-body-font-family: "Segoe UI", SegoeUI, Tahoma, Arial, sans-serif;
}

body.checkin-app {
  min-height: 100dvh;
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", SegoeUI, Tahoma, Arial, sans-serif;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(var(--portal-primary-rgb, 26, 97, 184), 0.14), transparent 55%),
    linear-gradient(180deg, #f7f9fc 0%, #eef2f7 100%);
}

.checkin-header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: calc(0.35rem + var(--checkin-safe-top)) var(--checkin-safe-right) 0.35rem var(--checkin-safe-left);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

[data-bs-theme="dark"] .checkin-header {
  background: rgba(22, 27, 34, 0.9);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.checkin-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: var(--checkin-header-h);
  padding: 0 0.85rem;
  max-width: 48rem;
  margin: 0 auto;
}

.checkin-header__brand {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.01em;
}

.checkin-header__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.checkin-main {
  max-width: 48rem;
  margin: 0 auto;
  padding: 0.75rem 0.85rem calc(1.25rem + var(--checkin-safe-bottom));
  padding-left: calc(0.85rem + var(--checkin-safe-left));
  padding-right: calc(0.85rem + var(--checkin-safe-right));
}

.btn-checkin-touch {
  min-height: 2.85rem;
  padding: 0.55rem 1rem;
  font-size: 1rem;
  border-radius: 0.65rem;
}

.checkin-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 1rem;
  padding: 1.35rem 1.25rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

[data-bs-theme="dark"] .checkin-panel {
  background: rgba(28, 33, 40, 0.92);
  border-color: rgba(255, 255, 255, 0.08);
}

.checkin-welcome .letter-spacing {
  letter-spacing: 0.08em;
}

.checkin-welcome-cta {
  min-height: 3.25rem;
  border-radius: 0.85rem;
}

/* —— Home / stats —— */
.checkin-home {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  min-height: calc(100dvh - var(--checkin-header-h) - var(--checkin-safe-top) - 2.5rem);
  padding-top: 0.35rem;
}

.checkin-home__greet {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.checkin-home__account {
  font-weight: 700;
  font-size: 1.05rem;
}

.checkin-home__day {
  font-size: 0.9rem;
}

.checkin-home__stat-card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 1.15rem;
  padding: 1.5rem 1.25rem 1.35rem;
  text-align: center;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.07);
}

[data-bs-theme="dark"] .checkin-home__stat-card {
  background: rgba(28, 33, 40, 0.94);
  border-color: rgba(255, 255, 255, 0.08);
}

.checkin-home__stat-kicker {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 650;
  color: var(--bs-secondary-color);
  margin-bottom: 0.35rem;
}

.checkin-home__stat-value {
  font-size: clamp(3.25rem, 16vw, 4.5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--portal-primary, #1a61b8);
  margin-bottom: 1rem;
}

.checkin-home__stat-breakdown {
  display: flex;
  justify-content: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.checkin-home__pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.92rem;
  border: 1px solid transparent;
}

.checkin-home__pill-label {
  opacity: 0.85;
}

.checkin-home__pill.is-ok {
  background: rgba(27, 127, 74, 0.12);
  color: var(--checkin-ok);
  border-color: rgba(27, 127, 74, 0.22);
}

.checkin-home__pill.is-deny {
  background: rgba(180, 35, 24, 0.1);
  color: var(--checkin-deny);
  border-color: rgba(180, 35, 24, 0.2);
}

.checkin-home__pill.is-single {
  background: rgba(26, 97, 184, 0.1);
  color: var(--portal-primary, #1a61b8);
  border-color: rgba(26, 97, 184, 0.22);
}

.checkin-home__pill.is-bundle {
  background: rgba(13, 148, 136, 0.12);
  color: #0f766e;
  border-color: rgba(13, 148, 136, 0.22);
}

.checkin-home__pill.is-other {
  background: rgba(100, 116, 139, 0.12);
  color: #475569;
  border-color: rgba(100, 116, 139, 0.22);
}

[data-bs-theme="dark"] .checkin-home__pill.is-bundle {
  color: #5eead4;
}

[data-bs-theme="dark"] .checkin-home__pill.is-other {
  color: #cbd5e1;
}

.checkin-home__scan-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: auto;
}

@media (min-width: 480px) {
  .checkin-home__scan-actions {
    flex-direction: row;
  }

  .checkin-home__scan-actions .checkin-home__scan-btn {
    flex: 1 1 0;
  }
}

.checkin-home__scan-btn {
  min-height: 3.4rem;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.checkin-home__hint {
  text-align: center;
}

/* —— Scan page —— */
.checkin-scan {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-height: calc(100dvh - var(--checkin-header-h) - var(--checkin-safe-top) - 2rem);
}

.checkin-scan__meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.checkin-scan__account {
  font-weight: 650;
  font-size: 0.95rem;
}

.checkin-scan__hint {
  color: var(--bs-secondary-color);
  font-size: 0.92rem;
}

.checkin-scan__resource {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 0.9rem;
  padding: 0.85rem 0.9rem 0.95rem;
}

[data-bs-theme="dark"] .checkin-scan__resource {
  background: rgba(28, 33, 40, 0.92);
  border-color: rgba(255, 255, 255, 0.1);
}

.checkin-scan__resource-select {
  min-height: 2.85rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.checkin-scan__resource-gate {
  margin-top: 0.55rem;
  padding: 0.55rem 0.7rem;
  border-radius: 0.65rem;
  background: rgba(180, 35, 24, 0.1);
  color: var(--checkin-deny);
  font-size: 0.92rem;
  font-weight: 600;
}

.checkin-scan__camera-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: min(58vh, 28rem);
  border-radius: 1.1rem;
  overflow: hidden;
  background: #0b1220;
  border: 1px solid rgba(15, 23, 42, 0.18);
}

.checkin-scan__camera-wrap.is-blocked {
  opacity: 0.45;
  pointer-events: none;
  filter: grayscale(0.35);
}

.checkin-scan__camera {
  width: 100%;
  height: 100%;
  min-height: inherit;
}

.checkin-scan__camera video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 0 !important;
}

.checkin-scan__camera img {
  display: none !important;
}

.checkin-scan__frame {
  pointer-events: none;
  position: absolute;
  inset: 12%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 1rem;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.28);
}

.checkin-scan__manual {
  margin-top: 0.15rem;
}

.checkin-scan--usb {
  justify-content: flex-start;
}

.checkin-scan__usb-status {
  border-radius: 0.85rem;
  font-weight: 600;
}

.checkin-scan__usb-field {
  margin-top: 0.25rem;
}

.checkin-scan__usb-input {
  min-height: 3.5rem;
  font-size: 1.15rem;
  border-radius: 0.85rem;
}

/* —— Scan result popup —— */
body.checkin-result-open {
  overflow: hidden;
}

.checkin-result-popup {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(1rem + var(--checkin-safe-top)) 1rem calc(1rem + var(--checkin-safe-bottom));
}

.checkin-result-popup[hidden] {
  display: none !important;
}

.checkin-result-popup__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 20, 0.62);
  backdrop-filter: blur(3px);
}

.checkin-result-popup__card {
  position: relative;
  z-index: 1;
  width: min(92vw, 22rem);
  padding: 1.5rem 1.25rem 1.25rem;
  border-radius: 1.25rem;
  text-align: center;
  color: #fff;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
  animation: checkin-result-in 0.22s ease-out;
}

.checkin-result-popup.is-allowed .checkin-result-popup__card {
  background: linear-gradient(165deg, #1f9d57 0%, var(--checkin-ok) 100%);
}

.checkin-result-popup.is-denied .checkin-result-popup__card {
  background: linear-gradient(165deg, #d6453d 0%, var(--checkin-deny) 100%);
}

.checkin-result-popup__icon {
  font-size: 3.25rem;
  line-height: 1;
  margin-bottom: 0.55rem;
}

.checkin-result-popup__title {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0 0 0.45rem;
}

.checkin-result-popup__message {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.65rem;
  opacity: 0.96;
}

.checkin-result-popup__usage {
  margin: 0 0 0.85rem;
  padding: 0.55rem 0.75rem;
  border-radius: 0.5rem;
  background: rgba(15, 23, 42, 0.06);
  text-align: left;
  font-size: 0.92rem;
  line-height: 1.45;
}

.checkin-result-popup.is-allowed .checkin-result-popup__usage {
  background: rgba(27, 127, 74, 0.1);
}

.checkin-result-popup.is-nocount .checkin-result-popup__usage {
  background: rgba(180, 120, 20, 0.12);
}

.checkin-result-popup__usage-line + .checkin-result-popup__usage-line {
  margin-top: 0.2rem;
}

.checkin-result-popup__code {
  font-size: 0.85rem;
  opacity: 0.88;
  margin: 0 0 1rem;
  word-break: break-all;
}

.checkin-result-popup__card .btn {
  font-weight: 700;
  color: #122;
}

@keyframes checkin-result-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (min-width: 768px) {
  .checkin-scan__camera-wrap {
    min-height: 32rem;
  }
}
