/* ---------- Google Fonts ---------- */

/* ---------- Fonte Charis SIL para dados lexicográficos ---------- */
@font-face {
  font-family: 'CharisSIL';
  src: url('../fonts/Charis-Regular.woff2') format('woff2'),
       url('../fonts/Charis-Regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'CharisSIL';
  src: url('../fonts/Charis-Italic.woff2') format('woff2'),
       url('../fonts/Charis-Italic.woff') format('woff');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'CharisSIL';
  src: url('../fonts/Charis-Bold.woff2') format('woff2'),
       url('../fonts/Charis-Bold.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'CharisSIL';
  src: url('../fonts/Charis-BoldItalic.woff2') format('woff2'),
       url('../fonts/Charis-BoldItalic.woff') format('woff');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Paleta — verde-azulado sofisticado (teal) */
--color-primary: #070e24;         /* azul escuro */
--color-primary-medium: #153478;  /* azul principal */
--color-primary-light: #3b82f6;   /* azul claro */
--color-primary-pale: #e0edff;    /* fundo leve */
--color-primary-ghost: #f5f9ff;   /* hover leve */

  /* Accent — coral suave */
  --color-accent: #d4785c;
  --color-accent-light: #e09a82;
  --color-accent-pale: #fdf0eb;

  /* Sidebar */
  --sidebar-width: 260px;
--sidebar-bg: #070e24; /* azul quase preto */
  --sidebar-text: rgba(255,255,255,0.7);
  --sidebar-text-active: #ffffff;
  --sidebar-hover: rgba(255,255,255,0.06);

  /* Neutros */
  --color-bg: #f5f6f8;
  --color-surface: #ffffff;
  --color-surface-alt: #f9fafb;
  --color-border: #e3e7ec;
  --color-border-light: #eef1f5;
  --color-divider: #ebeef2;

  /* Texto */
  --color-text: #1f2937;
  --color-text-secondary: #4b5563;
  --color-text-muted: #9ca3af;
  --color-text-inverse: #ffffff;

  /* Sombras */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.03);
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.07);

  /* Tipografia */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Libre Baskerville', Georgia, serif;

  /* Layout */
  --content-max: 780px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --bottom-nav-height: 0px;

  /* Transições */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  overflow-x: hidden;
  overscroll-behavior-x: none;
  touch-action: pan-y;
  font-family: var(--font-body);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-primary-medium);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

/* ============================================================
   LAYOUT PRINCIPAL — Sidebar + Content
   ============================================================ */
.container {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ============================================================
   SIDEBAR — Fixa à esquerda
   ============================================================ */
.navbar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
  padding: 0;
  border-right: 1px solid rgba(255,255,255,0.06);
}

.nav-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

/* Branding dentro da sidebar */
.sidebar-brand {
  padding: 32px 24px 28px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand h1 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--sidebar-text-active);
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 4px;
}

.sidebar-brand h1 sup {
  font-family: var(--font-body);
  font-size: 0.55em;
  color: var(--color-accent-light);
  font-weight: 500;
  vertical-align: super;
  margin-left: 3px;
}

.sidebar-brand p {
  font-size: 0.68rem;
  color: var(--sidebar-text);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 400;
  margin: 0;
  text-align: left;
  line-height: 1.4;
}

/* Navegação na sidebar */
.navbar .menu {
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  gap: 2px;
  flex: 1;
}

.navbar .menu span {
  cursor: pointer;
  font-weight: 500;
  font-size: 0.88rem;
  color: var(--sidebar-text);
  padding: 11px 24px;
  position: relative;
  transition: color var(--transition-normal), background-color var(--transition-normal);
  display: block;
  letter-spacing: 0.01em;
  border-left: 3px solid transparent;
}

.navbar .menu span:hover {
  color: var(--sidebar-text-active);
  background-color: var(--sidebar-hover);
}

.navbar .menu span.active {
  color: var(--sidebar-text-active);
  font-weight: 600;
  background-color: rgba(46, 168, 142, 0.12);
  border-left-color: var(--color-accent-light);
}

/* Hamburger — oculto no desktop */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 22px;
  height: 16px;
  cursor: pointer;
  z-index: 200;
}

.hamburger span {
  display: block;
  height: 2px;
  width: 100%;
  background-color: var(--color-primary);
  border-radius: 1px;
  transition: transform var(--transition-normal), opacity var(--transition-normal);
}

/* Mobile menu — oculto no desktop */
.mobile-menu {
  display: none;
}

