/* Página Regulamento — visualizador PDF por modalidade */

/* Página inteira em amarelo (padrão das seções da home) */
body.page-regulamento {
  background-color: #ffd500;
  background-image: none;
}

.regulamento-page {
  /* Não usar padding shorthand — preserva padding-top de .site-main (header + countdown) */
  padding-inline: 0;
  padding-bottom: var(--space-6);
  background: transparent;
}

.regulamento-shell {
  max-width: min(100%, 980px);
  margin: 0 auto;
  padding-inline: var(--space-3);
}

/* Tipografia/espaçamento do hero: ver .page-hero em layout.css */

/* Abas — mesmo padrão das abas do box "Meus números da sorte" (.sorte99-numeros__tab) */
.regulamento-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
  width: min(100%, 56rem);
  margin: 0 auto var(--space-3);
  padding: 0.4rem;
  border-radius: 999px;
  background: #f2f2f5;
  box-sizing: border-box;
}

.regulamento-tab {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 4.4rem;
  padding: 0 1.2rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(0, 0, 0, 0.6);
  font-family: var(--font-ui);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.regulamento-tab:hover {
  color: #000000;
}

.regulamento-tab.is-active {
  background: #ffd500;
  color: #000000;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.regulamento-tab:focus-visible {
  outline: 2px solid #000000;
  outline-offset: 2px;
}

.regulamento-certificado {
  margin: 0 0 var(--space-3);
  text-align: center;
  font-family: var(--font-ui);
  font-size: 1.3rem;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.75);
}

.regulamento-viewer {
  border-radius: var(--radius-card);
  border: 0px solid rgba(0, 0, 0,  0.2);
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: none;
  box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

/* Cabeçalho do visualizador — mesmo tratamento do selo "Próximo sorteio" (wc-countdown-sorteio) */
.regulamento-toolbar {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 0.4rem solid #ff8fc2;
  background: radial-gradient(130% 110% at 50% 20%, #ff4d97 0%, #f51b72 55%, #e30f62 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -0.6rem 1.2rem rgba(150, 0, 55, 0.22);
}

.regulamento-toolbar__group {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.regulamento-toolbar__group--download {
  margin-left: auto;
}

.regulamento-canvas-wrap {
  position: relative;
  min-height: min(72vh, 820px);
  max-height: min(78vh, 900px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  padding: 0.75rem 0 4.75rem 0;
}

.regulamento-page-stage {
  position: relative;
  width: fit-content;
  max-width: calc(100% - 1.5rem);
  margin: 0 auto;
}

.regulamento-canvas-wrap canvas {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  box-shadow: 0 12px 28px rgba(0, 0, 0,  0.18);
}

/* A página do PDF é desenhada em partes: fica oculta até terminar e entra com fade */
@media (prefers-reduced-motion: no-preference) {
  .regulamento-canvas-wrap canvas {
    transition: opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .regulamento-canvas-wrap canvas.is-rendering {
    opacity: 0;
    transition: none;
  }
}

.regulamento-toolbar__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 1.1875rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.regulamento-toolbar__btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.75);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18);
}

.regulamento-toolbar__btn:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.regulamento-toolbar__btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.regulamento-toolbar__page {
  min-width: 4.5rem;
  font-family: var(--font-ui);
  font-size: 1.3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #ffffff;
  text-align: center;
  text-shadow: 0 1px 2px rgba(150, 0, 55, 0.25);
}

.regulamento-status {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: var(--space-3);
  text-align: center;
  color: #5b5b5b;
  background: rgba(255, 255, 255, 0.96);
}

.regulamento-status[hidden] {
  display: none !important;
}

.regulamento-status i {
  font-size: 2rem;
  color: var(--color-primary);
}

.regulamento-status--error {
  color: #8e2018;
}

.regulamento-footer-note {
  margin: var(--space-3) 0 0;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 0, 0,  0.2);
  background: rgba(255, 255, 255, 0.92);
  font-size: 1.05rem;
  line-height: 1.45;
  color: #5b5b5b;
  text-align: center;
}

.regulamento-footer-note a {
  color: var(--color-primary-dark);
  font-weight: 700;
}

@media (max-width: 767px) {
  .regulamento-tabs {
    border-radius: 2.4rem;
  }

  .regulamento-tab {
    min-height: 4.8rem;
    padding: 0.6rem 1rem;
    border-radius: 2rem;
    font-size: 1.3rem;
    line-height: 1.2;
    white-space: normal;
    text-align: center;
  }

  .regulamento-shell {
    padding-inline: var(--space-2);
  }

  .regulamento-toolbar {
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 0.4rem;
    padding: 0.8rem 0.6rem;
  }

  .regulamento-toolbar__group {
    flex: 0 0 auto;
    gap: 0.2rem;
  }

  .regulamento-toolbar__group--download {
    margin-left: 0;
  }

  .regulamento-toolbar__btn {
    min-width: clamp(30px, 9vw, 38px);
    height: clamp(30px, 9vw, 38px);
    padding: 0;
    font-size: 1.1rem;
  }

  .regulamento-toolbar__page {
    min-width: 3.2rem;
    font-size: 1.2rem;
    white-space: nowrap;
  }

  .regulamento-canvas-wrap {
    min-height: 58vh;
    max-height: 68vh;
    padding: 0.5rem 0;
  }

  .regulamento-page-stage {
    max-width: calc(100% - 0.75rem);
  }
}

/* Abaixo de 360px os 7 controles não cabem em uma linha: páginas + download em cima, zoom embaixo. */
@media (max-width: 359px) {
  .regulamento-toolbar {
    flex-wrap: wrap;
    row-gap: 0.6rem;
  }

  .regulamento-toolbar__group--zoom {
    order: 3;
    flex-basis: 100%;
    justify-content: center;
  }
}
