/* ============================================================================
   Planejador Social — responsive.css
   Mesmo padrão do CRM (produtos/crm-sirius/public/responsive.css): dono ÚNICO
   da responsividade, carrega DEPOIS de overrides.css → vence a cascata.
   Tema-aware (usa as vars, que já invertem no data-theme="light").

   Breakpoints: phone ≤640 · tablet 641–1024 · desktop 1025–1599 · tv ≥1600
   Navegação mobile: barra inferior tipo app (Compor/Calendário/Grade/Contas/Mais).
   ============================================================================ */

/* default: barra mobile escondida (media query de phone liga) */
#mtabbar { display: none; }
#mtab-more { display: none; }

/* base tátil */
* { -webkit-tap-highlight-color: transparent; }
@media (pointer: coarse) {
  .nav button, .nav-gear, .mtab, .btn-cyan, .btn-manage, button.primary { min-height: 40px; }
  input, select, textarea { font-size: 16px; } /* evita zoom do iOS ao focar */
}

/* ===== TV / MONITOR GRANDE ( ≥1600 ) ===== */
@media (min-width: 1600px) {
  body { font-size: 15px; }
  .wrap { max-width: 1900px; }
}

/* ===== TABLET ( 641–1024 ) ===== */
@media (min-width: 641px) and (max-width: 1024px) {
  .wrap { padding-left: 22px; padding-right: 22px; }
  .nav button { padding: 11px 16px; }        /* alvos confortáveis */
  .nav-gear { padding: 11px 14px; }
}

/* ===== PHONE ( ≤640 ) — experiência tipo app ===== */
@media (max-width: 640px) {

  /* topo enxuto: some a nav de cima (vira barra inferior), mantém a marca */
  .topbar .nav { display: none !important; }
  .topbar { padding: 12px 14px 10px !important; }
  .sub { display: none; }                     /* subtítulo longo tira espaço no celular */
  #mtabbar { display: flex; }

  /* conteúdo deixa espaço pra barra inferior (body é o scroller; a Grade fica fora do .wrap) */
  body { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .wrap { padding: 16px 14px 20px !important; }

  /* FAB "novo agendamento" é redundante (Compor virou aba) */
  .fab, .fab-tooltip { display: none !important; }

  /* composer: campos e ações em coluna, botões largos */
  .grid, .row2 { grid-template-columns: 1fr !important; }
  .composer-actions { flex-direction: column; }
  .composer-actions button { width: 100%; }

  /* calendário: cabe 7 colunas sem estourar (minmax(0,1fr) mata o blowout de grid) */
  .cal-wrap { grid-template-columns: minmax(0, 1fr) !important; }
  .cal-grid { grid-template-columns: repeat(7, minmax(0, 1fr)) !important; gap: 4px; }
  .cal-cell { min-width: 0; min-height: 72px; padding: 5px 4px; overflow: hidden; }
  .cal-wd { font-size: 10px; }
  .cal-day { font-size: 13px; }
  .cal-add { width: 26px; height: 26px; opacity: .9; }   /* alvo de toque do "+" por dia */
  .cal-nav b { min-width: 0; }

  /* contas: cards em 1 coluna larga */
  .contas-grid { grid-template-columns: 1fr !important; }

  /* modais viram bottom-sheet */
  .modal-overlay { align-items: flex-end !important; }
  .modal-box, .contas-modal {
    max-width: 100% !important; width: 100% !important;
    border-radius: 20px 20px 0 0 !important;
    max-height: 92dvh !important; margin: 0 !important;
    animation: sheet-up .22s ease;
  }
  @keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }

  /* toast acima da barra */
  .toast { bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important; }

  /* em modo de aprovação (cliente), sem barra de navegação */
  .share-mode #mtabbar { display: none !important; }
  .share-mode body { padding-bottom: 0; }
}
@media (max-width: 380px) {
  .mtab { font-size: 9px; }
  .mtab svg { width: 23px; height: 23px; }
}

/* ============================================================================
   Barra de navegação inferior + sheet "Mais"  (só renderiza no phone)
   ============================================================================ */
#mtabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
  height: calc(72px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 30px rgba(0,0,0,.4);
}
.mtab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; background: none; border: none; cursor: pointer;
  color: var(--mut); font-size: 11.5px; font-weight: 600; font-family: var(--font-display, inherit);
  padding: 8px 0 6px; position: relative; transition: color .15s;
}
.mtab svg { width: 26px; height: 26px; stroke: currentColor; fill: none; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }
.mtab.on { color: var(--cyan); }
.mtab.on::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 40px; height: 4px; border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, var(--cyan), var(--magenta));
  box-shadow: 0 0 12px color-mix(in srgb, var(--cyan) 60%, transparent);
}
.mtab.on svg { filter: drop-shadow(0 0 8px color-mix(in srgb, var(--cyan) 45%, transparent)); }

/* Sheet "Mais" — configurações + sair */
#mtab-more { position: fixed; inset: 0; z-index: 85; }
#mtab-more.open { display: block; }
.mtab-more-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.mtab-more-sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--card); border-top: 1px solid var(--line);
  border-radius: 20px 20px 0 0;
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  animation: sheet-up .22s ease;
}
.mtab-more-grab { width: 40px; height: 4px; border-radius: 3px; background: var(--line);
  margin: 6px auto 14px; }
.mtab-more-sheet button {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 15px 12px; border-radius: 13px; border: 1px solid var(--line);
  background: var(--surface); color: var(--white); font-family: var(--font-ui, inherit);
  font-size: 15px; font-weight: 600; cursor: pointer; margin-bottom: 10px;
}
.mtab-more-sheet button svg { width: 20px; height: 20px; stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mtab-more-sheet button.mtab-more-logout { color: var(--magenta); }