/* Estilos do mobile-menu são definidos apenas dentro das media queries */

/* ------------------------------------------------------------
   Menu móvel complementar
   No desktop, o hamburger e o menu suspenso permanecem ocultos.
   No mobile, eles são reativados na media query para funcionar
   em conjunto com a barra inferior.
*/
.hamburger,
.mobile-menu {
  display: none;
}



/* ============================================================
   BOTTOM NAV — Mobile only
   ============================================================ */
.bottom-nav {
  display: none;
}

/* ============================================================
   ÁREA DE CONTEÚDO — Direita
   ============================================================ */
.content-area {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: var(--bottom-nav-height);
  overflow-x: hidden;
}

/* ============================================================
   BANNER — Barra horizontal no topo da área de conteúdo
   ============================================================ */
.banner {
  width: 100%;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-medium) 100%);
  text-align: left;
  padding: 28px 40px;
  position: relative;
  overflow: hidden;
}

.banner::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
  pointer-events: none;
}

.banner::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg,
    var(--color-accent) 0%,
    var(--color-accent-light) 50%,
    transparent 100%
  );
  opacity: 0.6;
}

.banner h1 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--color-text-inverse);
  margin-bottom: 0;
  font-weight: 700;
  position: relative;
  z-index: 1;
}

.banner h1 sup {
  font-family: var(--font-body);
  font-size: 0.4em;
  color: var(--color-accent-light);
  margin-left: 4px;
  font-weight: 500;
  vertical-align: super;
}

.banner h2 {
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: rgba(255,255,255,0.6);
  font-weight: 300;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  position: relative;
  z-index: 1;
  margin-top: 4px;
}

.banner p.global-info {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.45);
  font-weight: 300;
  position: relative;
  z-index: 1;
  margin-top: 6px;
}

/* ============================================================
   CONTEÚDO PRINCIPAL
   ============================================================ */
main {
  background: var(--color-surface);
  padding: 40px 44px 44px;
  width: 100%;
  max-width: var(--content-max);
  margin: 28px 40px 28px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border-light);
  position: relative;
  animation: fadeIn 0.4s ease;
}

main > h1 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  color: var(--color-primary);
  margin-bottom: 22px;
  font-weight: 700;
  text-align: left;
  position: relative;
  padding-bottom: 14px;
}

main > h1::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 36px;
  height: 3px;
  background: var(--color-accent);
  border-radius: 2px;
}

/* ---------- Tipografia ---------- */
h1, h2, h3, h4 {
  color: var(--color-text);
  line-height: 1.35;
}

h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--color-primary);
}

p {
  margin-bottom: 16px;
  font-size: 0.94rem;
  text-align: justify;
  color: var(--color-text);
  line-height: 1.8;
}

/* ---------- Sections ---------- */
section {
  margin-bottom: 26px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--color-divider);
}

section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

/* ---------- Form Elements ---------- */
#dictionary-section {
  margin-top: 4px;
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--color-primary);
  margin-top: 14px;
  margin-bottom: 7px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

select,
input[type="text"] {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.93rem;
  font-family: var(--font-body);
  margin-bottom: 16px;
  box-sizing: border-box;
  height: 44px;
  background-color: var(--color-surface-alt);
  color: var(--color-text);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal), background-color var(--transition-normal);
  appearance: none;
  -webkit-appearance: none;
}

select {
  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 fill='%232563eb' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

select:focus,
input[type="text"]:focus {
  border-color: var(--color-primary-medium);
  outline: none;
  box-shadow: 0 0 0 3px rgba(27, 107, 90, 0.08);
  background-color: var(--color-surface);
}

/* ---------- Entries ---------- */
.entry {
  padding: 16px 0 16px 16px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--color-border-light);
  position: relative;
  border-left: 2px solid transparent;
  transition: border-left-color var(--transition-normal), background-color var(--transition-normal);
}

.entry:last-child {
  border-bottom: none;
}

.entry:hover {
  border-left-color: var(--color-primary-medium);
  background-color: var(--color-accent-pale);
}

.entry strong {
  font-family: var(--font-display);
  color: var(--color-primary);
  font-weight: 700;
}

.entry strong.entry-lemma {
  color: var(--color-primary-medium);
  font-size: 1.28rem;
  line-height: 1.15;
  letter-spacing: 0.01em;
  font-kerning: none;
}

.entry-sense-head strong {
  font-size: 1.05rem;
  line-height: 1.25;
}

.entry small {
  color: var(--color-text-muted);
  font-size: 0.82rem;
}

