Skip to content

Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️

6.7 KB
Raw Blame
@media print {
  @page {
    size: A4;
    margin: 8mm;
  }

  html, body {
    height: auto;
    margin: 0;
    padding: 0;
    background: #ffffff !important;
  }
}

.ticketWrapper {
  --stub-width: 236px;
  --ticket-border: #e4e7ec;
  --ticket-divider: #eceef1;
  --ticket-text: #0f1114;
  --ticket-muted: #6b7280;

  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;

  @media screen {
    container-type: inline-size;
  }
}

.ticket {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  color: var(--ticket-text);
  border: 1px solid var(--ticket-border);
  border-radius: 16px;
  overflow: hidden;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;

  &::before {
    content: '';
    flex: 0 0 4px;
    background: var(--accent);
  }

  @media screen {
    box-shadow: 0 1px 1px rgba(15, 17, 20, 0.03), 0 12px 32px -18px rgba(15, 17, 20, 0.25);
  }
}

.header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 24px 26px 20px;
}

.logo {
  flex: 0 0 auto;
  max-width: 108px;
  max-height: 44px;
  object-fit: contain;
  object-position: left top;
}

.headline {
  flex: 1 1 auto;
  min-width: 0;
}

.organizer {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ticket-muted);
  overflow-wrap: anywhere;
}

.eventTitle {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.021em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.status {
  flex: 0 0 auto;
  padding: 4px 10px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.statusCancelled {
  color: #b42318;
}

.statusPending {
  color: #b54708;
}

.main {
  display: flex;
  align-items: stretch;
  border-top: 1px solid var(--ticket-divider);
}

.info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 22px 26px 26px;
}

.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 28px;
  margin: 0;
}

.field {
  min-width: 0;
  margin: 0;
}

.fieldSpan {
  grid-column: 1 / -1;
}

.fieldLabel {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ticket-muted);
}

.fieldValue {
  margin: 5px 0 0;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.fieldMeta {
  margin: 3px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ticket-muted);
  overflow-wrap: anywhere;
}

.fieldEmphasis .fieldValue {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.012em;
}

.note {
  margin: auto 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--ticket-divider);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ticket-muted);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.stub {
  flex: 0 0 var(--stub-width);
  width: var(--stub-width);
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 26px 22px;
  border-left: 1px solid var(--ticket-divider);
  text-align: center;
}

.code {
  --bracket: var(--accent);

  position: relative;
  width: 100%;
  max-width: 192px;
  padding: 13px;

  &::before,
  &::after,
  .codeInner::before,
  .codeInner::after {
    content: '';
    position: absolute;
    width: 17px;
    height: 17px;
    border: 0 solid var(--bracket);
  }

  &::before {
    top: 0;
    left: 0;
    border-top-width: 2px;
    border-left-width: 2px;
    border-top-left-radius: 5px;
  }

  &::after {
    top: 0;
    right: 0;
    border-top-width: 2px;
    border-right-width: 2px;
    border-top-right-radius: 5px;
  }

  .codeInner::before {
    bottom: 0;
    left: 0;
    border-bottom-width: 2px;
    border-left-width: 2px;
    border-bottom-left-radius: 5px;
  }

  .codeInner::after {
    bottom: 0;
    right: 0;
    border-bottom-width: 2px;
    border-right-width: 2px;
    border-bottom-right-radius: 5px;
  }
}

.codeInner {
  background: #ffffff;
}

.codeVoid {
  --bracket: #d6d9de;
}

.codeMessage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  aspect-ratio: 1;
  color: var(--ticket-muted);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.4;
  text-wrap: balance;
}

.ticketId {
  width: 100%;
  min-width: 0;
}

.ticketIdValue {
  display: block;
  margin-top: 5px;
  font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  overflow-wrap: anywhere;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.poweredBy {
  display: none;
}

@container (max-width: 599px) {
  .header {
    padding: 20px 20px 16px;
    gap: 14px;
  }

  .logo {
    max-width: 84px;
    max-height: 36px;
  }

  .eventTitle {
    font-size: 21px;
  }

  .main {
    flex-direction: column;
  }

  .stub {
    order: -1;
    flex: 0 0 auto;
    width: 100%;
    gap: 16px;
    padding: 22px 20px;
    border-left: none;
    border-bottom: 1px solid var(--ticket-divider);
  }

  .code {
    max-width: 216px;
  }

  .ticketId {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 10px;
  }

  .ticketIdValue {
    margin-top: 0;
  }

  .info {
    gap: 18px;
    padding: 20px 20px 22px;
  }

  .fields {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .fieldEmphasis .fieldValue {
    font-size: 18px;
  }

  .actions {
    flex-direction: column;

    button {
      width: 100%;
    }
  }
}

@media print {
  .ticketWrapper {
    flex: 1 1 auto;
    max-width: none;
    margin: 0;
    gap: 0;
    padding: 12mm 12mm 0;
  }

  .ticket {
    flex: 0 0 auto;
    border: none;
    border-radius: 0;
    box-shadow: none;

    &::before {
      flex-basis: 3px;
    }
  }

  .header {
    padding: 9mm 0 8mm;
  }

  .eventTitle {
    font-size: 30px;
  }

  .main {
    border-bottom: 1px solid var(--ticket-divider);
  }

  .info {
    padding: 9mm 8mm 9mm 0;
    gap: 9mm;
  }

  .fields {
    gap: 8mm 8mm;
  }

  .fieldValue {
    font-size: 15.5px;
  }

  .fieldEmphasis .fieldValue {
    font-size: 22px;
  }

  .fieldMeta {
    font-size: 13.5px;
  }

  .note {
    font-size: 13px;
  }

  .stub {
    flex: 0 0 46mm;
    width: 46mm;
    padding: 9mm 0 9mm 8mm;
    border-left: none;
    justify-content: flex-start;
  }

  .code {
    max-width: 40mm;
  }

  .logo {
    max-height: 16mm;
  }

  .actions {
    display: none;
  }

  .poweredBy {
    display: block;
    margin-top: auto;
    padding: 8mm 0 12mm;
    text-align: center;
  }
}