/*
 * Mode Senior — overrides para utilizadores >65 anos.
 *
 * Activado via:
 *   1. Toggle UI (canto superior direito) em páginas B2C
 *   2. Cookie `fcg_senior=1` (1 ano) → server-side renderiza body class
 *   3. JS client-side aplica/remove a classe sem reload (transição suave)
 *
 * Princípios de design:
 *   - Fonte +30% (16px → 21px) sem partir layout
 *   - Contraste WCAG AAA (≥7:1) em texto principal
 *   - Botões/inputs ≥48×48px (touch target Apple HIG)
 *   - Line-height generoso (1.7) para reduzir cansaço visual
 *   - Foco hyper-visível (4px ring)
 *   - Animações reduzidas (sem distrair)
 *
 * Scope: tudo dentro de `body.fcg-senior` — não afecta admin staff.
 */

body.fcg-senior {
  font-size: 21px !important;
  line-height: 1.7 !important;
}

/* Texto base — contraste reforçado */
body.fcg-senior,
body.fcg-senior p,
body.fcg-senior li,
body.fcg-senior label,
body.fcg-senior td,
body.fcg-senior th,
body.fcg-senior .text-muted,
body.fcg-senior small {
  color: #0f172a !important;
}

/* Headings escalonados */
body.fcg-senior h1 { font-size: 2.4rem !important; line-height: 1.3 !important; }
body.fcg-senior h2 { font-size: 2rem !important; line-height: 1.35 !important; }
body.fcg-senior h3 { font-size: 1.6rem !important; line-height: 1.4 !important; }
body.fcg-senior h4 { font-size: 1.35rem !important; }

/* Botões — touch-friendly + alto contraste */
body.fcg-senior .btn,
body.fcg-senior button,
body.fcg-senior input[type="submit"],
body.fcg-senior input[type="button"] {
  min-height: 56px !important;
  padding: 14px 28px !important;
  font-size: 1.05rem !important;
  font-weight: 600 !important;
  border-radius: 12px !important;
}

body.fcg-senior .btn-sm {
  min-height: 44px !important;
  padding: 10px 20px !important;
  font-size: 0.95rem !important;
}

/* Inputs — touch-friendly + alto contraste */
body.fcg-senior input[type="text"],
body.fcg-senior input[type="email"],
body.fcg-senior input[type="tel"],
body.fcg-senior input[type="password"],
body.fcg-senior input[type="number"],
body.fcg-senior input[type="search"],
body.fcg-senior input[type="date"],
body.fcg-senior select,
body.fcg-senior textarea,
body.fcg-senior .form-control,
body.fcg-senior .form-select {
  min-height: 56px !important;
  padding: 14px 16px !important;
  font-size: 1.05rem !important;
  border-width: 2px !important;
  border-color: #475569 !important;
  border-radius: 10px !important;
}

body.fcg-senior textarea {
  min-height: 140px !important;
}

body.fcg-senior input:focus,
body.fcg-senior select:focus,
body.fcg-senior textarea:focus,
body.fcg-senior .form-control:focus,
body.fcg-senior .form-select:focus,
body.fcg-senior .btn:focus,
body.fcg-senior button:focus,
body.fcg-senior a:focus {
  outline: 4px solid #2563eb !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.25) !important;
}

/* Links — sublinhados + cor reforçada (não confundir com texto) */
body.fcg-senior a:not(.btn) {
  color: #1d4ed8 !important;
  text-decoration: underline !important;
  text-underline-offset: 3px !important;
  text-decoration-thickness: 2px !important;
  font-weight: 600 !important;
}

body.fcg-senior a:not(.btn):hover {
  color: #1e3a8a !important;
  background: #eff6ff;
}

/* Cards / containers — espaçamento mais generoso */
body.fcg-senior .card,
body.fcg-senior .alert,
body.fcg-senior .modal-content {
  padding: 24px !important;
  border-radius: 14px !important;
}

body.fcg-senior .card-body { padding: 24px !important; }
body.fcg-senior .card-header { padding: 18px 24px !important; font-size: 1.15rem !important; }

/* Alertas — contraste reforçado para feedback crítico */
body.fcg-senior .alert {
  border-width: 2px !important;
  font-weight: 500 !important;
}
body.fcg-senior .alert-success { background: #f0fdf4 !important; color: #14532d !important; border-color: #16a34a !important; }
body.fcg-senior .alert-danger  { background: #fef2f2 !important; color: #7f1d1d !important; border-color: #dc2626 !important; }
body.fcg-senior .alert-warning { background: #fffbeb !important; color: #78350f !important; border-color: #f59e0b !important; }
body.fcg-senior .alert-info    { background: #eff6ff !important; color: #1e3a8a !important; border-color: #3b82f6 !important; }

/* Modal close + small icons — maior */
body.fcg-senior .btn-close { transform: scale(1.5); margin-right: 8px; }

/* Reduzir animações (calma visual, evita motion sickness em fragéis) */
body.fcg-senior *,
body.fcg-senior *::before,
body.fcg-senior *::after {
  animation-duration: 0.2s !important;
  transition-duration: 0.15s !important;
}

/* Toggle button (canto superior direito) — sempre visível em B2C */
.fcg-senior-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1080;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #fff;
  border: 2px solid #cbd5e1;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.15s;
  font-family: inherit;
}

.fcg-senior-toggle:hover {
  border-color: #2563eb;
  color: #1d4ed8;
  background: #eff6ff;
}

.fcg-senior-toggle.active {
  background: #1d4ed8;
  color: #fff;
  border-color: #1d4ed8;
}

.fcg-senior-toggle .fcg-senior-icon {
  font-size: 18px;
  line-height: 1;
}

body.fcg-senior .fcg-senior-toggle {
  font-size: 16px !important;
  min-height: 48px !important;
  padding: 12px 20px !important;
}

@media (max-width: 480px) {
  .fcg-senior-toggle { top: 8px; right: 8px; padding: 8px 12px; font-size: 12px; }
  .fcg-senior-toggle .fcg-senior-label { display: none; }
}

/* Pages avec le menu client : l'en-tête occupe le coin supérieur droit (Mon compte, Déconnexion).
   Le bouton descend en bas à gauche, en miroir du bouton d'aide, au-dessus du dock sur mobile. */
body.has-cmenu .fcg-senior-toggle { top: auto; right: auto; left: 16px; bottom: 16px; }
@media (max-width: 991px) {
  body.has-cmenu .fcg-senior-toggle { left: 12px; bottom: calc(4.6rem + env(safe-area-inset-bottom, 0px)); }
}
/* Dans l'en-tête client (senior-mode.js l'y place quand le menu existe) : plus rien ne flotte sur le contenu. */
.fcg-senior-toggle.fcg-senior-toggle--inline,
body.has-cmenu .fcg-senior-toggle.fcg-senior-toggle--inline {
  position: static; box-shadow: none; padding: 5px 10px; border-width: 1px; font-size: 13px; gap: 6px; margin-right: .25rem;
}
.fcg-senior-toggle--inline .fcg-senior-icon { font-size: 14px; }
@media (max-width: 767px) { .fcg-senior-toggle--inline .fcg-senior-label { display: none; } }
body.fcg-senior .fcg-senior-toggle.fcg-senior-toggle--inline { min-height: 40px !important; padding: 6px 12px !important; }

@media print {
  .fcg-senior-toggle { display: none !important; }
}