.entry-head {
  margin-bottom: 8px;
}

.entry-lemma-line {
  margin-bottom: 2px;
}

.entry-transcription {
  margin: 2px 0 0;
  color: #1b6b5a;
  font-size: 0.95rem;
}

.entry-paradigm {
  margin: 1px 0 0;
  color: var(--color-text-secondary);
  font-size: 0.88rem;
}

.entry-sense {
  margin-left: 16px;
  margin-top: 8px;
}

.entry-note {
  margin-top: 3px;
  margin-left: 12px;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--color-text-secondary);
}

.entry-note strong {
  font-family: var(--font-body);
  font-size: inherit;
  color: var(--color-text-secondary);
  font-weight: 600;
}

.entry p {
  text-align: left;
  margin-top: 4px;
  margin-bottom: 5px;
  font-size: 0.91rem;
}

.entry-example-list {
  list-style: none;
  padding-left: 0;
  margin: 2px 0 0;
}

.entry-example-item {
  position: relative;
  padding: 4px 0 4px 24px;
  margin-bottom: 2px;
  font-size: 0.96rem;
  line-height: 1.45;
  border-bottom: 1px solid transparent;
  transition: background-color var(--transition-normal), padding-left var(--transition-normal);
}

.entry-example-item:last-child {
  margin-bottom: 0;
}

.entry-example-item::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  background: var(--color-accent-pale);
  border: 1.5px solid var(--color-accent);
  border-radius: 50%;
  transition: background var(--transition-normal), border-color var(--transition-normal);
}

.entry-example-item:hover {
  background-color: var(--color-accent-pale);
  padding-left: 32px;
}

.entry-example-item:hover::before {
  background: var(--color-accent);
}

.entry-example-text {
  display: inline;
  letter-spacing: 0.015em;
  font-kerning: none;
}

.entry-example-item em,
.entry-example-text em {
  color: var(--color-text-muted);
  font-style: italic;
  font-size: 0.96em;
  letter-spacing: 0.012em;
  font-kerning: none;
}

/* ---------- Aplicação da Charis SIL aos dados lexicográficos ---------- */
.entry strong.entry-lemma,
.entry-lemma-line small,
.entry-transcription,
.entry-paradigm,
.entry-sense strong,
.entry-class,
.entry-example-text,
.entry-example-text em,
.entry-note,
.entry-note strong {
  font-family: 'CharisSIL', serif;
  /* Ativa posicionamento mark-to-mark para empilhar diacríticos corretamente */
  font-feature-settings: "mark" 1, "mkmk" 1;
}

/* ---------- Buttons ---------- */
button {
  background-color: var(--color-primary);
  color: white;
  border: none;
  padding: 12px 24px;
  font-size: 0.87rem;
  font-family: var(--font-body);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--transition-normal), box-shadow var(--transition-normal), transform var(--transition-fast);
  width: 100%;
  font-weight: 600;
  user-select: none;
  letter-spacing: 0.02em;
}

button:hover {
  background-color: var(--color-primary-medium);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
  box-shadow: var(--shadow-xs);
}

button:disabled {
  background-color: var(--color-text-muted);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

#consultar-btn {
  background-color: var(--color-primary);
}

#consultar-btn:hover {
  background-color: var(--color-primary-medium);
}

/* ---------- Login Status ---------- */
#loginStatus {
  color: #c53030;
  font-weight: 600;
  margin-top: 15px;
  text-align: center;
  font-size: 0.9rem;
}

/* ---------- Header (admin pages) ---------- */
header:not(.navbar) {
  display: flex;
  justify-content: flex-end;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 20px;
}

/* ============================================================
   COORDENADORES (equipe.html)
   ============================================================ */
.coordenadores-plataforma {
  margin-bottom: 26px;
}

.coord-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
  margin-top: 18px;
}

.coord-card {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  text-align: left;
  gap: 16px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: box-shadow var(--transition-normal), transform var(--transition-normal);
  position: relative;
}

.coord-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.coord-card img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--color-primary-pale);
  flex-shrink: 0;
}

.coord-card:hover img {
  border-color: var(--color-primary-light);
}

.coord-card h3 {
  margin: 0 0 2px;
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--color-primary);
}

.coord-card p {
  margin: 1px 0;
  font-size: 0.82rem;
  text-align: left;
  color: var(--color-text-secondary);
  line-height: 1.45;
}

.coord-card a {
  color: var(--color-primary-medium);
  font-weight: 500;
  font-size: 0.82rem;
}

.coord-card a:hover {
  color: var(--color-accent);
}

