/* Overrides leves sobre AdminLTE 4 / Bootstrap 5 */

/* Evita texto claro (OS dark mode / color-scheme) sobre fundo claro do AdminLTE */
html {
  color-scheme: light;
}

body {
  color: #212529;
}

.app-main,
.app-content,
.app-content-header,
.app-footer,
.card,
.card-body,
.card-header,
.table,
.form-control,
.form-select,
.form-label,
.alert {
  color: #212529;
}

.text-secondary,
.suplix-sync-meta {
  color: #6c757d !important;
}

.logo-plate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 0.5rem;
  padding: 0.35rem 0.55rem;
}

.logo-plate-login {
  margin: 0 auto 1rem;
  padding: 0.75rem 1rem;
}

.logo-plate-navbar {
  padding: 0.15rem 0.35rem;
  background: transparent;
}

.logo-navbar {
  display: block;
  height: 64px;
  width: auto;
  max-width: 260px;
  object-fit: contain;
}

.logo-login {
  display: block;
  height: 120px;
  width: 120px;
  object-fit: contain;
}

.suplix-navbar-brand {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.35rem;
  margin: 0;
  text-decoration: none;
}

/*
 * Header em largura total acima do menu.
 * Sidebar NÃO cobre o header (AdminLTE usa z-index maior + sticky top:0).
 */
.app-wrapper {
  grid-template-areas:
    "lte-app-header lte-app-header"
    "lte-app-sidebar lte-app-main"
    "lte-app-sidebar lte-app-footer";
}

.app-header {
  background: #fff;
  z-index: 1045;
  min-height: 4.5rem;
}

/* Evita a sidebar sticky do AdminLTE subir por cima do header */
.fixed-header .app-sidebar,
.fixed-header.sidebar-expand-lg .app-sidebar,
.fixed-header.sidebar-expand-lg.sidebar-mini .app-sidebar,
.fixed-header.sidebar-expand-lg.sidebar-mini.sidebar-collapse .app-sidebar {
  position: relative !important;
  top: auto !important;
  max-height: none !important;
  height: auto !important;
  align-self: stretch;
  z-index: 1030;
}

.suplix-sidebar {
  --lte-sidebar-bg: #1a2b3c;
  --lte-sidebar-color: #ffffff;
  --lte-sidebar-hover-bg: rgba(255, 255, 255, 0.08);
  --lte-sidebar-hover-color: #ffffff;
  --lte-sidebar-active-color: #ffffff;
  --lte-sidebar-menu-active-bg: rgba(13, 110, 253, 0.28);
  --lte-sidebar-menu-active-color: #ffffff;
  background-color: var(--lte-sidebar-bg) !important;
}

.suplix-sidebar .sidebar-wrapper {
  padding-top: 0;
}

/* Hambúrguer fixo no topo do menu (sempre acima do Geral) */
.suplix-menu-toggle-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.25rem 0.25rem;
  flex-shrink: 0;
}

.suplix-menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  margin: 0 auto;
  border-radius: 0.45rem;
  color: #fff !important;
  text-decoration: none;
  line-height: 1;
}

.suplix-menu-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff !important;
}

.suplix-menu-toggle .bi {
  font-size: 2.15rem;
  line-height: 1;
}

.sidebar-mini.sidebar-collapse .suplix-menu-toggle-wrap {
  width: 100%;
}

.sidebar-mini.sidebar-collapse .suplix-menu-toggle {
  width: 3.25rem;
  height: 3.25rem;
}

.suplix-sidebar .sidebar-menu .nav-link,
.suplix-sidebar .sidebar-menu .nav-link .nav-icon,
.suplix-sidebar .sidebar-menu .nav-link p {
  color: #fff !important;
}

.suplix-sidebar .sidebar-menu .nav-link p {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}

.suplix-sidebar .sidebar-menu .nav-link.active {
  background: var(--lte-sidebar-menu-active-bg) !important;
  box-shadow: inset 3px 0 0 #0d6efd;
}

