@use "../../../styles/mixins";

@media print {
  @page {
    size: A4;
    margin: 0.5in;
  }

  body {
    font-size: 11pt;
    line-height: 1.3;
    margin: 0;
    padding: 0;
  }

  html, body {
    height: auto;
    margin: 0;
    padding: 0;
  }
}

.ticket {
  background: #ffffff;
  border-radius: var(--mantine-radius-md);
  border: 1px solid var(--mantine-color-gray-3);
  max-width: 750px;
  margin: 0 auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;

  @media print {
    box-shadow: none;
    border: none;
    border-radius: 0;
    max-width: 100%;
    width: auto;
    height: auto;
    min-height: 0;
    margin: 20px;
    padding: 0;
    display: block;
    page-break-inside: avoid;
    break-inside: avoid;
  }
}

// Header
.header {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 24px 32px;

  @include mixins.respond-below(sm) {
    padding: 20px;
  }

  @media print {
    background: #ffffff;
    border-bottom: 2px solid #e0e0e0;
    padding: 8px 0;
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
    page-break-inside: avoid;
    break-inside: avoid;
  }
}

.headerContent {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;

  @include mixins.respond-below(sm) {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
}

.eventTitle {
  font-size: 24px;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
  line-height: 1.3;
  letter-spacing: -0.01em;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;

  @include mixins.respond-below(sm) {
    font-size: 20px;
  }

  @media print {
    font-size: 24px;
    margin-bottom: 5px;
    line-height: 1.2;
  }
}

.priceDisplay {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;

  @include mixins.respond-below(sm) {
    font-size: 16px;
  }

  @media print {
    font-size: 20px;
    font-weight: 700;
  }
}

// Content
.content {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 32px;
  padding: 32px;
  flex: 1;
  align-items: start;

  @include mixins.respond-below(md) {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 24px 20px;
  }

  @media print {
    grid-template-columns: 2fr 1fr;
    padding: 0;
    gap: 30px;
    align-items: start;
    page-break-inside: avoid;
    break-inside: avoid;
  }
}

.contentLeft {
  display: flex;
  flex-direction: column;
  gap: 28px;

  @include mixins.respond-below(sm) {
    gap: 20px;
  }

  @media print {
    gap: 20px;
    justify-content: center;
  }
}

// Event Details
.eventDetails {
  display: flex;
  flex-direction: column;
  gap: 20px;

  @include mixins.respond-below(sm) {
    gap: 18px;
  }

  @media print {
    gap: 15px;
  }
}

.detailRow {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detailLabel {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;

  @media print {
    font-size: 11px;
    color: #666666;
    font-weight: 600;
  }
}

.detailValue {
  font-size: 16px;
  font-weight: 500;
  color: #1e293b;
  line-height: 1.4;

  @include mixins.respond-below(sm) {
    font-size: 15px;
  }

  @media print {
    font-size: 16px;
    font-weight: 600;
  }
}

// Attendee Section
.attendeeSection {
  background: #f1f5f9;
  padding: 24px;
  border-radius: 4px;
  margin-top: auto;

  @include mixins.respond-below(sm) {
    padding: 20px;
  }

  @media print {
    background: #ffffff;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #d0d0d0;
  }
}

.attendeeName {
  font-size: 18px;
  font-weight: 600;
  color: #1e293b;
  margin: 8px 0 4px;

  @include mixins.respond-below(sm) {
    font-size: 17px;
  }

  @media print {
    font-size: 18px;
    margin: 8px 0 4px;
    font-weight: 700;
  }
}

.attendeeEmail {
  font-size: 14px;
  color: #64748b;

  @media print {
    font-size: 14px;
    color: #666666;
  }
}

// Footer Text
.footerText {
  font-size: 14px;
  color: #475569;
  line-height: 1.5;
  flex: 1;

  @include mixins.respond-below(sm) {
    font-size: 13px;
  }

  @media print {
    color: #555555;
    font-size: 13px;
    line-height: 1.5;
  }
}

// Right Section - QR Code
.contentRight {
  display: flex;
  justify-content: center;
  align-items: flex-start;

  @include mixins.respond-below(md) {
    order: -1;
    justify-content: center;
    padding: 20px 0;
  }
}

.qrSection {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  justify-content: center;

  @media print {
    gap: 15px;
    justify-content: flex-start;
  }
}

.logoContainer {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.logo {
  max-width: 250px;
  max-height: 200px;
  object-fit: contain;
}

.qrContainer {
  position: relative;
  padding: 16px;
  background: #ffffff;
  border: 3px solid var(--accent);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 160px;
  min-height: 160px;
  max-width: 220px;
  max-height: 220px;

  @include mixins.respond-below(sm) {
    padding: 14px;
  }

  @media print {
    border-color: var(--accent);
    padding: 15px;
    border-width: 3px;
  }
}

// QR Placeholder States (Awaiting Payment / Cancelled)
.qrPlaceholder {
  position: relative;
  width: 160px;
  height: 160px;
  border-radius: 12px;
  border: 2px solid;
  overflow: hidden;

  @include mixins.respond-below(sm) {
    width: 140px;
    height: 140px;
  }

  @media print {
    width: 160px;
    height: 160px;
  }
}

.qrPlaceholderPending {
  border-color: var(--mantine-primary-color-light-hover);
  background-color: var(--mantine-primary-color-light);
}

.qrPlaceholderCancelled {
  border-color: var(--mantine-color-red-3);
  background-color: var(--mantine-color-red-0);
}

// Faded QR pattern background
.qrPatternBackground {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: 12px;
  opacity: 0.1;
}

.qrPatternCell {
  border-radius: 1px;
}

.qrPlaceholderPending .qrPatternCellFilled {
  background-color: var(--mantine-primary-color-filled);
}

.qrPlaceholderCancelled .qrPatternCellFilled {
  background-color: var(--mantine-color-red-9);
}

// Status content overlay
.qrPlaceholderContent {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.statusIconCircle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;

  @include mixins.respond-below(sm) {
    width: 40px;
    height: 40px;
  }
}

.statusIconPending {
  background-color: var(--mantine-primary-color-filled);
}

.statusIconCancelled {
  background-color: var(--mantine-color-red-6);
}

.statusText {
  font-size: 14px;
  font-weight: 700;

  @include mixins.respond-below(sm) {
    font-size: 13px;
  }
}

.statusTextPending {
  color: var(--mantine-primary-color-filled);
}

.statusTextCancelled {
  color: var(--mantine-color-red-7);
}

.ticketId {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ticketIdValue {
  font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  background: #f8fafc;
  padding: 8px 16px;
  border-radius: 4px;
  letter-spacing: 0.05em;

  @include mixins.respond-below(sm) {
    font-size: 13px;
    padding: 6px 12px;
  }

  @media print {
    color: var(--accent);
    background: #f0f0f0;
    font-size: 14px;
    padding: 8px 16px;
    font-weight: 700;
  }
}

// Footer
.footer {
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  padding: 20px 32px;

  @include mixins.respond-below(sm) {
    padding: 16px 20px;
  }

  @media print {
    background: #ffffff;
    border-top: 2px solid #e0e0e0;
    padding: 12px 0;
    margin-top: 12px;
    page-break-inside: avoid;
    break-inside: avoid;
  }
}

.footerContent {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;

  @include mixins.respond-below(md) {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }

  @media print {
    justify-content: center;
  }
}

.actions {
  display: flex;
  gap: 12px;

  @include mixins.respond-below(md) {
    width: 100%;
    justify-content: center;
  }

  @include mixins.respond-below(sm) {
    flex-direction: column;
    max-width: 280px;
    gap: 8px;

    button {
      width: 100%;
    }
  }

  @media print {
    display: none;
  }
}

.poweredByInTicket {
  display: none;

  @media print {
    display: block;
    margin-top: 20px;
    text-align: center;
    page-break-inside: avoid;
    break-inside: avoid;
  }
}
