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

body,
button {
  font-family: "Montserrat", sans-serif;
}

.golden-page {
  min-height: 100vh;
  background-image: url("./assets/background_optimized.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: 0 0 3rem;
  position: relative;
  overflow-x: hidden;
}

.gold-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

.hero-header {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2.5rem 1.5rem 2rem;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1.5rem;
}

.brand-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  width: 150px;
}

.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d4af37;
}

.brand-logo {
  height: 60px;
  width: auto;
  display: block;
}

.event-label {
  font-size: 26px;
  color: black;
  margin-bottom: 0.5rem;
  font-family: "Playwrite NO";
}
.event-title {
  font-size: clamp(22px, 4vw, 34px);
  font-weight: 700;
  color: black;
  line-height: 1.2;
  margin-bottom: 1rem;
  text-shadow: 0 0 30px rgba(212, 175, 55, 0.3);
}
.event-subtitle {
  font-size: 13px;
  color: rgba(212, 175, 55, 0.55);
  margin-bottom: 1rem;
}

.event-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.meta-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #1a1200;
  font-weight: 700;
  background: linear-gradient(135deg, #bf953f, #fcf6ba, #b38728, #fcf6ba, #bf953f);
  background-size: 200% 100%;
  border: 1px solid rgba(184, 135, 11, 0.5);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  border-radius: 20px;
  padding: 5px 14px;
  text-shadow: 0 0.5px 0 rgba(255, 255, 255, 0.3);
}
.meta-icon {
  font-size: 14px;
}

.main-content {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  /* padding: 2rem 1.25rem 0; */
}

.screen {
  display: none;
}
.screen.active {
  display: block;
}

.card-gold {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 24px;
  padding: 2.5rem 1.75rem;
  box-shadow:
    20px 20px 20px 20px rgba(0, 0, 0, 0.1),
    inset 0 0 20px rgba(255, 255, 255, 0.5);
  position: relative;
  z-index: 1;
}

.card-gold::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 24px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: -1;
  pointer-events: none;
}

.card-title {
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: black;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.qr-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}
.qr-ring {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 1.5px solid black;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: rgba(255, 255, 255, 0.2);
}
.qr-ring::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  border: 1px dashed black;
}
.qr-icon {
  width: 68px;
  height: 68px;
}

.qr-desc {
  text-align: center;
  font-size: 14px;
  line-height: 1.6;
  color: black;
  font-weight: 600;
  max-width: 300px;
}

.btn-gold {
  width: 100%;
  padding: 15px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #b8870b, #d4af37, #e8c84a, #d4af37, #b8870b);
  background-size: 200% 100%;
  color: #1a1200;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.btn-gold:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-gold:active {
  transform: scale(0.98);
}
.btn-gold:disabled {
  opacity: 0.8;
  cursor: not-allowed;
  transform: none;
}

.btn-outline {
  width: 100%;
  padding: 13px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.35);
  background: white;
  color: black;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 10px;
  font-weight: 700;
}

.cam-box {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  margin-bottom: 1rem;
}
#qrVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.scan-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, #e8c84a, transparent);
  animation: scanDown 2s linear infinite;
  z-index: 20;
  pointer-events: none;
}
@keyframes scanDown {
  0% {
    top: 0;
  }
  100% {
    top: 100%;
  }
}
.scan-corner {
  position: absolute;
  width: 40px;
  height: 40px;
  border-color: #e8c84a;
  border-style: solid;
  z-index: 21;
  pointer-events: none;
}
/* Đặt sát mép cam-box */
.sc-tl {
  top: 8px;
  left: 8px;
  border-width: 6px 0 0 6px;
}
.sc-tr {
  top: 8px;
  right: 8px;
  border-width: 6px 6px 0 0;
}
.sc-bl {
  bottom: 8px;
  left: 8px;
  border-width: 0 0 6px 6px;
}
.sc-br {
  bottom: 8px;
  right: 8px;
  border-width: 0 6px 6px 0;
}

.scan-hint {
  text-align: center;
  font-size: 13px;
  color: black;
  margin-bottom: 1rem;
  font-weight: 500;
}

.info-form {
  display: flex;
  flex-direction: column;
}

