/* ═══ CUPOM - COMPROVANTE DE APOSTA ═══ */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&display=swap');

.cupom-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  overflow-y: auto;
  animation: fadeIn .2s;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }

.cupom-wrapper {
  width: 100%; max-width: 340px;
  animation: slideUp .3s ease-out;
}

/* ─── Papel serrilhado ─── */
.cupom-paper {
  background: #fbfaf6;
  color: #111;
  font-family: 'IBM Plex Mono', 'Roboto Mono', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.5;
  padding: 20px 16px;
  position: relative;
  box-shadow: 0 8px 32px rgba(0,0,0,.35);
}
.cupom-paper::before,
.cupom-paper::after {
  content: '';
  display: block;
  position: absolute;
  left: 0; right: 0;
  height: 12px;
  background: linear-gradient(135deg, #fbfaf6 33.33%, transparent 33.33%) 0 0,
              linear-gradient(225deg, #fbfaf6 33.33%, transparent 33.33%) 0 0;
  background-size: 12px 12px;
  background-color: transparent;
}
.cupom-paper::before { top: -12px; transform: rotate(180deg); }
.cupom-paper::after { bottom: -12px; }

/* ─── Blocos ─── */
.cupom-header {
  text-align: center;
  padding-bottom: 12px;
  border-bottom: 1px dashed #999;
  margin-bottom: 12px;
}
.cupom-logo {
  height: 28px;
  filter: grayscale(1) brightness(0.2);
  margin-bottom: 4px;
}
.cupom-site { font-size: 10px; color: #666; }
.cupom-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  margin-top: 8px;
}

.cupom-info {
  padding: 10px 0;
  border-bottom: 1px dashed #999;
}
.cupom-ticket-id {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  text-align: center;
  margin: 4px 0;
}
.cupom-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #555;
}

.cupom-bets {
  padding: 10px 0;
  border-bottom: 1px dashed #999;
}
.cupom-bet {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dotted #ccc;
}
.cupom-bet:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.cupom-bet-league {
  font-size: 9px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.cupom-bet-match {
  font-size: 13px;
  font-weight: 600;
  margin: 2px 0;
}
.cupom-bet-datetime { font-size: 10px; color: #666; }
.cupom-bet-market {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 12px;
}
.cupom-bet-choice { font-weight: 500; }
.cupom-bet-odd {
  font-weight: 700;
  color: #16a34a;
  font-variant-numeric: tabular-nums;
}

.cupom-totals {
  padding: 12px 0;
  border-bottom: 1px dashed #999;
}
.cupom-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 4px;
}
.cupom-total-row.highlight {
  font-size: 14px;
  font-weight: 700;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #333;
}

.cupom-status {
  text-align: center;
  padding: 10px 0;
  border-bottom: 1px dashed #999;
}
.cupom-status-badge {
  display: inline-block;
  padding: 4px 16px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  border: 2px solid;
  border-radius: 4px;
}
.cupom-status-badge.ativa { color: #f59e0b; border-color: #f59e0b; }
.cupom-status-badge.ganha { color: #16a34a; border-color: #16a34a; }
.cupom-status-badge.perdida { color: #dc2626; border-color: #dc2626; }
.cupom-status-badge.cancelada { color: #6b7280; border-color: #6b7280; }

.cupom-qr {
  text-align: center;
  padding: 12px 0;
  border-bottom: 1px dashed #999;
}
.cupom-qr canvas, .cupom-qr img {
  width: 100px; height: 100px;
  image-rendering: pixelated;
}
.cupom-qr-label {
  font-size: 9px;
  color: #888;
  margin-top: 4px;
}

.cupom-footer {
  text-align: center;
  padding-top: 10px;
  font-size: 9px;
  color: #888;
  line-height: 1.4;
}
.cupom-footer .age-warning {
  display: inline-block;
  border: 1px solid #999;
  padding: 1px 6px;
  border-radius: 2px;
  font-weight: 700;
  font-size: 10px;
  margin-bottom: 4px;
}

/* ─── Botões ─── */
.cupom-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
  justify-content: center;
}
.cupom-actions button {
  flex: 1 1 calc(50% - 4px);
  min-width: 140px;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform .1s;
}
.cupom-actions button:active { transform: scale(.96); }
.cupom-btn-whatsapp { background: #25d366; color: #fff; }
.cupom-btn-download { background: #3b82f6; color: #fff; }
.cupom-btn-print { background: #6b7280; color: #fff; }
.cupom-btn-copy { background: #374151; color: #fff; }
.cupom-btn-close {
  flex: 1 1 100%;
  background: transparent;
  color: #9ca3af;
  border: 1px solid #4b5563 !important;
}

/* ─── Print ─── */
@media print {
  body * { visibility: hidden !important; }
  .cupom-overlay, .cupom-overlay * { visibility: visible !important; }
  .cupom-overlay {
    position: absolute; inset: 0;
    background: #fff !important;
    padding: 0 !important;
    display: block !important;
  }
  .cupom-wrapper {
    max-width: none !important;
    margin: 0 auto;
  }
  .cupom-paper {
    box-shadow: none !important;
    padding: 8px !important;
  }
  .cupom-paper::before, .cupom-paper::after { display: none; }
  .cupom-actions { display: none !important; }
  .cupom-logo { filter: grayscale(1) brightness(0) !important; }
}
/* Thermal 80mm */
@page { size: 80mm auto; margin: 0; }
@media print and (max-width: 80mm) {
  .cupom-paper { font-size: 10px !important; padding: 4px !important; }
  .cupom-ticket-id { font-size: 14px !important; }
}

/* F1-CUPOM-FIX-START */
/* app.css define .cupom-wrapper/.cupom-header/.cupom-title para o antigo cupom lateral (fixo, pointer-events:none);
   aqui o comprovante (overlay e bilhete.html) volta a ser um bloco normal e clicavel. */
.cupom-overlay .cupom-wrapper { position: relative; top: auto; right: auto; bottom: auto; left: auto; width: 100%; max-width: 340px; height: auto; margin: 0 auto; pointer-events: auto; z-index: auto; }
.cupom-paper .cupom-header { display: block; padding: 0 0 12px; border-bottom: 1px dashed #999; margin-bottom: 12px; }
.cupom-paper .cupom-title { font-size: 14px; font-weight: 700; letter-spacing: 2px; margin-top: 8px; }
.cupom-actions button { min-height: 44px; }
/* F1-CUPOM-FIX-END */


/* === PRE-BILHETE E BOTAO VER BILHETE COMPLETO (recado 0026: padrao pre-0005 + pre-bilhete) === */
.sheet-buttons-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.btn-preview-bet {
  width: 100%;
  min-height: 40px;
  background: var(--surface-2, #1e293b);
  color: #e2e8f0;
  border: 1px solid var(--border, #334155);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  transition: background 0.2s, border-color 0.2s, opacity 0.2s;
}
.btn-preview-bet:hover:not(:disabled) {
  background: #273549;
  border-color: #3b82f6;
  color: #fff;
}
.btn-preview-bet:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.sheet-buttons-group .btn-place-bet {
  width: 100%;
  margin-top: 0;
}

@media (max-width: 1023px) {
  #cupomSheet.cupom-sheet {
    max-height: 88vh;
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 12px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  #cupomSheet .sheet-body {
    min-height: 64px;
  }
  #cupomSheet .sheet-footer {
    flex-shrink: 0;
  }
}

@media (min-width: 1024px) {
  #cupomSheet.cupom-sheet {
    overflow-y: auto;
  }
  #cupomSheet .sheet-body {
    min-height: 120px;
  }
  #cupomSheet .sheet-footer {
    flex-shrink: 0;
  }
}

/* Telas baixas (iPhone SE 667px, Android compacto, teclado virtual, laptops 768-800px) */
@media (max-width: 1023px) and (max-height: 740px) {
  #cupomSheet.cupom-sheet {
    max-height: 94vh;
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 8px);
  }
  #cupomSheet .sheet-header {
    padding: 0 14px 8px;
  }
  #cupomSheet .sheet-tabs {
    margin: 6px 14px;
    height: 32px;
  }
  #cupomSheet .sheet-body {
    min-height: 76px;
  }
  #cupomSheet .sheet-footer {
    padding: 8px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  }
  #cupomSheet .sheet-accept {
    margin-bottom: 6px;
  }
  #cupomSheet .sheet-accept .checkbox-label {
    min-height: 28px;
  }
  #cupomSheet #sheetSaldo {
    margin-bottom: 6px;
  }
  #cupomSheet #sheetSaldo button {
    min-height: 32px;
    height: 32px;
  }
  #cupomSheet .sheet-value {
    margin-bottom: 6px;
  }
  #cupomSheet .quick-values {
    margin-bottom: 6px;
  }
  #cupomSheet .quick-btn {
    min-height: 34px;
    height: 34px;
  }
  #cupomSheet .value-input-wrap {
    min-height: 40px;
    height: 40px;
  }
  #cupomSheet .sheet-summary {
    margin-bottom: 6px;
  }
  #cupomSheet .slip-dica {
    margin: 2px 0 6px;
  }
  #cupomSheet .sheet-buttons-group {
    gap: 6px;
  }
  #cupomSheet .btn-preview-bet {
    min-height: 36px;
    height: 36px;
    font-size: 12.5px;
  }
  #cupomSheet .btn-place-bet {
    min-height: 44px;
    height: 44px;
  }
}

