/* layout.css — shell do app, header, navegação, telas */

:root { --app-max: 480px; }

.screen { min-height: 100dvh; }

/* ── App shell: coluna centralizada (formato app em qualquer tela) ── */
#app {
  position: relative;
  max-width: var(--app-max);
  min-height: 100dvh;
  margin-inline: auto;
}
/* em telas largas, "moldura" de app: fundo neutro atrás + sombra lateral */
@media (min-width: 540px) {
  body:has(#app:not([hidden])) { background: #0b0e14; }
  #app {
    box-shadow: 0 0 0 1px var(--border), 0 24px 60px rgba(0, 0, 0, .35);
  }
}

/* ── Header ── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(var(--safe-top) + 12px) 16px 12px;
  background: var(--grad);
  color: var(--on-grad);
  box-shadow: var(--shadow-sm);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -.02em;
  min-width: 0;
}
.brand-icon { font-size: 24px; }

/* Logo bicolor: 'Dy' destacado (verde-lima) */
.brand-dy { color: var(--brand-dy); }
.onboarding-title .brand-dy {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  max-width: 140px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .35);
  border: 1px solid color-mix(in srgb, var(--on-grad) 30%, transparent);
  font-weight: 600;
  font-size: 14px;
}
.user-chip .user-avatar { font-size: 18px; }
.user-chip .user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-switcher {
  max-width: 132px;
  min-height: 44px;
  padding: 8px 28px 8px 12px;
  border: 1px solid color-mix(in srgb, var(--on-grad) 30%, transparent);
  border-radius: 999px;
  background-color: rgba(255, 255, 255, .35);
  color: var(--on-grad);
  font-weight: 600;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%230c2818' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

/* ── Main ── */
main {
  padding: 16px 16px calc(var(--nav-h) + var(--safe-bottom) + 88px);
}
main:focus { outline: none; }

.view-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-bottom: 16px;
}
.view-head h2 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.02em;
}
.view-sub {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}
.view-sub::first-letter { text-transform: uppercase; }

.week-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.section-label {
  margin: 20px 0 8px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

/* ── Bottom nav (acompanha a largura do app-shell) ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(var(--app-max), 100%);
  z-index: 20;
  display: flex;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: color .15s ease;
}
.nav-item .nav-icon { font-size: 20px; }
.nav-item:hover { color: var(--text); }
.nav-item[aria-current="page"] { color: var(--pos); }

/* ── FAB (alinhado à borda direita do app-shell) ── */
.fab {
  position: fixed;
  right: calc(50% - min(var(--app-max), 100%) / 2 + 16px);
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
  z-index: 20;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--grad);
  color: var(--on-grad);
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}
.fab:hover { transform: scale(1.06); }
.fab:active { transform: scale(.94); }

/* ── Onboarding ── */
.onboarding {
  display: flex;
  flex-direction: column;
  max-width: 420px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 40px) 24px calc(var(--safe-bottom) + 32px);
}

.onboarding-hero { text-align: center; margin-bottom: 32px; }
.onboarding-logo { font-size: 64px; }
.onboarding-title {
  margin-top: 8px;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--text);
}
.onboarding-tagline { margin-top: 4px; color: var(--muted); }

.onboarding-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.onboarding-intro {
  font-size: 14.5px;
  color: var(--muted);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

/* ── Auth (login/register) ── */
.auth-alt {
  text-align: center;
  font-size: 14.5px;
  color: var(--muted);
}
.auth-alt a {
  color: var(--pos);
  font-weight: 700;
  text-decoration: none;
  display: inline-block;
  padding: 8px 4px; /* alvo de toque confortável */
  margin: -8px -4px;
}
.auth-alt a:hover { text-decoration: underline; }

.form-error-box {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  border: 1.5px solid var(--danger);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
}

.field-hint { font-size: 12.5px; color: var(--muted); }

/* ── Badge United App's ── */
.dyf-badge {
  margin-top: 28px;
  text-align: center;
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--muted);
}
.dyf-badge a {
  text-decoration: none;
  border-radius: 6px;
  padding: 4px 6px;
  margin: -4px -6px;
}
.dyf-badge a:hover strong { text-decoration: underline; }
.dyf-badge strong {
  font-weight: 700;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