/* ============================================================
   LISTAS (equipe.html)
   ============================================================ */
.team-list {
  list-style: none;
  padding: 0;
  margin: 10px 0;
  columns: 1;
}

.team-list li {
  position: relative;
  padding: 8px 0 8px 28px;
  border-bottom: 1px solid var(--color-border-light);
  font-size: 0.91rem;
  color: var(--color-text);
  transition: background-color var(--transition-normal), padding-left var(--transition-normal);
  break-inside: avoid;
}

.team-list li:last-child {
  border-bottom: none;
}

.team-list li::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  background: var(--color-accent-pale);
  border: 1.5px solid var(--color-accent);
  border-radius: 50%;
  transition: background var(--transition-normal);
}

.team-list li:hover {
  background-color: var(--color-primary-ghost);
  padding-left: 32px;
}

.team-list li:hover::before {
  background: var(--color-accent);
}

/* ============================================================
   LOGOS (aplataforma.html)
   ============================================================ */
.logos-section {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--color-divider);
}

.logos-row {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.logos-row img {
  display: block;
  width: calc((100% - 60px) / 4);
  min-width: 0;
  height: auto;
  object-fit: contain;
  opacity: 0.5;
  transition: opacity var(--transition-normal);
  filter: grayscale(30%);
}

.logos-row img:hover {
  opacity: 0.85;
  filter: grayscale(0%);
}

/* ============================================================
   FOOTER — Dentro da área de conteúdo, discreto
   ============================================================ */
footer.footer {
  width: 100%;
  background: transparent;
  padding: 20px 40px 24px;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  line-height: 1.55;
  margin-top: auto;
  border-top: 1px solid var(--color-border);
}

footer.footer .footer-table {
  width: 100%;
  max-width: var(--content-max);
  border-collapse: collapse;
}

footer.footer .footer-table td {
  vertical-align: top;
  padding: 0;
}

footer.footer .footer-table td:last-child {
  text-align: right;
  white-space: nowrap;
}

footer.footer p {
  margin: 0 0 3px 0 !important;
  font-size: 0.72rem;
  line-height: 1.55;
  text-align: left;
  color: var(--color-text-muted);
}

footer.footer p:last-child {
  margin-bottom: 0 !important;
}

footer.footer a {
  color: var(--color-primary-medium);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
}

footer.footer a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

/* Admin button */
.admin-btn {
  font-size: 0.68rem;
  color: var(--color-text-muted);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background-color var(--transition-fast);
  opacity: 0.5;
}

.admin-btn:hover {
  color: var(--color-primary);
  background-color: var(--color-primary-ghost);
  text-decoration: none;
  opacity: 1;
}

.admin-btn .admin-icon {
  font-size: 0.82rem;
  color: inherit;
}

/* ============================================================
   DIALOG
   ============================================================ */
dialog {
  border: none;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 28px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  font-size: 1rem;
  background: var(--color-surface);
  font-family: var(--font-body);
}

dialog::backdrop {
  background: rgba(31, 41, 55, 0.4);
  backdrop-filter: blur(5px);
}

dialog h2 {
  margin-bottom: 16px;
}

dialog ul {
  list-style: none;
  max-height: 60vh;
  overflow-y: auto;
  padding-left: 0;
}

dialog ul li {
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border-light);
}

dialog ul li::before {
  display: none;
}

dialog button {
  background-color: #c53030;
  margin-top: 16px;
  width: 100%;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

dialog button:hover {
  background-color: #a12828;
}

/* ============================================================
   INPUTS EXTRAS (admin)
   ============================================================ */
input[type="email"],
input[type="password"],
textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.93rem;
  font-family: var(--font-body);
  margin-bottom: 16px;
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
  resize: vertical;
  min-height: 35px;
  box-sizing: border-box;
  background-color: var(--color-surface-alt);
  color: var(--color-text);
}

textarea {
  min-height: 80px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--color-primary-medium);
  outline: none;
  box-shadow: 0 0 0 3px rgba(27, 107, 90, 0.08);
}

/* ---------- Horizontal Rule ---------- */
hr {
  border: none;
  border-top: 1px solid var(--color-divider);
  margin: 24px 0;
}

/* ---------- Text helpers ---------- */
.text-gray-500 {
  color: var(--color-text-muted);
}

/* ============================================================
   RESPONSIVIDADE
   ============================================================ */

