/* ================================================================
   SIDEBAR — Menu lateral moderno
   NÃO altera regras do site original; apenas posiciona o menu
   ================================================================ */

/* ── Botão hamburguer (mobile) ── */
.sidebar-toggle-float {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 999;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0B3D91, #1049A8);
  color: #fff;
  font-size: 1.3rem;
  border: none;
  box-shadow: 0 4px 16px rgba(11,61,145,.35);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: opacity .2s ease, visibility .2s ease, transform .2s ease;
}
.sidebar-toggle-float:hover { transform: scale(1.05); }
.sidebar-toggle-float.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(.92);
}

/* ── Overlay ── */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(3px);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: transform .25s ease, box-shadow .25s ease, background-color .25s ease, color .25s ease, border-color .25s ease, opacity .25s ease;
}
.sidebar-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 240px;
  height: 100vh;
  background: #fff;
  border-right: 1px solid #e2e8f0;
  box-shadow: 2px 0 12px rgba(11,61,145,.08);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transform: translateX(-110%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.sidebar.is-open { transform: translateX(0); }

/* Header */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  border-bottom: 1px solid #e2e8f0;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
}
.sidebar-brand img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 10px;
}
.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.sidebar-brand-text strong {
  font-size: .88rem;
  color: #0B3D91;
  font-weight: 700;
}
.sidebar-brand-text small {
  font-size: .6rem;
  color: #8898aa;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.sidebar-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: #f1f5f9;
  color: #64748b;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: .6rem .6rem;
  overflow-y: auto;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .6rem .75rem;
  margin-bottom: .25rem;
  border-radius: 10px;
  text-decoration: none;
  color: #475569;
  font-size: .82rem;
  font-weight: 600;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease, color .15s ease, border-color .15s ease, opacity .15s ease;
  position: relative;
}
.sidebar-link:hover {
  background: #f1f5f9;
  color: #0B3D91;
}
.sidebar-link.active {
  background: linear-gradient(135deg, #0B3D91, #1049A8);
  color: #fff;
  box-shadow: 0 3px 10px rgba(11,61,145,.22);
}
.sidebar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  font-size: 1.05rem;
  flex-shrink: 0;
}
.sidebar-indicator {
  position: absolute;
  right: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #F7B731;
}

/* Footer */
.sidebar-footer {
  padding: .6rem;
  border-top: 1px solid #e2e8f0;
}
.sidebar-footer-badge {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: linear-gradient(135deg,#FFF9E6,#FFF3CD);
  border: 1px solid #FDE68A;
  border-radius: 10px;
  padding: .45rem .6rem;
}
.sidebar-footer-badge span { font-size: .95rem; }
.sidebar-footer-badge small {
  font-size: .62rem;
  color: #92400E;
  font-weight: 600;
}

/* ================================================================
   DESKTOP — sidebar visível, conteúdo empurrado via padding-left
   ================================================================ */
@media (min-width: 1101px) {
  .sidebar-toggle-float { display: none !important; }
  .sidebar-overlay       { display: none !important; }
  .sidebar-close         { display: none !important; }

  .sidebar {
    transform: none !important;
  }

  /* empurra todo o conteúdo do site para a direita */
  body.portal-body {
    padding-left: 240px !important;
  }
}

/* ================================================================
   MOBILE/TABLET — painel compacto, bonito e versátil
   ================================================================ */
@media (max-width: 1100px) {
  .sidebar-toggle-float {
    display: flex !important;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    background: linear-gradient(135deg, #0B3D91 0%, #1565D8 56%, #22C55E 150%);
    box-shadow: 0 10px 24px rgba(11,61,145,.28);
  }

  .sidebar-toggle-float:hover {
    transform: translateY(-1px) scale(1.03);
  }

  .sidebar-overlay {
    background: rgba(15, 23, 42, .42);
    backdrop-filter: blur(5px);
  }

  .sidebar {
    top: 10px;
    left: 10px;
    width: min(82vw, 292px);
    height: auto;
    max-height: calc(100dvh - 20px);
    border: 1px solid rgba(226, 232, 240, .82);
    border-radius: 22px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(255,255,255,.98) 0%, rgba(248,250,252,.98) 100%);
    box-shadow: 0 22px 60px rgba(15, 23, 42, .24), 0 4px 16px rgba(11,61,145,.12);
    transform: translate3d(calc(-100% - 18px), 0, 0) scale(.96);
    transform-origin: left top;
    transition: transform .28s cubic-bezier(.22,1,.36,1), opacity .22s ease;
    opacity: .92;
  }

  .sidebar.is-open {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 1;
  }

  .sidebar-header {
    padding: .62rem .72rem .55rem;
    background: linear-gradient(135deg, rgba(11,61,145,.08), rgba(34,197,94,.08));
  }

  .sidebar-brand {
    gap: .5rem;
    min-width: 0;
  }

  .sidebar-brand img {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(11,61,145,.12);
  }

  .sidebar-brand-text strong {
    font-size: .82rem;
  }

  .sidebar-brand-text small {
    font-size: .56rem;
    letter-spacing: .05em;
  }

  .sidebar-close {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: rgba(15,23,42,.06);
    color: #334155;
  }

  .sidebar-nav {
    display: flex;
    flex: initial;
    flex-direction: column;
    align-items: stretch;
    gap: .16rem;
    padding: .48rem;
    max-height: calc(100dvh - 132px);
  }

  .sidebar-link {
    gap: .55rem;
    min-height: 38px;
    padding: .46rem .58rem;
    margin-bottom: .16rem;
    border-radius: 14px;
    color: #334155;
    font-size: .79rem;
    font-weight: 700;
  }

  .sidebar-link:hover {
    background: rgba(11,61,145,.08);
  }

  .sidebar-link.active {
    background: linear-gradient(135deg, #0B3D91, #1565D8);
    box-shadow: 0 8px 18px rgba(11,61,145,.20);
  }

  .sidebar-icon {
    width: 1.28rem;
    height: 1.28rem;
    font-size: .98rem;
  }

  .sidebar-indicator {
    right: 9px;
    width: 5px;
    height: 5px;
    box-shadow: 0 0 0 3px rgba(247,183,49,.18);
  }

  .sidebar-footer {
    padding: 0 .5rem .52rem;
    border-top: 0;
  }

  .sidebar-footer-badge {
    justify-content: center;
    padding: .38rem .52rem;
    border-radius: 14px;
    background: rgba(255, 249, 230, .92);
  }

  .sidebar-footer-badge span {
    font-size: .84rem;
  }

  .sidebar-footer-badge small {
    font-size: .56rem;
    line-height: 1.15;
  }

  body.portal-body {
    padding-left: 0 !important;
  }

  body.sidebar-open {
    overflow: hidden;
  }
}

@media (max-width: 380px) {
  .sidebar {
    width: calc(100vw - 18px);
    left: 9px;
    top: 9px;
    max-height: calc(100dvh - 18px);
    border-radius: 20px;
  }

  .sidebar-link {
    min-height: 36px;
    padding: .42rem .54rem;
    font-size: .76rem;
  }
}