/* Submenu Admin no padrão AdminLTE (visível só com sidebar expandida) */
.suplix-sidebar .nav-treeview {
  display: none;
  padding: 0;
  margin: 0;
}

.suplix-sidebar .nav-item.menu-open > .nav-treeview {
  display: block;
}

.suplix-sidebar .nav-arrow {
  margin-left: auto;
  font-size: 0.85rem;
  transition: transform 0.15s ease;
}

.suplix-sidebar .nav-item.menu-open > .nav-link > p > .nav-arrow {
  transform: rotate(90deg);
}

.suplix-sidebar .sidebar-menu > .nav-item > .nav-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.suplix-sidebar .sidebar-menu > .nav-item > .nav-link > p {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.suplix-sidebar .nav-treeview .nav-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding-top: 0.45rem !important;
  padding-bottom: 0.45rem !important;
  padding-left: 2.35rem !important;
}

.suplix-sidebar .nav-treeview .nav-link .nav-icon {
  font-size: 0.55rem;
  opacity: 0.85;
}

.suplix-sidebar .nav-treeview .nav-link p {
  text-transform: none;
  font-size: 0.8rem;
  font-weight: 500;
  margin: 0;
}

/* Mini fechado: esconde treeview (evita o “card” flutuante do AdminLTE) */
.sidebar-mini.sidebar-collapse .suplix-sidebar .nav-treeview {
  display: none !important;
  position: static !important;
  left: auto !important;
  width: auto !important;
  min-width: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}

/* Mini fechado: mais largo (Embalagem), ícone e texto centralizados */
.sidebar-mini.sidebar-collapse .suplix-sidebar {
  --lte-sidebar-width: 7rem;
  min-width: 7rem;
  max-width: 7rem;
}

.sidebar-mini.sidebar-collapse .suplix-sidebar .sidebar-menu > .nav-item {
  width: 100%;
}

.sidebar-mini.sidebar-collapse .suplix-sidebar .sidebar-menu > .nav-item > .nav-link {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  width: 100% !important;
  max-width: 100%;
  margin: 0.1rem 0;
  padding: 0.55rem 0.2rem !important;
  text-align: center;
}

.sidebar-mini.sidebar-collapse .suplix-sidebar .sidebar-menu > .nav-item > .nav-link .nav-icon {
  display: block;
  margin: 0 auto !important;
  width: auto;
  font-size: 1.25rem;
  text-align: center;
}

.sidebar-mini.sidebar-collapse .suplix-sidebar .sidebar-menu > .nav-item > .nav-link p {
  display: block !important;
  visibility: visible !important;
  width: 100% !important;
  max-width: 100%;
  margin: 0;
  padding: 0 !important;
  overflow: visible;
  font-size: 0.58rem;
  line-height: 1.15;
  letter-spacing: 0;
  text-align: center;
  white-space: normal;
  word-break: break-word;
  animation: none !important;
}

.sidebar-mini.sidebar-collapse .suplix-sidebar .sidebar-menu > .nav-item > .nav-link .nav-arrow {
  display: none;
}

.suplix-login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse at top, rgba(13, 110, 253, 0.08), transparent 55%),
    var(--bs-body-bg, #f8f9fa);
}

.suplix-login-card {
  width: 100%;
  max-width: 420px;
}

.suplix-sync-meta {
  font-size: 0.8rem;
  white-space: nowrap;
}

.suplix-chart {
  width: 100%;
  min-height: 280px;
}

.tabulator {
  font-size: 0.9rem;
  color: #212529;
  background: #fff;
}

.tabulator .tabulator-header {
  font-weight: 600;
  color: #212529;
  background: #f8f9fa;
}

.tabulator .tabulator-header .tabulator-col {
  background: #f8f9fa;
  color: #212529;
  border-right-color: #dee2e6;
}

.tabulator .tabulator-cell {
  color: #212529;
  border-right-color: #dee2e6;
}

.tabulator .tabulator-row {
  background: #fff;
  color: #212529;
}