/* Tablets e celulares — sidebar colapsa, vira topbar compacta */
@media (max-width: 768px) {
  /* Container vira coluna simples */
  .container {
    flex-direction: column;
  }

  /* Navbar vira app bar compacta */
  .navbar {
    width: 100%;
    min-width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: auto;
    height: auto;
    flex-direction: column;
    border-right: none;
    border-bottom: none;
    overflow: visible;
    background: var(--sidebar-bg);
    /* Mantém a topbar sempre visível no scroll */
    padding: 0;
    box-shadow: none;
    z-index: 1300;
  }

  /* Nav-wrapper vira linha horizontal e recebe altura fixa */
  .nav-wrapper {
    flex-direction: row;
    align-items: center;
    /* Espaçamento horizontal consistente nos lados */
    padding: 0 16px;
    height: 52px;
    position: relative;
  }

  /* Branding compacto na topbar */
  .sidebar-brand {
    padding: 10px 16px;
    border-bottom: none;
    flex: 1;
    min-width: 0;
  }

  .sidebar-brand h1 {
    /* Título menor para caber na app bar */
    font-size: 0.88rem;
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sidebar-brand p {
    display: none;
  }

  /* Esconde o menu desktop */
  .navbar .menu {
    display: none !important;
  }

  /* Mostra o hamburger */
  .hamburger {
    display: flex !important;
    position: relative;
    margin-right: 16px;
    flex-shrink: 0;
    background: transparent;
    border: none;
    padding: 0;
    appearance: none;
  }

  .hamburger span {
    background-color: rgba(255,255,255,0.7);
  }

  /* Mobile menu — escondido por padrão, aparece ao clicar */
  .mobile-menu {
    display: none !important;
    position: absolute;
    top: 52px;
    left: 0;
    right: 0;
    background: var(--sidebar-bg);
    border-top: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 10px 24px rgba(0,0,0,0.12);
    z-index: 1200;
  }

  .mobile-menu.open {
    display: flex !important;
    flex-direction: column;
  }

  .mobile-menu span {
    display: block;
    color: var(--sidebar-text);
    padding: 11px 20px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: background-color 0.15s ease, color 0.15s ease;
  }

  .mobile-menu span:last-child {
    border-bottom: none;
  }

  .mobile-menu span:hover {
    background-color: var(--sidebar-hover);
    color: var(--sidebar-text-active);
  }

  .mobile-menu span.active {
    color: var(--sidebar-text-active);
    font-weight: 600;
    background-color: rgba(46, 168, 142, 0.15);
    border-left: 3px solid var(--color-accent-light);
  }

  :root {
    /* Patch 3: altura reduzida da bottom nav para 64px em tablets/celulares */
    --bottom-nav-height: 64px;
  }

  /* Refactor bottom navigation bar to be truly fixed and stable */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: var(--bottom-nav-height);
    background: var(--color-surface);
    /* Remove top border to avoid visible line on refresh */
    border-top: none;
    /* Remove shadow completely to avoid any visible loading line under the nav */
    box-shadow: none;
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
    padding: 0 4px;
    padding-bottom: env(safe-area-inset-bottom, 0);
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
  }

  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--color-text-muted);
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: color var(--transition-fast), transform var(--transition-fast), background-color var(--transition-fast);
    position: relative;
    min-width: 0;
    padding: 8px 4px 10px;
  }

  .bottom-nav-item svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform var(--transition-fast), stroke var(--transition-fast);
  }

  .bottom-nav-item:first-child svg,
  .bottom-nav-item[data-page="index.html"][data-text="Projetos"] svg {
    fill: none;
  }

  .bottom-nav-item.active {
    color: var(--color-accent);
  }

  .bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--color-accent);
  }

  .bottom-nav-item.active svg {
    transform: scale(1.08);
  }

  .bottom-nav-item .nav-label {
    font-size: 0.62rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  /* Área de conteúdo sem margem lateral */
  .content-area {
    margin-left: 0;
    /* Reserva espaço para a topbar fixa no topo */
    padding-top: calc(52px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
  }

  /* Banner mais compacto */
  .banner {
    padding: 18px 20px;
  }

  .banner h1 {
    font-size: 1.2rem;
  }

  .banner h2 {
    font-size: 0.7rem;
  }

  /* Main com margens menores e largura auto para não exceder a viewport */
  main {
    width: auto;
    max-width: none;
    margin: 16px 12px;
    padding: 24px 20px 28px;
  }

  main > h1 {
    font-size: 1.25rem;
  }

  /* Cards empilhados */
  .coord-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .coord-card {
    flex-direction: row;
    align-items: flex-start;
    text-align: left;
  }

  .coord-card p {
    text-align: left;
  }

  .coord-card img {
    width: 64px;
    height: 64px;
  }

  /* Logos menores */
  .logos-row {
    gap: 10px;
  }

  .logos-row img {
    width: calc((100% - 30px) / 4);
  }

  /* Footer compacto */
  footer.footer {
    padding: 14px 12px calc(var(--bottom-nav-height) + 18px + env(safe-area-inset-bottom, 0px));
  }
}

/* Celulares pequenos */
@media (max-width: 480px) {
  :root {
    /* Patch 3: altura reduzida da bottom nav para 58px em telas muito pequenas */
    --bottom-nav-height: 58px;
  }

  .nav-wrapper {
    min-height: 48px;
  }

  .content-area {
    padding-top: calc(48px + env(safe-area-inset-top, 0px));
  }

  .sidebar-brand {
    padding: 8px 12px;
  }

  .sidebar-brand h1 {
    font-size: 0.82rem;
  }

  .hamburger {
    margin-right: 12px;
  }

  .mobile-menu span {
    padding: 10px 16px;
    font-size: 0.82rem;
  }

  .banner {
    padding: 14px 14px;
  }

  .banner h1 {
    font-size: 1.05rem;
  }

  .banner h2 {
    font-size: 0.62rem;
    letter-spacing: 0.06em;
  }

  .banner p.global-info {
    font-size: 0.72rem;
  }

  main {
    width: auto;
    max-width: none;
    margin: 10px 8px;
    padding: 18px 14px 22px;
  }

  main > h1 {
    font-size: 1.1rem;
  }

  .coord-card {
    padding: 14px;
    gap: 12px;
  }

  .coord-card img {
    width: 56px;
    height: 56px;
  }

  .coord-card h3 {
    font-size: 0.88rem;
  }

  .coord-card p {
    font-size: 0.78rem;
  }

  .logos-row {
    flex-wrap: wrap;
    gap: 12px;
  }

  .logos-row img {
    width: calc((100% - 12px) / 2);
  }

  footer.footer {
    font-size: 0.65rem;
  }

  footer.footer p {
    font-size: 0.65rem;
  }
}

/* Desktop grande */
@media (min-width: 1200px) {
  .banner {
    padding: 34px 48px;
  }

  .banner h1 {
    font-size: 1.8rem;
  }

  main {
    margin: 32px 48px;
    padding: 44px 48px 48px;
  }

  footer.footer {
    padding: 20px 48px 24px;
  }
}

/* ============================================================
   ANIMAÇÕES
   ============================================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .navbar,
  .hamburger,
  .mobile-menu,
  .admin-btn,
  .sidebar-brand {
    display: none !important;
  }

  .container {
    display: block;
  }

  .content-area {
    margin-left: 0;
  }

  .banner {
    background: none !important;
    color: #000 !important;
    padding: 16px 0;
  }

  .banner h1,
  .banner h2 {
    color: #000 !important;
  }

  .banner::before,
  .banner::after {
    display: none !important;
  }

  main {
    box-shadow: none !important;
    border: 1px solid #ddd;
    animation: none !important;
    margin: 10px 0;
  }

  footer.footer {
    border-top: 1px solid #ccc;
  }

  body {
    background: #fff !important;
  }
}

/* ============================================================
   PATCH PWA-01 — Base de instalação e detecção de contexto
   ============================================================ */
.pwa-context-bar {
  width: 100%;
  padding: 12px 40px 0;
}

.pwa-context-content {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 40px 0 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-left: 4px solid var(--color-accent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  padding: 14px 16px;
}

.pwa-context-message {
  color: var(--color-text-secondary);
  font-size: 0.92rem;
  line-height: 1.55;
  margin: 0;
}

.pwa-context-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.pwa-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--color-primary-ghost);
  color: var(--color-primary-medium);
  border: 1px solid rgba(21, 52, 120, 0.10);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.pwa-chip.is-offline {
  background: var(--color-accent-pale);
  color: #8a4b39;
  border-color: rgba(212, 120, 92, 0.22);
}

.pwa-chip.is-online {
  background: var(--color-primary-ghost);
  color: var(--color-primary-medium);
}

@media (max-width: 768px) {
  .pwa-context-bar {
    padding: 10px 12px 0;
  }

  .pwa-context-content {
    max-width: none;
    margin: 0;
    padding: 12px 13px;
    border-radius: 12px;
  }

  .pwa-context-message {
    font-size: 0.84rem;
    line-height: 1.5;
  }

  .pwa-context-meta {
    gap: 6px;
    margin-top: 8px;
  }

  .pwa-chip {
    min-height: 26px;
    font-size: 0.72rem;
    padding: 4px 9px;
  }
}

/* ============================================================
   PATCH PWA-02 — Faixa educativa abaixo do banner
   ============================================================ */
.pwa-context-headline-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.pwa-context-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--color-accent-pale);
  color: #8a4b39;
  font-size: 0.92rem;
  flex: 0 0 auto;
}

