@import url("https://fonts.googleapis.com/css2?family=Dancing+Script:wght@600;700&display=swap");

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  font-family: "Roboto", sans-serif;
  background: #ececec;
  color: #2f2f2f;
}

.popup {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  z-index: 9999;
}

.popup.is-open {
  opacity: 1;
  pointer-events: auto;
}

.popup-card {
  width: min(520px, 94vw);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(6px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
  padding: 22px 22px 16px;
  text-align: center;
  transform: translateY(8px) scale(0.98);
  transition: transform 180ms ease;
}

.popup.is-open .popup-card {
  transform: translateY(0) scale(1);
}

.popup-title {
  font-size: 28px;
  font-weight: 800;
  color: #6a2f2f;
  line-height: 1.1;
}

.popup-subtitle {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.popup-gif {
  margin-top: 12px;
  width: 100%;
  max-width: 380px;
  height: auto;
  border-radius: 12px;
}

.screen {
  width: min(1280px, 98vw);
  height: min(800px, min(96vh, 100dvh));
  min-height: 0;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(460px, 520px) 1fr;
  gap: 0;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  background: #ffffff;
}

.ticket-card {
  background: #ffffff;
  padding: 14px 18px 12px;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-content: start;
}

.ticket-header p {
  margin: 0;
  text-align: center;
  font-size: clamp(16px, 2.35vw, 22px);
  font-weight: 700;
  line-height: 1.18;
  color: #6a2f2f;
}

.ticket-header p + p {
  margin-top: 2px;
}

/* Footer luôn đáy (grid). margin-top:auto trên ticket-qr đẩy QR sát footer — khoảng trống chuyển lên giữa vé và QR */
.ticket-body {
  margin-top: 10px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}

.ticket-info {
  flex: 0 1 auto;
  min-height: 0;
  /* % theo body (1fr), không theo chiều cao QR; thu QR chỉ tạo khoảng trống giữa — muốn list rộng hơn phải tăng max-height/min-height ở đây */
  max-height: calc(47% + 15px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  padding-right: 6px;
  padding-bottom: 2px;
  margin-bottom: 8px;
}

.ticket-qr {
  flex: 0 0 auto;
  margin-top: auto;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  padding-top: 8px;
  padding-bottom: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: visible;
}

.ticket-qr.is-empty {
  justify-content: center;
  min-height: 72px;
  padding-top: 6px;
}

.ticket-qr.is-empty #qr-image {
  display: none;
}

.ticket-qr h3 {
  margin: 0 0 14px;
}

/* Kích thước chủ yếu do width — max-height chỉ áp khi h > max; nếu h đã nhỏ hơn max thì đổi max-height không đổi gì */
#qr-image {
  display: block;
  width: min(100%, 190px);
  max-width: 100%;
  max-height: min(180px, 50vh);
  height: auto;
  object-fit: contain;
  object-position: center bottom;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 11px;
  padding: 6px;
  box-sizing: border-box;
  background: #fff;
}

.ticket-info h3,
.ticket-footer h3 {
  margin: 0 0 11px;
  font-size: 18px;
  color: #6a2f2f;
  font-weight: 700;
}

.ticket-item {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 20px;
  align-items: start;
}

.item-content {
  min-width: 0;
}

.ticket-item img {
  width: 88px;
  height: 66px;
  object-fit: cover;
  border-radius: 8px;
}

.item-content .row {
  display: grid;
  grid-template-columns: minmax(0, 50%) minmax(0, 1fr);
  gap: 10px 12px;
  align-items: start;
}

.item-content p {
  margin: 0;
  font-size: 17px;
}

.ticket-name {
  font-size: 21px !important;
  font-weight: 500;
  line-height: 1.15;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}

.ticket-name .en {
  display: block;
}

.item-content .row strong {
  font-size: 23px;
  letter-spacing: 0.2px;
  text-align: right;
  justify-self: end;
  white-space: normal;
}

.amount {
  margin-top: 6px !important;
  color: #5b5b5b;
  font-weight: 700;
}

.ticket-footer {
  border-top: 2px solid rgba(0, 0, 0, 0.07);
  padding-top: 12px;
  padding-bottom: 2px;
}

.payment-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
  font-size: clamp(18px, 2.55vw, 24px);
  font-weight: 400;
}

.payment-row span {
  min-width: 0;
}

.payment-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.05;
}

.payment-label .vi {
  font-weight: 600;
}

.payment-label .en {
  font-size: clamp(13px, 1.85vw, 18px);
  font-style: normal;
  font-weight: 600;
  opacity: 1;
}

.payment-row strong {
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.payment-row.total {
  color: #6a2f2f;
  margin-top: 8px;
}

.hero {
  position: relative;
  overflow: hidden;
  background: #ddd;
}

.hero-slides {
  width: 100%;
  height: 100%;
  display: flex;
  transition: transform 360ms ease;
  touch-action: pan-y;
  user-select: none;
  cursor: grab;
}

.hero-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.hero-dots {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 3;
}

.hero-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
}

.hero-dot.is-active {
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2);
}


.hero-overlay {
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: min(92%, 760px);
  text-align: center;
  color: #7a2f2f;
  z-index: 2;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.75);
}

.hero-overlay h1 {
  margin: 0;
  font-family: "Dancing Script", cursive;
  font-size: 49px;
  font-weight: 700;
  line-height: 1;
}

.hero-overlay h2 {
  margin: 4px 0 10px;
  font-family: "Dancing Script", cursive;
  font-size: 23px;
  font-weight: 600;
  line-height: 1;
}

.hero-overlay p {
  margin: 0;
  font-size: 25px;
  font-style: italic;
  font-weight: 500;
}

.hero-overlay small {
  display: block;
  margin-top: 4px;
  font-size: 17px;
  font-style: italic;
  opacity: 0.92;
}

@media (max-width: 980px) {
  .screen {
    grid-template-columns: 1fr;
    height: auto;
  }

  .ticket-body {
    min-height: 280px;
    overflow: visible;
  }

  .ticket-info {
    max-height: min(41vh, 317px);
  }

  .ticket-qr {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding-top: 12px;
  }

  .hero {
    min-height: 380px;
  }

}