@media (min-width: 1024px) and (max-height: 850px) {
  #cupomSheet .sheet-footer {
    padding: 8px 14px 10px;
  }
  #cupomSheet .sheet-accept {
    margin-bottom: 6px;
  }
  #cupomSheet #sheetSaldo {
    margin-bottom: 6px;
  }
  #cupomSheet .sheet-value,
  #cupomSheet .quick-values,
  #cupomSheet .sheet-summary {
    margin-bottom: 6px;
  }
  #cupomSheet .quick-btn {
    min-height: 34px;
    height: 34px;
  }
  #cupomSheet .value-input-wrap {
    min-height: 40px;
    height: 40px;
  }
  #cupomSheet .btn-preview-bet {
    min-height: 36px;
    height: 36px;
  }
  #cupomSheet .btn-place-bet {
    min-height: 44px;
    height: 44px;
  }
}

.cupom-overlay.pre-bilhete-overlay {
  align-items: flex-start;
}
.cupom-overlay.pre-bilhete-overlay .cupom-wrapper {
  margin: auto;
}

.pre-badge-modal {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.35));
  border: 1px solid #f59e0b;
  color: #fbbf24;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.3px;
  margin-bottom: 12px;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.2);
}
.pre-badge-modal i { margin-right: 6px; }

.pre-actions-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
  width: 100%;
}
.cupom-btn-share-main {
  background: #0284c7;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px;
  min-height: 44px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s;
}
.cupom-btn-share-main:hover { background: #0369a1; }
.cupom-btn-confirm-main {
  background: var(--brand, #22c55e);
  color: #0b1220;
  border: none;
  border-radius: 8px;
  padding: 13px;
  min-height: 46px;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.3);
}
.cupom-btn-confirm-main:hover { opacity: 0.95; }
.cupom-btn-back-main {
  background: var(--surface-2, #1e293b);
  color: #cbd5e1;
  border: 1px solid var(--border, #334155);
  border-radius: 8px;
  padding: 10px;
  min-height: 44px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.cupom-btn-back-main:hover { background: #273549; color: #fff; }

.pre-share-panel {
  background: var(--surface, #121a2b);
  border: 1px solid var(--border, #22304d);
  border-radius: 10px;
  padding: 14px;
  margin-top: 10px;
  color: #e2e8f0;
}
.pre-share-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #fff;
}
.pre-share-url-box {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.pre-share-url-box input {
  flex: 1;
  background: #0b1220;
  border: 1px solid var(--border, #22304d);
  color: #93c5fd;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
}
.pre-share-url-box button {
  background: #0284c7;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0 12px;
  min-height: 40px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.pre-share-buttons {
  display: flex;
  gap: 8px;
}
.pre-share-buttons button {
  flex: 1;
  padding: 10px;
  min-height: 44px;
  border: none;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-pre-wpp { background: #25d366; color: #fff; }
.btn-pre-png { background: #3b82f6; color: #fff; }