.pwa-context-headline {
  margin: 0;
  color: var(--color-primary);
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.3;
}

.pwa-context-hint {
  margin: 8px 0 0;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

@media (max-width: 768px) {
  .pwa-context-headline-wrap {
    gap: 8px;
    margin-bottom: 6px;
  }

  .pwa-context-icon {
    width: 24px;
    height: 24px;
    font-size: 0.8rem;
  }

  .pwa-context-headline {
    font-size: 0.9rem;
  }

  .pwa-context-hint {
    font-size: 0.72rem;
  }
}

/* ============================================================
   PATCH PWA-03 — botão de instalação
   ============================================================ */
.pwa-context-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.pwa-install-button {
  appearance: none;
  border: 1px solid transparent;
  background: var(--color-accent);
  color: #fff;
  border-radius: 999px;
  min-height: 38px;
  padding: 8px 16px;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.pwa-install-button:hover {
  background: #c66b50;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.pwa-install-button:active {
  transform: translateY(0);
}

.pwa-install-fallback {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

@media (max-width: 768px) {
  .pwa-context-actions {
    align-items: stretch;
    gap: 8px;
  }

  .pwa-install-button {
    width: 100%;
    min-height: 36px;
    font-size: 0.8rem;
  }

  .pwa-install-fallback {
    font-size: 0.72rem;
  }
}

/* ============================================================
   PATCH PWA-05 — integração com offline natural do dicionário
   ============================================================ */
.pwa-offline-status {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--color-border);
}

.pwa-offline-title {
  margin: 0;
  color: var(--color-primary);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.35;
}

.pwa-offline-summary {
  margin: 6px 0 0;
  color: var(--color-text-secondary);
  font-size: 0.8rem;
  line-height: 1.5;
}

.pwa-offline-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.pwa-offline-list li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border-light);
}

