/* css/responsive.css
   Layout responsivo: desktop (≥768px) e tablet (≥768px e <1024px)
   VoaAM · Vestibulares do Amazonas */

/* ── Auth: card centralizado no desktop ── */
@media (min-width: 768px) {
  #auth-wrapper:not([hidden]) {
    display: flex;
    align-items: safe center;
    justify-content: center;
    padding: 40px 20px;
  }
  .auth-screen {
    min-height: unset !important;
    width: 100%;
    flex: 0 0 auto;
    max-width: 480px;
    background: var(--vidro-janela);
    -webkit-backdrop-filter: blur(var(--vidro-desfoque));
    backdrop-filter: blur(var(--vidro-desfoque));
    border: 1px solid var(--border);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0,0,0,0.25);
  }
  .auth-screen.auth-active { display: flex; }
  .auth-header { padding: 40px 36px 0 !important; }
  .auth-logo-row { margin-bottom: 28px !important; }
  .auth-title { font-size: 32px !important; }
  .auth-sub { margin-bottom: 24px !important; }
  .auth-form { padding: 0 36px !important; gap: 12px !important; }
  .auth-bottom-link { padding: 20px 36px 32px !important; }
}

/* O aplicativo tem uma área de rolagem, entre cabeçalho e navegação. */
#app-wrapper {
  position: relative;
  display: grid;
  grid-template: auto minmax(0, 1fr) auto / minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  max-width: 1280px;
  margin-inline: auto;
}

#slot-header { grid-area: 1 / 1 / 2 / -1; }
#slot-navbar { grid-area: 3 / 1; min-height: 0; }
[id^="slot-page-"] {
  grid-area: 2 / 1;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}
[id^="slot-page-"]:not(:has(.screen.active)) { display: none; }
.screen { overflow-wrap: anywhere; }
.screen img, .question-card img { max-width: 100%; }
.nav-btn { min-width: 0; overflow-wrap: normal; }
.header > .logo { flex: 0 0 auto; }
.header-right { flex: 1; justify-content: flex-start; flex-wrap: nowrap; }
.header-right > .theme-toggle { margin-inline-start: auto; }
.header-xp { white-space: nowrap; }
.vidas-pill { min-height: 30px; white-space: nowrap; }
.back-btn { flex-shrink: 0; }

@media (max-width: 550px) {
  .header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    padding: 8px 12px;
  }
  .header-right { display: contents; }
  .header-right > .theme-toggle { grid-area: 1 / 2; height: 32px; }
  .header-right > .theme-toggle::before { top: 3px; }
  .header-stats { grid-column: 1 / -1; }
  .header-xp { padding-inline: 7px; }
  .header-level, .header-logout { padding: 6px 8px; }
  .nav-btn { font-size: clamp(8px, 2.6vw, 10px); padding-inline: 2px; }
}

@media (min-width: 768px) {
  #app-wrapper {
    grid-template: auto minmax(0, 1fr) / 76px minmax(0, 1fr);
    border-inline: 1px solid var(--border);
  }
  .header { padding: 10px 28px; min-height: 60px; }
  #slot-navbar { grid-area: 2 / 1; }
  [id^="slot-page-"] { grid-area: 2 / 2; }
  .bottom-nav {
    height: 100%;
    flex-direction: column;
    justify-content: flex-start;
    gap: 4px;
    padding: 12px 8px;
    border-top: 0;
    border-right: 1px solid var(--border);
    overflow: auto;
  }
  .nav-btn {
    flex: 0 0 auto;
    border-radius: 12px;
  }
  .home-hero { padding: 32px 32px 20px; }
  .home-title { font-size: 32px; }
  .vestibulares-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .action-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .action-cards .action-card:last-child { grid-column: 1 / -1; }
  .screen > .page-content:not(.home-content) { padding-inline: 32px; }
  .aula-content { max-width: 720px; margin-inline: auto; width: 100%; }
}

@media (min-width: 1024px) {
  #app-wrapper { grid-template-columns: 214px minmax(0, 1fr); }
  .bottom-nav { padding: 14px 12px; }
  .nav-btn {
    flex-direction: row;
    gap: 12px;
    font-size: 14px;
    padding: 12px;
  }
}

@media (max-width: 360px) {
  .header-stats { gap: 4px; }
  .perfil-stats-grid, .perfil-vests { grid-template-columns: minmax(0, 1fr); }
}

@media (pointer: coarse) {
  input:is([type="text"], [type="number"], [type="password"], [type="email"]),
  select, textarea { font-size: 16px !important; }
}

@media (max-height: 450px) and (max-width: 767px) {
  .header { padding-block: 5px; }
  .nav-btn { padding-block: 5px; }
}

.sc-dialog {
  max-height: calc(100dvh - 32px);
  overflow: auto;
}
.aula-content, .result-card { min-width: 0; overflow-wrap: anywhere; }

/* Em telas deitadas e baixas, a navegação ocupa o rodapé. */
@media (orientation: landscape) and (max-height: 600px) {
  #app-wrapper { grid-template: auto minmax(0, 1fr) auto / minmax(0, 1fr); }
  #slot-navbar { grid-area: 3 / 1; }
  [id^="slot-page-"] { grid-area: 2 / 1; }
  .header { min-height: 44px; padding-block: 5px; }
  .bottom-nav {
    height: auto;
    flex-direction: row;
    justify-content: space-around;
    gap: 0;
    padding: 0 4px env(safe-area-inset-bottom);
    border-top: 1px solid var(--border);
    border-right: 0;
  }
  .nav-btn { flex: 1; flex-direction: column; gap: 2px; padding: 4px 2px; font-size: 10px; border-radius: 0; }
}