.guest-card {
  background: linear-gradient(135deg, #bf953f, #fcf6ba, #b38728, #fcf6ba, #bf953f);
  background-size: 200% 100%;
  border: 1px solid rgba(184, 135, 11, 0.5);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 0.5rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}
.guest-name {
  font-size: 18px;
  font-weight: 700;
  color: black;
  margin-bottom: 4px;
}
.guest-title {
  font-size: 13px;
  color: black;
  margin-bottom: 8px;
}
.guest-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.guest-tag {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  background: #fcf6ba;
  background-size: 200% 100%;
  border: 1px solid rgba(184, 135, 11, 0.9);
  color: black;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 1rem;
}
.field-label {
  font-size: 14px;
  color: black;
  font-weight: 600;
}
.field-required {
  color: #e54343;
}

.form-input {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  background: white;
  font-size: 14px;
  color: black;
  font-family: inherit;
  outline: none;
  transition: all 0.2s;
}
.form-input:focus {
  border-color: #d4af37;
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

.photo-field {
  border: 1.5px dashed rgba(212, 175, 55, 0.35);
  border-radius: 12px;
  overflow: hidden;
  background: transparent;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    border-color 0.2s,
    background 0.2s;
  position: relative;
}
.photo-field:hover {
  border-color: #d4af37;
  background: rgba(212, 175, 55, 0.06);
}
.photo-field.has-photo {
  min-height: auto;
}
.photo-placeholder {
  text-align: center;
  padding: 1.5rem 1rem;
}
.photo-cam-icon {
  font-size: 32px;
  margin-bottom: 8px;
}
.photo-hint {
  font-size: 12px;
  color: rgba(0, 0, 0, 0.9);
}
.photo-preview {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
}
.photo-retake {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 8px;
  color: #d4af37;
  font-weight: 600;
  font-size: 14px;
  padding: 8px 16px;
  cursor: pointer;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-content {
  width: 90%;
  max-width: 320px;
  padding: 20px;
}
#photoInput,
#cameraInput {
  display: none;
}

.success-screen {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}
.success-ring {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 2px solid rgb(38, 189, 0);
  background: rgba(81, 212, 55, 0.2);
  color: rgb(38, 189, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  animation: popIn 0.4s cubic-bezier(0.17, 0.89, 0.32, 1.28);
}
@keyframes popIn {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}
.success-title {
  font-size: 20px;
  font-weight: 700;
  color: rgb(38, 189, 0);
}
.success-guest {
  font-size: 25px;
  font-weight: 800;
  font-family: "Playwrite NO";
  color: black;
  margin-top: 1.2rem;
}
.success-msg {
  font-size: 13px;
  color: black;
  line-height: 1.5;
  max-width: 300px;
}

.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.25), transparent);
  margin: 1.25rem 0;
}

.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 1.5rem;
}
.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.3);
  transition: all 0.3s;
}
.step-dot.active {
  background: black;
  transform: scale(1.5);
}
.step-dot.done {
  background: rgba(0, 0, 0, 0.5);
}

.toast-box {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: rgba(20, 14, 0, 0.95);
  border: 1px solid rgba(212, 175, 55, 0.5);
  border-radius: 12px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #d4af37;
  z-index: 999;
  transition: transform 0.35s cubic-bezier(0.17, 0.89, 0.32, 1.28);
  white-space: nowrap;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}
.toast-box.show {
  transform: translateX(-50%) translateY(0);
}

.loading-dots {
  display: inline-flex;
  gap: 4px;
}
.loading-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #d4af37;
  opacity: 0.3;
  animation: dotPulse 1.2s ease-in-out infinite;
}
.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}
.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes dotPulse {
  0%,
  80%,
  100% {
    opacity: 0.2;
    transform: scale(0.8);
  }
  40% {
    opacity: 1;
    transform: scale(1);
  }
}

/* New Spinner Icon Animation */
.btn-loading-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(26, 18, 0, 0.2);
  border-top-color: #1a1200;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
/* Selfie Popup Styles */
.selfie-popup {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.selfie-popup.active {
  display: flex;
}

.selfie-cont.cam-box {
  width: 100%;
  aspect-ratio: 1/1;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.scan-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.95);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  z-index: 100;
  color: #d4af37;
  font-weight: 600;
  font-size: 14px;
}
.scan-loading-overlay.active {
  display: flex;
}

.selfie-container {
  width: 100%;
  max-width: 70vw;
  background: #fff;
  border-radius: 24px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

.selfie-header {
  padding: 1.25rem;
  text-align: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.selfie-video-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 3/4;
  background: #000;
}

#selfieVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.selfie-footer {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.face-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 16px;
  font-weight: 600;
  padding: 8px;
  border-radius: 100px;
  background: rgba(0, 0, 0, 0.03);
  transition: all 0.3s;
}

.face-status.detected {
  background: rgba(128, 212, 55, 0.1);
  color: #51d437;
}

.face-status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ccc;
}

.detected .face-status-dot {
  background: #51d437;
  box-shadow: 0 0 10px #51d437;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.5);
    opacity: 0.5;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

#countdownOverlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 8rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  z-index: 10;
}
.btn-edit-guest {
  background: #fcf6ba;
  border: 1px solid rgba(184, 135, 11, 0.9);
  color: black;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-edit-guest:hover {
  background: #d4af37;
  color: #fff;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: #d4af37;
  text-align: center;
  margin-bottom: 1.5rem;
  text-transform: uppercase;
}

.modal-actions {
  display: flex;
  gap: 1rem;
}
.modal-actions button {
  flex: 1;
}
