/* =========================================================
   AQUAG · PORTAL DO ALUNO (tela do responsável)
   Pensado primeiro para o celular — é por onde a maioria dos
   responsáveis acessa. No desktop o conteúdo só fica centralizado
   numa coluna um pouco mais larga.
   ========================================================= */

#parent-portal-screen {
  --pp-bg: #020617;
  --pp-card: rgba(15, 23, 42, .78);
  --pp-card-border: rgba(148, 163, 184, .13);
  --pp-text: #f1f5f9;
  --pp-muted: #94a3b8;
  --pp-faint: #64748b;
  --pp-sky: #38bdf8;
  --pp-amber: #f59e0b;
  --pp-radius: 20px;
  --pp-ease: cubic-bezier(.22, 1, .36, 1);

  background: var(--pp-bg);
  color: var(--pp-text);
  font-family: 'DM Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.pp-shell {
  min-height: 100%;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(14, 165, 233, .16), transparent 60%),
    radial-gradient(60% 40% at 100% 30%, rgba(34, 211, 238, .06), transparent 70%);
}

/* --- Cabeçalho --- */

.pp-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(2, 6, 23, .82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(148, 163, 184, .1);
  padding-top: env(safe-area-inset-top);
}

.pp-header-row {
  max-width: 640px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pp-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

/* A <img> também tem a classe .mobile-logo (é por ela que app.js aplica a
   imagem), cuja regra em components.css força object-fit:contain !important
   — por isso o seletor mais específico e o !important aqui. Mesmo padrão
   redondo com borda âmbar do cabeçalho do painel. */
#parent-portal-screen .pp-brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover !important;
  object-position: center;
  flex-shrink: 0;
  border: 2px solid rgba(245, 158, 11, .75);
  background: #0f172a;
  box-shadow: 0 6px 18px -6px rgba(245, 158, 11, .45);
}

.pp-brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.pp-brand-name { font-weight: 800; font-size: 1rem; letter-spacing: -.01em; color: #fff; }
.pp-brand-sub { font-size: .72rem; color: var(--pp-muted); font-weight: 500; }

.pp-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px !important;
  padding: 0 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(148, 163, 184, .16);
  color: #e2e8f0;
  font-size: .82rem;
  font-weight: 600;
  transition: background-color .2s, border-color .2s;
}

.pp-logout:hover { background: rgba(255, 255, 255, .09); border-color: rgba(148, 163, 184, .28); }

/* --- Conteúdo --- */

.pp-main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 14px calc(28px + env(safe-area-inset-bottom));
}

/* Saudação */

.pp-greeting {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  padding: 22px 20px 38px;
  background: linear-gradient(145deg, #075985 0%, #0369a1 45%, #0e7490 100%);
  box-shadow: 0 22px 50px -24px rgba(14, 165, 233, .55);
  animation: pp-rise .6s var(--pp-ease) both;
}

.pp-greeting::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 85% 0%, rgba(255, 255, 255, .22), transparent 45%),
    radial-gradient(circle at 10% 110%, rgba(34, 211, 238, .35), transparent 50%);
  pointer-events: none;
}

.pp-greeting-waves {
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: -2px;
  height: 46px;
  opacity: .28;
  animation: pp-wave 9s ease-in-out infinite alternate;
  pointer-events: none;
}

