@layer base, pages;

@import url("./sobre.css") layer(pages);
@import url("./checkout.css") layer(pages);
@import url("./home.css") layer(pages);
@import url("./test.css") layer(pages);
@import url("./contato.css") layer(pages);
@import url("./buscar.css") layer(pages);
@import url("./mobile.css") layer(pages);

@layer base {
  /* Reset */
  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Inter", sans-serif;
  }

  body {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: #fff;
    line-height: 1.6;
  }

  /* Header */
  .header {
    position: relative;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.3);
    padding: 15px 0;
  }

  .header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .header .logo {
    font-weight: 700;
    font-size: 24px;
    color: #fff;
  }

  .header nav a {
    color: #fff;
    margin-left: 20px;
    text-decoration: none;
    font-weight: 600;
  }

  /* Hero */
  .hero {
    text-align: center;
    padding: 60px 20px;
  }

  .hero h2 {
    font-size: 36px;
    line-height: 1.25;
    margin-bottom: 15px;
  }

  .hero p {
    font-size: 18px;
    max-width: 600px;
    margin: auto;
    line-height: 1.6;
  }

  /* Quiz */
  .container {
    width: 90%;
    max-width: 900px;
    margin: auto;
  }

  .quiz-box {
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 12px;
    margin: 40px auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  }

  #questionCounter {
    text-align: right;
    font-size: 14px;
    margin-bottom: 15px;
    font-weight: 600;
    color: #ffe082;
  }

  .question {
    margin-bottom: 20px;
  }

  .question h3 {
    margin-bottom: 15px;
    font-size: 20px;
    line-height: 1.4;
  }

  .question img {
    max-width: 80px;
    margin-bottom: 15px;
    display: block;
  }

  /* Barra de progresso */
  .progress {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    overflow: hidden;
    height: 10px;
    margin-bottom: 20px;
  }

  #progressBar {
    height: 10px;
    background: linear-gradient(90deg, #ff4b2b, #ff416c);
    width: 0%;
    transition: width 0.4s ease;
  }

  /* Animações */
  .fade {
    animation: fadeIn 0.6s ease;
  }

  @keyframes fadeIn {
    from {
      opacity: 0;
      transform: translateY(10px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .question label {
    display: block;
    padding: 12px;
    margin: 8px 0;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    transition: 0.3s;
    cursor: pointer;
  }

  .question label:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(5px);
  }

  /* Botão */
  .btn-primary {
    background: linear-gradient(90deg, #ff416c, #ff4b2b);
    color: #fff;
    padding: 15px 25px;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.3s;
    margin-top: 10px;
  }

  .btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  }

  /* Footer */
  .footer {
    text-align: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    margin-top: 40px;
  }

  /* Tracker */
  #progressTracker {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
  }

  .tracker-dot {
    width: 12px;
    height: 12px;
    margin: 0 5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: 0.3s;
  }

  .tracker-dot.active {
    background: #ffe082;
  }

  .tracker-dot.done {
    background: #00e676;
  }

  /* Feedback visual opção */
  .question label {
    display: block;
    padding: 14px;
    margin: 8px 0;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    transition: 0.3s;
    cursor: pointer;
    border: 2px solid transparent;
  }

  /* Slide animation */
  .slide {
    animation: slideIn 0.6s ease;
  }

  @keyframes slideIn {
    from {
      opacity: 0;
      transform: translateX(30px);
    }

    to {
      opacity: 1;
      transform: translateX(0);
    }
  }

  /* Mobile */
  @media (max-width: 600px) {
    .hero h2 {
      font-size: 28px;
    }

    .quiz-box {
      padding: 20px;
    }

    .btn-primary {
      width: 100%;
      font-size: 16px;
    }
  }

  /* Botão secundário */
  .btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 12px 20px;
    border: 2px solid #fff;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.3s;
  }

  .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.4);
  }

  /* Tela final com impacto */
  .final-screen {
    text-align: center;
    padding: 20px;
  }

  .final-screen .celebration {
    font-size: 48px;
    margin-bottom: 15px;
    animation: bounce 1s ease infinite;
  }

  @keyframes bounce {
    0%,
    100% {
      transform: translateY(0);
    }

    50% {
      transform: translateY(-8px);
    }
  }

  /* Botão com destaque no final */
  .btn-final {
    animation: glow 1.5s infinite;
  }

  @keyframes glow {
    0%,
    100% {
      box-shadow: 0 0 8px rgba(255, 224, 130, 0.6);
    }

    50% {
      box-shadow: 0 0 16px rgba(255, 224, 130, 0.9);
    }
  }

  /* Loading screen */
  .loading-screen {
    text-align: center;
    padding: 40px 20px;
  }

  .loading-screen p {
    margin-top: 15px;
    font-size: 18px;
    font-weight: 500;
    color: #ffe082;
  }

  /* Spinner animado */
  .spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ffe082;
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 1s linear infinite;
  }

  @keyframes spin {
    to {
      transform: rotate(360deg);
    }
  }

  /* Intro box */
  .intro-box {
    max-width: 700px;
    margin: auto;
  }

  .intro-text p {
    margin: 15px 0;
    font-size: 18px;
    line-height: 1.6;
  }

  .highlight {
    font-weight: 700;
    color: #ffe082;
  }

  /* Badges para níveis */
  .badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    margin: 0 4px;
    color: #fff;
  }

  .badge.leve {
    background: #00e676;
  }

  /* verde */
  .badge.moderada {
    background: #ffca28;
  }

  /* amarelo */
  .badge.alta {
    background: #ff9100;
  }

  /* laranja */
  .badge.grave {
    background: #e53935;
  }

  /* vermelho */

  /* Botão maior */
  .btn-big {
    padding: 18px 32px;
    font-size: 20px;
  }

  /* Botão outline */
  .btn-outline {
    background: transparent;
    color: #fff;
    padding: 15px 25px;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.3s;
    display: inline-block;
    text-align: center;
    text-decoration: none;
  }

  .btn-outline:hover {
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    transform: translateY(-1px);
  }

  /* ===== Campo de nome (tela inicial) ===== */
  .input-nome-wrapper {
    max-width: 420px;
    margin: 22px auto 12px;
  }

  .input-nome-wrapper input {
    width: 100%;
    padding: 16px 18px;
    border-radius: 14px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    font-size: 16px;
    font-family: "Inter", sans-serif;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    outline: none;
    transition: all 0.25s ease;
  }

  .input-nome-wrapper input::placeholder {
    color: rgba(255, 255, 255, 0.65);
  }

  .input-nome-wrapper input:focus {
    border-color: #22c55e;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.25);
  }
  /* ===== Botão iniciar (bloqueado) ===== */
  #btnStart:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    filter: grayscale(20%);
  }

  /* ===== Botão iniciar (ativo) ===== */
  #btnStart:not(:disabled) {
    opacity: 1;
    cursor: pointer;
    animation: pulseStart 1.8s ease-in-out infinite;
  }

  @keyframes pulseStart {
    0%,
    100% {
      transform: scale(1);
    }
    50% {
      transform: scale(1.03);
    }
  }
  @media (max-width: 600px) {
    .hero h2 {
      font-size: 22px;
    }

    .intro-text p {
      font-size: 15px;
      line-height: 1.6;
    }

    .input-nome-wrapper input {
      font-size: 16px;
      padding: 16px;
    }

    .btn-big {
      width: 100%;
      font-size: 17px;
      padding: 16px;
    }
  }
  .hint-nome {
    font-size: 13px;
    margin-top: 6px;
    color: rgba(255, 255, 255, 0.75);
  }

  /* ===== NAV TOGGLER (SÓ MOBILE) ===== */

  /* Desktop: botão some, nav normal */
  .nav-toggle {
    display: none;
    position: relative;
    z-index: 1002;
    background: transparent;
    border: 0;
    padding: 10px;
    cursor: pointer;
  }

  /* Ícone hamburger */
  .nav-toggle span {
    display: block;
    width: 26px;
    height: 2px;
    margin: 5px 0;
    background: #fff;
    border-radius: 2px;
    transition:
      transform 0.2s ease,
      opacity 0.2s ease;
  }

  /* Mobile */
  @media (max-width: 600px) {
    .header {
      padding: 10px 0;
      position: relative;
      z-index: 1000;
    }

    .header .container {
      position: relative;
      z-index: 1001;
    }

    /* Mostra o botão no mobile */
    .nav-toggle {
      display: inline-flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      position: relative;
      z-index: 1003;
    }

    /* Esconde o menu por padrão */
    .header .nav {
      display: none;
      position: absolute;
      z-index: 1002;
      top: calc(100% + 10px);
      right: 0;
      left: 0;
      margin: 0 10px;
      padding: 10px;
      border-radius: 14px;
      background: rgba(0, 0, 0, 0.35);
      border: 1px solid rgba(255, 255, 255, 0.12);
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
    }

    /* Quando abrir */
    .header .nav.is-open {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .header .nav a {
      margin-left: 0;
      padding: 12px 12px;
      border-radius: 10px;
      background: rgba(255, 255, 255, 0.12);
      border: 1px solid rgba(255, 255, 255, 0.18);
      font-size: 14px;
      line-height: 1.1;
      white-space: nowrap;
    }

    /* animação hamburger -> X quando aberto */
    .nav-toggle.is-open span:nth-child(1) {
      transform: translateY(7px) rotate(45deg);
    }

    .nav-toggle.is-open span:nth-child(2) {
      opacity: 0;
    }

    .nav-toggle.is-open span:nth-child(3) {
      transform: translateY(-7px) rotate(-45deg);
    }
  }

  /* ===== SPINNER PEQUENO PARA BOTÕES REALIZAR PAGAMENTO===== */
  .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: inline-block;
    margin-right: 10px;
    vertical-align: -3px;
    animation: spin 0.8s linear infinite;
  }

  @keyframes spin {
    to {
      transform: rotate(360deg);
    }
  }

  @media (max-width: 900px) {
    .tests-grid {
      grid-template-columns: 1fr;
    }
  }

  @media (max-width: 600px) {
    .tests-modal__dialog {
      width: min(100vw - 16px, 100vw);
      margin: 18px auto;
      border-radius: 20px;
    }

    .tests-modal__header {
      padding: 20px 18px 16px;
    }

    .tests-modal__header h3 {
      font-size: 22px;
    }

    .tests-modal__body {
      flex: 1;
      min-height: 0;
      padding: 18px 18px 30px;
      overflow-y: auto;
      overflow-x: hidden;
      -webkit-overflow-scrolling: touch;
    }

    .test-card {
      min-height: 190px;
    }

    .question-card {
      padding: 18px;
    }

    .question-card h3 {
      font-size: 20px;
    }

    .option-item span {
      font-size: 15px;
    }
  }
  #relatorio {
    box-sizing: border-box;
    width: 100%;
    max-width: 800px;
    overflow-wrap: break-word;
    word-break: break-word;
  }

  #relatorio p,
  #relatorio h1,
  #relatorio h3,
  #relatorio div {
    word-break: break-word;
    overflow-wrap: break-word;
  }

  #relatorio p {
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
  }

  #relatorio .bloco {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  #relatorio .cabecalho,
  #relatorio .assinatura,
  #relatorio .aviso-final {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  @media print {
    body {
      background: #fff !important;
      color: #333 !important;
    }

    .relatorio {
      max-width: 100% !important;
      margin: 0 !important;
      padding: 24px 28px !important;
      border-radius: 0 !important;
      box-shadow: none !important;
    }

    .relatorio::before {
      display: none !important;
    }

    #btnPdf,
    .voltar-btn {
      display: none !important;
    }
  }

  /* responsivo */
  @media (max-width: 900px) {
    .home-strip__inner,
    .category-grid {
      grid-template-columns: 1fr;
    }
  }
}