.pwa-offline-list li strong {
  color: var(--color-text);
  font-size: 0.8rem;
  line-height: 1.3;
}

.pwa-offline-list li span {
  color: var(--color-text-muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.pwa-offline-list li.is-more {
  background: transparent;
  border-style: dashed;
}

@media (max-width: 768px) {
  .pwa-offline-status {
    margin-top: 10px;
    padding-top: 10px;
  }

  .pwa-offline-title {
    font-size: 0.82rem;
  }

  .pwa-offline-summary {
    font-size: 0.75rem;
  }

  .pwa-offline-list {
    gap: 6px;
  }

  .pwa-offline-list li {
    padding: 7px 9px;
  }

  .pwa-offline-list li strong {
    font-size: 0.76rem;
  }

  .pwa-offline-list li span {
    font-size: 0.68rem;
  }
}

/* ============================================================
   PATCH PWA-06 — robustez/fallback
   ============================================================ */
.pwa-fallback-status {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(21, 52, 120, 0.04);
  border: 1px solid rgba(21, 52, 120, 0.08);
}

.pwa-fallback-title {
  margin: 0;
  color: var(--color-primary);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
}

.pwa-fallback-message {
  margin: 6px 0 0;
  color: var(--color-text-secondary);
  font-size: 0.74rem;
  line-height: 1.5;
}

@media (max-width: 768px) {
  .pwa-fallback-status {
    margin-top: 10px;
    padding: 9px 10px;
  }

  .pwa-fallback-title {
    font-size: 0.78rem;
  }

  .pwa-fallback-message {
    font-size: 0.7rem;
  }
}

/* ============================================================
   PATCH PWA-07 — Blindagem do offline real com degradação graciosa
   ============================================================ */
.pwa-fallback-status {
  border-left: 3px solid var(--color-primary-medium);
}

.pwa-fallback-status.is-runtime-issue {
  background: rgba(212, 120, 92, 0.08);
  border-color: rgba(212, 120, 92, 0.18);
}

.pwa-fallback-status.is-runtime-issue .pwa-fallback-title {
  color: #8a4b39;
}

/* ============================================================
   PATCH UX-01R — Fechamento inteligente de mensagens contextuais
   ============================================================ */
.pwa-context-content {
  position: relative;
}

.pwa-close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.pwa-close-button:hover {
  background: rgba(0,0,0,0.05);
  color: var(--color-text-secondary);
  transform: scale(1.03);
}

.pwa-close-button:active {
  transform: scale(0.98);
}

@media (max-width: 768px) {
  .pwa-close-button {
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    font-size: 1.05rem;
  }

  .pwa-context-headline-wrap {
    padding-right: 24px;
  }
}

/* ============================================================
   PATCH UX-02A — Orientação pós-instalação integrada
   ============================================================ */
.pwa-install-guidance {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(212, 120, 92, 0.08);
  border: 1px solid rgba(212, 120, 92, 0.16);
}

.pwa-install-guidance-title {
  margin: 0;
  color: #8a4b39;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
}

.pwa-install-guidance-message {
  margin: 6px 0 0;
  color: var(--color-text-secondary);
  font-size: 0.74rem;
  line-height: 1.5;
}

@media (max-width: 768px) {
  .pwa-install-guidance {
    margin-top: 10px;
    padding: 9px 10px;
  }

  .pwa-install-guidance-title {
    font-size: 0.78rem;
  }

  .pwa-install-guidance-message {
    font-size: 0.7rem;
  }
}

/* ============================================================
   PATCH UX-03 — Fechamento total das mensagens contextuais
   ============================================================ */
.pwa-close-button {
  z-index: 3;
}


/* ============================================================
   PATCH PWA-08 — Splash screen + identidade visual do app
   ============================================================ */
#splash-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at top, rgba(59,130,246,0.20), transparent 38%),
    linear-gradient(180deg, #0b1f3a 0%, #123a6b 100%);
  opacity: 0;
  pointer-events: none;
}

#splash-screen.is-visible {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

#splash-screen.is-hiding {
  opacity: 0;
  transition: opacity 420ms ease;
}

.splash-content {
  width: min(88vw, 520px);
  padding: 32px 24px;
  text-align: center;
  color: #ffffff;
  animation: splashContentIn 700ms cubic-bezier(0.22, 1, 0.36, 1);
}

.splash-icon {
  width: 112px;
  height: 112px;
  margin: 0 auto 22px;
  border-radius: 24px;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.20);
  animation: splashIconIn 650ms cubic-bezier(0.22, 1, 0.36, 1);
}