.pp-greeting-waves svg { width: 100%; height: 100%; display: block; fill: #e0f2fe; }

.pp-greeting-label,
.pp-greeting-name,
.pp-greeting-sub { position: relative; margin: 0; }

.pp-greeting-label { font-size: .85rem; font-weight: 600; color: rgba(224, 242, 254, .85); }

.pp-greeting-name {
  margin-top: 2px;
  font-size: clamp(1.35rem, 6vw, 1.75rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.02em;
  color: #fff;
  overflow-wrap: anywhere;
}

.pp-greeting-sub {
  margin-top: 8px;
  font-size: .84rem;
  line-height: 1.45;
  color: rgba(224, 242, 254, .82);
  max-width: 34ch;
}

/* Alunos vinculados */

.pp-children-block { margin-top: 18px; }

.pp-section-label {
  margin: 0 0 8px 2px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--pp-faint);
}

.pp-children-switch {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 4px 14px;
  margin: -4px -4px -10px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.pp-children-switch::-webkit-scrollbar { display: none; }
.pp-children-switch.hidden { display: none; }

.pp-child-tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px !important;
  padding: 0 16px 0 6px;
  border-radius: 999px;
  background: rgba(30, 41, 59, .8);
  border: 1px solid rgba(148, 163, 184, .16);
  color: #cbd5e1;
  font-size: .85rem;
  font-weight: 700;
  white-space: nowrap;
  transition: background-color .2s, color .2s, border-color .2s, transform .2s var(--pp-ease), box-shadow .2s;
}

.pp-child-tab:active { transform: scale(.97); }

.pp-child-tab-initial {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  font-weight: 800;
  background: rgba(56, 189, 248, .14);
  color: #7dd3fc;
  transition: background-color .2s, color .2s;
}

.pp-child-tab.is-active {
  background: var(--pp-amber);
  border-color: transparent;
  color: #0f172a;
  box-shadow: 0 10px 24px -12px rgba(245, 158, 11, .7);
}

.pp-child-tab.is-active .pp-child-tab-initial { background: rgba(15, 23, 42, .16); color: #0f172a; }

/* Cartões */

.pp-content {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pp-content > * { animation: pp-rise .55s var(--pp-ease) both; }
.pp-content > *:nth-child(2) { animation-delay: .06s; }
.pp-content > *:nth-child(3) { animation-delay: .12s; }
.pp-content > *:nth-child(4) { animation-delay: .18s; }

.pp-card {
  background: var(--pp-card);
  border: 1px solid var(--pp-card-border);
  border-radius: var(--pp-radius);
  padding: 16px;
  box-shadow: 0 18px 40px -28px rgba(0, 0, 0, .8);
}

.pp-card-label {
  display: block;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--pp-faint);
}

.pp-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #cbd5e1;
}

.pp-section-title svg { color: var(--pp-sky); }

/* Aluno */

.pp-student {
  display: flex;
  align-items: center;
  gap: 14px;
}

.pp-avatar {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  background: linear-gradient(135deg, #7dd3fc, #38bdf8 55%, #22d3ee);
  box-shadow: 0 10px 24px -12px rgba(56, 189, 248, .8);
}

.pp-student-info { min-width: 0; display: flex; flex-direction: column; gap: 3px; }

.pp-student-name {
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -.01em;
  color: #fff;
  overflow-wrap: anywhere;
}

/* Situação */

/* Sem color-mix(): o Safari do iOS 15 (ex.: iPhone 6S) não suporta. */
.pp-status {
  --pp-status-color: #94a3b8;
  --pp-status-soft: rgba(148, 163, 184, .1);
  --pp-status-border: rgba(148, 163, 184, .28);
  --pp-status-glow: rgba(148, 163, 184, .5);
  position: relative;
  overflow: hidden;
  border-color: var(--pp-status-border);
  background:
    linear-gradient(135deg, var(--pp-status-soft), transparent 70%),
    var(--pp-card);
}

.pp-status--online { --pp-status-color: #34d399; --pp-status-soft: rgba(16, 185, 129, .12); --pp-status-border: rgba(52, 211, 153, .3); --pp-status-glow: rgba(52, 211, 153, .55); }
.pp-status--matriculado { --pp-status-color: #fbbf24; --pp-status-soft: rgba(245, 158, 11, .12); --pp-status-border: rgba(251, 191, 36, .3); --pp-status-glow: rgba(251, 191, 36, .55); }
.pp-status--pendente { --pp-status-color: #f87171; --pp-status-soft: rgba(239, 68, 68, .14); --pp-status-border: rgba(248, 113, 113, .34); --pp-status-glow: rgba(248, 113, 113, .6); }
.pp-status--offline { --pp-status-color: #94a3b8; --pp-status-soft: rgba(100, 116, 139, .14); --pp-status-border: rgba(148, 163, 184, .28); --pp-status-glow: rgba(148, 163, 184, .5); }

.pp-status-top { display: flex; align-items: center; gap: 14px; }

.pp-status-icon {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--pp-status-color);
  background: var(--pp-status-soft);
  border: 1px solid var(--pp-status-border);
}

.pp-status-text { min-width: 0; display: flex; flex-direction: column; gap: 6px; }

.pp-badge {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px 5px 10px;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 800;
  color: var(--pp-status-color);
  background: var(--pp-status-soft);
  border: 1px solid var(--pp-status-border);
}

.pp-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pp-status-color);
}

.pp-status--online .pp-badge-dot,
.pp-status--pendente .pp-badge-dot { animation: pp-pulse 1.8s ease-out infinite; }

.pp-status-desc {
  margin: 12px 0 0;
  font-size: .86rem;
  line-height: 1.5;
  color: #cbd5e1;
}

.pp-status-desc:empty { display: none; }

.pp-regularize {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #0f172a;
  font-size: .92rem;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 14px 30px -14px rgba(245, 158, 11, .8);
  transition: transform .2s var(--pp-ease), box-shadow .2s;
}

.pp-regularize:hover { transform: translateY(-1px); box-shadow: 0 18px 36px -14px rgba(245, 158, 11, .9); }
.pp-regularize:active { transform: scale(.98); }
.pp-regularize.hidden { display: none; }

/* Pagamentos */

.pp-pay-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pp-pay-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 13px 12px;
  border-radius: 16px;
  background: rgba(2, 6, 23, .5);
  border: 1px solid rgba(148, 163, 184, .1);
  min-width: 0;
}

.pp-pay-icon {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  color: #cbd5e1;
  background: rgba(148, 163, 184, .1);
}

.pp-pay-grid--single { grid-template-columns: 1fr; }

.pp-pay-tile--next .pp-pay-icon { color: var(--pp-sky); background: rgba(56, 189, 248, .12); }

.pp-pay-label { font-size: .72rem; font-weight: 600; color: var(--pp-muted); }

.pp-pay-value {
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -.01em;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.pp-pay-tile--next .pp-pay-value { color: #bae6fd; }

/* Turmas */

.pp-classes { display: flex; flex-direction: column; gap: 8px; }

.pp-class {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(2, 6, 23, .5);
  border: 1px solid rgba(148, 163, 184, .1);
}

.pp-class-icon {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--pp-sky);
  background: rgba(56, 189, 248, .12);
}

.pp-class-info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.pp-class-label { font-size: .68rem; font-weight: 600; color: var(--pp-faint); text-transform: uppercase; letter-spacing: .1em; }
.pp-class-name { font-size: .95rem; font-weight: 700; color: #fff; line-height: 1.25; overflow-wrap: anywhere; }

.pp-class-time {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: .88rem;
  font-weight: 800;
  color: #fde68a;
  background: rgba(245, 158, 11, .12);
  border: 1px solid rgba(245, 158, 11, .22);
  font-variant-numeric: tabular-nums;
}

.pp-empty {
  padding: 14px;
  border-radius: 14px;
  border: 1px dashed rgba(148, 163, 184, .22);
  font-size: .86rem;
  color: var(--pp-muted);
  text-align: center;
}

/* Rodapé */

.pp-footer {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.pp-help {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 700;
  color: #e2e8f0;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(148, 163, 184, .16);
  text-decoration: none;
  transition: background-color .2s;
}

.pp-help:hover { background: rgba(255, 255, 255, .09); }
.pp-help svg { color: #34d399; }

.pp-secure {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .72rem;
  color: var(--pp-faint);
}

/* Animações */

@keyframes pp-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

@keyframes pp-wave {
  from { transform: translateX(-4%); }
  to { transform: translateX(4%); }
}

@keyframes pp-pulse {
  0% { box-shadow: 0 0 0 0 var(--pp-status-glow); }
  100% { box-shadow: 0 0 0 8px transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .pp-greeting, .pp-content > *, .pp-greeting-waves, .pp-badge-dot { animation: none !important; }
}

/* Telas maiores: mais respiro */

@media (min-width: 640px) {
  .pp-main { padding-top: 26px; }
  .pp-greeting { padding: 28px 28px 46px; }
  .pp-card { padding: 20px; }
  .pp-pay-value { font-size: 1.2rem; }
}

@media (max-width: 360px) {
  .pp-pay-grid { grid-template-columns: 1fr; }
  .pp-brand-sub { display: none; }
}
