/* ===== TICKET EXPORT DESIGN ===== */
.ticket-wrapper {
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.5));
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 10px; 
}

body.light-theme .ticket-wrapper {
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.15));
}

.ticket-wrapper {
  transform-style: preserve-3d;
}

/* Ticket Card Container with Transparent Side Cutouts */
.ticket-card {
  --r: 20px;
  --stub-h: 70px;
  --bg: var(--elevated);
  width: 100%;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  position: relative;
  transform-style: preserve-3d;
  background-color: var(--bg);
  background-size: cover;
  background-position: center;
  background-blend-mode: overlay;
  -webkit-mask:
    radial-gradient(circle at 0 100%, transparent var(--r), black calc(var(--r) + 0.5px)) top left / 50.5% calc(100% - var(--stub-h)) no-repeat,
    radial-gradient(circle at 100% 100%, transparent var(--r), black calc(var(--r) + 0.5px)) top right / 50.5% calc(100% - var(--stub-h)) no-repeat,
    radial-gradient(circle at 0 0, transparent var(--r), black calc(var(--r) + 0.5px)) bottom left / 50.5% var(--stub-h) no-repeat,
    radial-gradient(circle at 100% 0, transparent var(--r), black calc(var(--r) + 0.5px)) bottom right / 50.5% var(--stub-h) no-repeat;
  mask:
    radial-gradient(circle at 0 100%, transparent var(--r), black calc(var(--r) + 0.5px)) top left / 50.5% calc(100% - var(--stub-h)) no-repeat,
    radial-gradient(circle at 100% 100%, transparent var(--r), black calc(var(--r) + 0.5px)) top right / 50.5% calc(100% - var(--stub-h)) no-repeat,
    radial-gradient(circle at 0 0, transparent var(--r), black calc(var(--r) + 0.5px)) bottom left / 50.5% var(--stub-h) no-repeat,
    radial-gradient(circle at 100% 0, transparent var(--r), black calc(var(--r) + 0.5px)) bottom right / 50.5% var(--stub-h) no-repeat;
  transform-style: preserve-3d;
}

/* Top Section of Ticket */
.ticket-top {
  padding: 20px 20px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: translateZ(30px);
}

/* Header & Username */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.header h2 {
  font-size: 1.25rem;
  color: var(--text);
  font-weight: 600;
  margin: 0;
  line-height: 1;
}

.username-badge {
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.share-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s;
}

.share-btn:hover {
  background: var(--border);
  color: var(--text);
}

/* Summary Stats */
.stats-row {
  display: flex;
  justify-content: space-between;
  background: var(--bg);
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.stat-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.ticket-wrapper .stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
  position: relative;
  top: -1px;
}

.ticket-wrapper .stat-value {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
  position: relative;
  top: -2px;
}

/* Chart Section */
.chart-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.chart-container h3 {
  align-self: flex-start;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 500;
  margin: 0;
}

.canvas-wrapper {
  position: relative;
  width: 200px;
  height: 200px;
}

/* Custom Legend (Pills) */
.custom-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  width: 100%;
  margin-top: 10px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 20px;
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  transform: translateY(0.5px);
}

.legend-item span {
  position: relative;
  top: -2px;
}

/* Dashed Line separating main body and stub */
.divider {
  margin: 0 20px;
  border-bottom: 2px dashed var(--border);
  transform: translateZ(30px);
}

/* Bottom Stub (Footer) */
.ticket-bottom {
  height: 70px;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transform: translateZ(30px);
}

.footer-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.footer-brand {
  font-weight: 700;
  color: var(--text);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin: 0;
}

.footer-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.8rem;
}

.footer-link:hover {
  text-decoration: underline;
}

/* Decorative Barcode */
.barcode {
  display: flex;
  align-items: center;
  color: var(--muted);
  opacity: 0.3;
}
