/**
 * BIVO — Aperçu billet (style boarding pass Apple-inspired)
 */

.bivo-ticket-modal .modal-dialog {
  max-width: 960px;
}

.bivo-ticket-modal .modal-content {
  border: 0;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.18);
}

.bivo-ticket-modal .modal-header {
  align-items: center;
  padding: 16px 22px;
  background: #fff;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.bivo-ticket-modal .modal-title {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--bivo-ink);
}

.bivo-ticket-modal .modal-body {
  padding: 0;
  background: #f4f6fa;
  max-height: min(78vh, 820px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.bivo-ticket-modal .modal-footer {
  padding: 12px 22px;
  background: #fff;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  gap: 10px;
}

.bivo-ticket-modal-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 280px;
  color: var(--bivo-muted);
  font-weight: 600;
}

.bivo-ticket-modal-loading .spinner-border {
  width: 2rem;
  height: 2rem;
  color: var(--bivo-orange);
}

.bivo-ticket-wrap {
  padding: 16px;
}

.bivo-ticket-preview {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  margin: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
  min-height: 0;
}

.bivo-ticket-pass {
  flex: 1 1 auto;
  min-width: 0;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 18px 0 0 18px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.bivo-ticket-stub {
  position: relative;
  flex: 0 0 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px 16px;
  background: linear-gradient(180deg, #fff 0%, #fafbfc 100%);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-left: 2px dashed rgba(15, 23, 42, 0.14);
  border-radius: 0 18px 18px 0;
  text-align: center;
  min-width: 0;
}

.bivo-ticket-stub-notch {
  position: absolute;
  left: -10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #f4f6fa;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.bivo-ticket-stub-notch-top { top: 28px; }
.bivo-ticket-stub-notch-bottom { bottom: 28px; }

.bivo-ticket-stub-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 10px;
}

.bivo-ticket-stub .bivo-meta {
  margin: 0;
  font-size: 0.65rem;
}

.bivo-ticket-qr {
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  background: #fff;
  padding: 4px;
}

.bivo-ticket-stub-ref {
  font-size: 0.875rem;
  font-weight: 800;
  color: var(--bivo-navy);
  letter-spacing: -0.01em;
}

.bivo-ticket-stub-route {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--bivo-ink);
  line-height: 1.3;
  word-break: break-word;
}

.bivo-ticket-stub-route i {
  color: var(--bivo-orange);
  font-size: 0.65rem;
}

.bivo-ticket-stub-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--bivo-muted);
  line-height: 1.35;
  word-break: break-word;
}

.bivo-ticket-stub-status {
  margin-top: 4px;
}

.bivo-ticket-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px 20px;
  padding: 20px 22px;
  background: linear-gradient(135deg, #152c70 0%, #1a3478 55%, #243f8f 100%);
  color: #fff;
}

.bivo-ticket-top-main {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
  flex: 1 1 320px;
}

.bivo-ticket-bus-visual {
  flex-shrink: 0;
}

.bivo-ticket-bus-img {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

.bivo-ticket-top-copy {
  min-width: 0;
}

.bivo-ticket-top-copy .bivo-meta {
  color: rgba(255, 255, 255, 0.72);
  margin-bottom: 4px;
}

.bivo-ticket-bus-name {
  margin: 0 0 10px;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  word-break: break-word;
}

.bivo-ticket-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bivo-ticket-badges .bivo-pill {
  min-width: 0;
  white-space: normal;
  text-align: center;
  line-height: 1.25;
  height: auto;
  min-height: 26px;
  padding: 4px 10px;
}

.bivo-ticket-top-aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  text-align: right;
}

.bivo-ticket-ref {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.75;
}

.bivo-ticket-price {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  white-space: normal;
  word-break: break-word;
}

.bivo-ticket-seats-count {
  font-size: 0.8125rem;
  font-weight: 600;
  opacity: 0.85;
}

.bivo-ticket-route-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px dashed rgba(15, 23, 42, 0.12);
  background: #fafbfc;
}

.bivo-ticket-route-point {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.bivo-ticket-route-point time {
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--bivo-orange);
  letter-spacing: -0.02em;
}

.bivo-ticket-route-point strong {
  font-size: 0.9375rem;
  font-weight: 800;
  color: var(--bivo-ink);
  line-height: 1.25;
  word-break: break-word;
}

.bivo-ticket-route-point span,
.bivo-ticket-route-point small {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--bivo-muted);
  line-height: 1.35;
  word-break: break-word;
}