.splash-overline {
  margin: 0;
  font-size: 0.98rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.82);
  animation: splashTextIn 700ms 240ms both ease;
}

.splash-title {
  margin: 6px 0 8px;
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.8rem);
  line-height: 1.08;
  color: #ffffff;
  animation: splashTextIn 700ms 360ms both ease;
}

.splash-subtitle {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: rgba(255,255,255,0.82);
  animation: splashTextIn 700ms 500ms both ease;
}

@keyframes splashIconIn {
  from { opacity: 0; transform: scale(0.9) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes splashTextIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes splashContentIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

body.splash-active {
  overflow: hidden;
}

@media (max-width: 768px) {
  .splash-content {
    width: min(90vw, 420px);
    padding: 28px 20px;
  }

  .splash-icon {
    width: 98px;
    height: 98px;
    margin-bottom: 18px;
    border-radius: 22px;
  }

  .splash-overline {
    font-size: 0.88rem;
  }

  .splash-subtitle {
    font-size: 0.84rem;
  }
}

/* PATCH-SEC1: classes que substituem estilos inline gerados pelo JS. */
.entry-sense-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.entry-sense-number {
  font-size: 0.8rem;
  line-height: 1;
}
.entry-class {
  font-size: 0.85rem;
  color: #64748b;
}
.entry-meta,
.entry-meta p {
  font-size: 0.72rem !important;
  color: #94a3b8;
  line-height: 1.35;
}


/* PATCH PWA-UPDATE-NOW-V1: botão manual para ativar nova versão do PWA. */
.pwa-update-button {
  appearance: none;
  border: 1px solid transparent;
  background: var(--color-accent);
  color: #fff;
  border-radius: 999px;
  min-height: 38px;
  padding: 8px 16px;
  margin-top: 10px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
}

.pwa-update-button:hover {
  background: #c66b50;
}

.pwa-update-button:disabled {
  opacity: 0.7;
  cursor: wait;
}

/* PATCH UX-PWA-UPDATED-MESSAGE-V1: remove ícone lateral das mensagens contextuais. */
.pwa-context-icon {
  display: none;
}