.tabulator .tabulator-row.tabulator-row-even {
  background: #f8f9fa;
}

.tabulator .tabulator-row.tabulator-selected {
  background: #e7f1ff;
}

.tabulator .tabulator-footer {
  background: #f8f9fa;
  color: #212529;
}

.tabulator input,
.tabulator select {
  color: #212529;
  background: #fff;
}

/* Modal de sync (overlay próprio, fora do Bootstrap modal) */
.sync-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.45);
  padding: 1rem;
}

.sync-modal[hidden] {
  display: none !important;
}

.sync-modal-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  color: #212529;
  border-radius: 0.75rem;
  box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.18);
  padding: 1.25rem 1.35rem;
}

.sync-modal-card h2 {
  font-size: 1.15rem;
  margin: 0 0 0.5rem;
  color: #212529;
}

.sync-modal-step {
  margin: 0 0 0.75rem;
  font-weight: 600;
  color: #212529;
}

.sync-modal .progress {
  background-color: #e9ecef;
}

.sync-modal-percent {
  margin: 0.15rem 0 0.5rem;
  font-size: 0.95rem;
  color: #0d6efd;
  font-weight: 700;
  text-align: center;
}

.sync-modal-detail {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  min-height: 1.2em;
  color: #495057;
  text-align: center;
}

.inline-form {
  display: inline;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-start;
}

/* Filtro de período (presets + Flatpickr) */
.period-filter-refresh {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.55rem;
  line-height: 1;
}

.period-filter-menu {
  --period-menu-width: 560px;
  width: var(--period-menu-width);
  max-width: calc(100vw - 1rem);
  overflow: hidden;
}

.period-filter-panel {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  min-height: 320px;
}

.period-filter-calendar {
  flex: 1 1 auto;
  min-width: 0;
}

.period-filter-presets {
  flex: 0 0 170px;
  width: 170px;
}

@media (max-width: 575.98px) {
  .period-filter-menu {
    --period-menu-width: min(360px, 96vw);
  }

  .period-filter-panel {
    flex-direction: column;
  }

  .period-filter-presets {
    width: 100%;
    flex-basis: auto;
    border-left: 0 !important;
    border-top: 1px solid var(--bs-border-color);
  }
}

.period-filter-presets {
  display: flex;
  flex-direction: column;
  background: #fff;
}

.period-preset {
  appearance: none;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0.55rem 0.9rem;
  font-size: 0.9rem;
  color: #212529;
  border-bottom: 1px solid #f1f3f5;
  width: 100%;
}

.period-preset:hover {
  background: #f8f9fa;
}

.period-preset.active {
  color: #0d6efd;
  font-weight: 600;
  background: #e7f1ff;
}

.period-filter-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.period-filter-calendar .js-period-picker-input {
  position: absolute !important;
  opacity: 0;
  pointer-events: none;
  height: 0;
  width: 0;
  border: 0;
  padding: 0;
}

.period-filter-calendar .flatpickr-calendar {
  box-shadow: none !important;
  margin: 0 auto;
  background: #fff;
  color: #212529;
  width: auto !important;
}

.period-filter-calendar .flatpickr-calendar.inline {
  display: block !important;
  top: 0 !important;
  position: relative !important;
}

.period-filter-calendar .flatpickr-months,
.period-filter-calendar .flatpickr-weekdays,
.period-filter-calendar .flatpickr-days,
.period-filter-calendar .flatpickr-current-month,
.period-filter-calendar .flatpickr-weekday,
.period-filter-calendar .flatpickr-day {
  color: #212529;
}

.period-filter-calendar .flatpickr-day.selected,
.period-filter-calendar .flatpickr-day.startRange,
.period-filter-calendar .flatpickr-day.endRange {
  background: #0d6efd;
  border-color: #0d6efd;
  color: #fff;
}

.period-filter-calendar .flatpickr-day.inRange {
  background: #e7f1ff;
  border-color: #e7f1ff;
  box-shadow: none;
  color: #212529;
}