.bivo-ticket-route-point.is-arrival {
  text-align: right;
  align-items: flex-end;
}

.bivo-ticket-route-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
}

.bivo-ticket-duration {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bivo-muted);
  white-space: nowrap;
}

.bivo-ticket-route-line {
  position: relative;
  width: 72px;
  height: 2px;
  background: linear-gradient(90deg, var(--bivo-orange), var(--bivo-navy));
  border-radius: 999px;
}

.bivo-ticket-route-line i {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  color: var(--bivo-navy);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.bivo-ticket-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
}

.bivo-ticket-section {
  padding: 18px 22px;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  min-width: 0;
}

.bivo-ticket-section:nth-child(odd) {
  border-right: 1px solid rgba(15, 23, 42, 0.06);
}

.bivo-ticket-section-pricing {
  grid-column: 1 / -1;
  background: #fffbf8;
}

.bivo-ticket-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--bivo-ink);
}

.bivo-ticket-section-title i {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(249, 83, 21, 0.1);
  color: var(--bivo-orange);
  font-size: 0.75rem;
}

.bivo-ticket-kv-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bivo-ticket-kv {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 4px 12px;
}

.bivo-ticket-k {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bivo-muted);
}

.bivo-ticket-v {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--bivo-ink-3);
  text-align: right;
  word-break: break-word;
  max-width: 100%;
}

.bivo-ticket-passenger-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bivo-ticket-passenger {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.bivo-ticket-passenger-main {
  min-width: 0;
}

.bivo-ticket-passenger-main strong {
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--bivo-ink);
  word-break: break-word;
}

.bivo-ticket-passenger-main span {
  display: block;
  margin-top: 2px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--bivo-muted);
}

.bivo-ticket-seat-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(21, 44, 112, 0.08);
  color: var(--bivo-navy);
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
}

.bivo-ticket-price-lines {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bivo-ticket-price-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--bivo-ink-3);
}

.bivo-ticket-price-line strong {
  font-weight: 700;
  color: var(--bivo-ink);
  word-break: break-word;
}

.bivo-ticket-price-line.is-discount strong {
  color: #15803d;
}

.bivo-ticket-price-total {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.bivo-ticket-price-total span {
  font-size: 0.875rem;
  font-weight: 800;
  color: var(--bivo-ink);
}

.bivo-ticket-price-total strong {
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--bivo-orange);
  letter-spacing: -0.02em;
}

.bivo-ticket-empty,
.bivo-ticket-error {
  margin: 0;
  padding: 16px;
  text-align: center;
  color: var(--bivo-muted);
  font-weight: 600;
}

.bivo-ticket-error {
  color: #b91c1c;
  background: rgba(220, 38, 38, 0.06);
  border-radius: 12px;
  margin: 16px;
}

.bivo-ticket-error i {
  display: block;
  font-size: 1.5rem;
  margin-bottom: 8px;
}

@media (max-width: 767px) {
  .bivo-ticket-modal .modal-dialog {
    margin: 0.75rem;
  }

  .bivo-ticket-preview {
    flex-direction: column;
  }

  .bivo-ticket-pass {
    border-radius: 18px 18px 0 0;
  }

  .bivo-ticket-stub {
    flex: 1 1 auto;
    width: 100%;
    border-left: 1px solid rgba(15, 23, 42, 0.08);
    border-top: 2px dashed rgba(15, 23, 42, 0.14);
    border-radius: 0 0 18px 18px;
  }

  .bivo-ticket-stub-notch {
    display: none;
  }

  .bivo-ticket-route-card {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .bivo-ticket-route-point.is-arrival {
    text-align: left;
    align-items: flex-start;
  }

  .bivo-ticket-route-mid {
    flex-direction: row;
    justify-content: flex-start;
    padding: 4px 0;
  }

  .bivo-ticket-route-line {
    width: 100%;
    max-width: 120px;
  }

  .bivo-ticket-grid {
    grid-template-columns: 1fr;
  }

  .bivo-ticket-section:nth-child(odd) {
    border-right: 0;
  }

  .bivo-ticket-top-aside {
    align-items: flex-start;
    text-align: left;
    width: 100%;
  }
}

@media print {
  body * {
    visibility: hidden;
  }

  #bivoTicketPrint,
  #bivoTicketPrint * {
    visibility: visible;
  }

  #bivoTicketPrint {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    border: 0;
    box-shadow: none;
    border-radius: 0;
  }

  .bivo-ticket-modal .modal-header,
  .bivo-ticket-modal .modal-footer {
    display: none !important;
  }
}
