:root {
  /* Cores Base */
  --primary-color: #000000;
  --primary-hover: #333333;
  --primary-light: #f5f5f5;

  --white: #ffffff;
  --gray-50: #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #eeeeee;
  --gray-300: #e0e0e0;
  --gray-400: #bdbdbd;
  --gray-500: #9e9e9e;
  --gray-600: #757575;
  --gray-700: #616161;
  --gray-800: #424242;
  --gray-900: #212121;

  /* Sidebar (Sempre Preta) */
  --sidebar-bg: #000000;
  --sidebar-text: #ffffff;
  --sidebar-hover-bg: #222222;
  --sidebar-active-bg: #ffffff;
  --sidebar-active-text: #000000;
  --sidebar-border: #333333;

  /* Layout */
  --font-family-primary: 'Manrope', sans-serif;
  --font-family-secondary: 'Plus Jakarta Sans', sans-serif;

  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;

  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.25);

  --sidebar-width: 220px;
  --sidebar-width-collapsed: 85px;
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-family-primary);
  background-color: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  margin: 0;
}

/* --- Lógica das Logos --- */
.brand-full {
  max-width: 80%;
  height: auto;
  margin: 0 auto;
  display: block;
}

.brand-icon {
  width: 36px;
  margin: 0 auto;
  display: none;
}

/* Escondido por padrão */

/* --- Sidebar --- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  width: var(--sidebar-width);
  height: 100vh;
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
  padding: var(--spacing-md);
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease;
}

.sidebar-brand {
  display: block;
  padding: 1rem 0;
  text-align: center;
  position: relative;
}

.sidebar-toggle {
  position: absolute;
  top: 1.2rem;
  right: 0;
  background: transparent;
  border: none;
  color: var(--sidebar-text);
  opacity: 0.5;
  cursor: pointer;
  transition: opacity 0.2s;
}

.sidebar-toggle:hover {
  opacity: 1;
}

.sidebar .nav-link {
  color: var(--sidebar-text);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  text-decoration: none;
  transition: all 0.2s;
}

.sidebar .nav-link:hover {
  background-color: var(--sidebar-hover-bg);
  color: var(--sidebar-text);
}

.sidebar .nav-link.active {
  background-color: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 600;
}

.sidebar .nav-link i {
  margin-right: 0.6rem;
  font-size: 1.1rem;
}

.sidebar-divider {
  border-color: var(--sidebar-border);
  opacity: 0.5;
  margin: 1rem 0;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  font-size: 0.9rem;
}

.sidebar-logout {
  color: var(--sidebar-text);
  text-decoration: none;
  opacity: 0.8;
}

.sidebar-logout:hover {
  opacity: 1;
}

/* --- Main Content --- */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding: var(--spacing-xl);
  background-color: var(--white);
  transition: margin-left 0.3s ease;
}

/* --- Cards & Containers --- */
.page-header,
.table-container,
.supplier-toggles {
  background-color: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.page-title {
  font-family: var(--font-family-secondary);
  font-weight: 700;
  font-size: 1.75rem;
  margin-bottom: 0.2rem;
  color: var(--gray-900);
}

.page-subtitle {
  color: var(--gray-600);
  font-size: 1rem;
  margin: 0;
}

/* --- Tabela --- */
.table {
  color: var(--gray-800);
  width: 100%;
  margin-bottom: 0;
}

.table thead th {
  background-color: var(--gray-50);
  color: var(--gray-900);
  border-bottom: 2px solid var(--gray-300);
  font-weight: 600;
  padding: 1rem;
  text-transform: uppercase;
  font-size: 0.8rem;
}

.table tbody td {
  padding: 1rem;
  border-bottom: 1px solid var(--gray-200);
  vertical-align: middle;
}

.table tbody tr:hover {
  background-color: var(--gray-100);
}

/* --- Botões --- */
.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: var(--white);
  font-weight: 600;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
  color: var(--white);
}

.btn-outline-primary {
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-outline-primary:hover {
  background-color: var(--primary-color);
  color: var(--white);
}

/* --- Toggles de Fornecedor --- */
.form-check-input:checked {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

/* =========================================
   Lógica da Sidebar Recolhida
   ========================================= */
html.sidebar-collapsed {
  --sidebar-width: var(--sidebar-width-collapsed);
}

/* Esconde textos e a logo inteira */
html.sidebar-collapsed .sidebar .sidebar-label,
html.sidebar-collapsed .brand-full {
  display: none !important;
}

/* Mostra a logo ícone */
html.sidebar-collapsed .brand-icon {
  display: block !important;
}

/* Ajusta o botão de toggle */
html.sidebar-collapsed .sidebar-toggle {
  position: static;
  margin: 0.5rem auto 0;
  transform: rotate(180deg);
}

/* Centraliza os ícones do menu */
html.sidebar-collapsed .sidebar .nav-link {
  justify-content: center;
  padding: 0.6rem;
  margin: 0.2rem 0.4rem;
  /* <-- ADICIONE ESTA LINHA */
}

html.sidebar-collapsed .sidebar .nav-link i {
  margin: 0;
  font-size: 1.3rem;
}

/* Limita o tamanho das imagens e deixa o mouse com a mãozinha */
.variant-img {
  max-width: 180px;
  max-height: 180px;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid #ddd;
  cursor: pointer;
  transition: transform 0.2s;
}

.variant-img:hover {
  transform: scale(1.05);
}

/* Link do SKU para o site do fornecedor */
.sku-link {
  color: var(--primary-color, #000);
  text-decoration: none;
  border-bottom: 1px dashed currentColor;
}
.sku-link:hover {
  background: var(--primary-light, #f5f5f5);
}

/* Ajusta o campo de filtro dentro do cabeçalho da tabela */
.bootstrap-table .fixed-table-container .table thead th input.form-control {
  height: 30px;
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
}

/* ==========================================================
   RESPONSIVO — Mobile / Tablet / Desktop
   Breakpoints em pixels de viewport (independe de polegada/DPI)
   ========================================================== */

/* Hamburger: escondido por padrão */
.sidebar-mobile-toggle {
  display: none;
  position: fixed;
  top: 0.875rem;
  left: 0.875rem;
  z-index: 1050;
  width: 2.75rem;          /* 44px — mínimo Apple HIG / Material */
  height: 2.75rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--gray-900);
  font-size: 1.35rem;
  box-shadow: var(--shadow-md);
  cursor: pointer;
}
.sidebar-mobile-toggle:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Backdrop */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.45);
  cursor: pointer;
}
.sidebar-backdrop.show { display: block; }

/* ============ TABLET & MOBILE (<= 991px) ============ */
@media (max-width: 991px) {
  /* Força largura do drawer mesmo se estava colapsada */
  html, html.sidebar-collapsed {
    --sidebar-width: 260px;
  }

  .sidebar-mobile-toggle {
    display: inline-flex;
  }

  /* Drawer deslizante */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    z-index: 1000;
    box-shadow: var(--shadow-md);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.25);
  }

  /* Conteúdo ocupa tela toda */
  .main-content,
  .main-content.with-sidebar {
    margin-left: 0 !important;
    padding: 1rem;
    padding-top: 4.25rem;   /* espaço do hamburger */
  }

  /* Ignora o estado "collapsed" no mobile — drawer deve vir expandido */
  html.sidebar-collapsed .sidebar .sidebar-label,
  html.sidebar-collapsed .sidebar .sidebar-user,
  html.sidebar-collapsed .sidebar .sidebar-parent,
  html.sidebar-collapsed .sidebar .brand-full {
    display: inline !important;
  }
  html.sidebar-collapsed .sidebar .brand-full {
    display: block !important;
  }
  html.sidebar-collapsed .sidebar .brand-icon {
    display: none !important;
  }

  /* Esconde o chevron de colapsar dentro do drawer (não faz sentido) */
  .sidebar .sidebar-toggle {
    display: none;
  }
}

/* ============ MOBILE (<= 767px) ============ */
@media (max-width: 767px) {
  .page-title  { font-size: 1.35rem; }
  .page-subtitle { font-size: 0.9rem; }
  .page-header { padding: 1rem; }

  /* Barra de filtros empilhada */
  .supplier-toggles .d-flex {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.5rem !important;
  }
  .supplier-toggles .form-select,
  .supplier-toggles .form-select-sm,
  .supplier-toggles .btn,
  .supplier-toggles .btn-sm {
    width: 100% !important;
  }
  .supplier-toggles .form-check {
    margin-right: 0;
  }

  /* Tabela: rolagem horizontal suave + colunas menos críticas escondidas */
  .table-container .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Produtos: esconder Venda(6), Atualizado em(10) */
  #supplier-products-table thead th:nth-child(6),
  #supplier-products-table tbody td:nth-child(6),
  #supplier-products-table thead th:nth-child(10),
  #supplier-products-table tbody td:nth-child(10) {
    display: none !important;
  }

  /* Mantém a imagem, só diminui */
  .variant-img {
    max-width: 48px !important;
    max-height: 48px !important;
    border-width: 1px !important;
  }

  /* Filtros do cabeçalho do bootstrap-table ocupam menos */
  .bootstrap-table .fixed-table-container .table thead th input.form-control {
    min-width: 0;
  }

  /* Eventos: barra de filtros já vem com col-md-3 — vira col-6 no mobile */
  #catalog-events-table thead th[data-field="detail"] { display: none; }
}

/* ============ PHONE (<= 575px) ============ */
@media (max-width: 575px) {
  .page-title { font-size: 1.15rem; }
  .page-subtitle { font-size: 0.82rem; }
  .page-header { padding: 0.875rem; }
  .main-content { padding: 0.75rem; padding-top: 4rem; }

  /* Esconder mais 2 colunas: Modelo/Cor(4), Fornecedor(9) */
  #supplier-products-table thead th:nth-child(4),
  #supplier-products-table tbody td:nth-child(4),
  #supplier-products-table thead th:nth-child(9),
  #supplier-products-table tbody td:nth-child(9) {
    display: none !important;
  }

  /* Eventos: esconder detalhe e status */
  #catalog-events-table thead th[data-field="status"],
  #catalog-events-table thead th[data-field="detail"] { display: none; }

  /* Botões da barra de ação ficam compactos */
  .supplier-toggles .btn-sm { font-size: 0.85rem; padding: 0.4rem 0.6rem; }
}

/* ============ WIDE (>= 1600px) ============ */
@media (min-width: 1600px) {
  .main-content { padding: 2.5rem 3rem; }
  .page-title { font-size: 1.9rem; }
}

.sku-link {
    color: var(--primary-color, #000);
    text-decoration: none;
    border-bottom: 1px dashed currentColor;
}
.sku-link:hover {
    background: var(--primary-light, #f5f5f5);
}

/* Aba Lista — inputs inline */
.inline-edit {
    border: 1px solid var(--gray-300, #e0e0e0);
    border-radius: 4px;
    padding: 0.15rem 0.35rem;
    font-size: 0.875rem;
    text-align: right;
}
.inline-edit:focus {
    border-color: var(--primary-color, #000);
    outline: none;
    box-shadow: 0 0 0 0.15rem rgba(0, 0, 0, 0.15);
}
.col-discount .inline-edit {
    text-align: center;
}

/* Aba Geral — célula inteira clicável */
#list-general-table tbody td:first-child,
#list-families-table tbody td:first-child {
    cursor: pointer;
    text-align: center;
    padding: 0.5rem;
}
#list-general-table tbody td:first-child:hover,
#list-families-table tbody td:first-child:hover {
    background: var(--primary-light, #f5f5f5);
}
#list-general-table tbody td:first-child input[type="checkbox"],
#list-families-table tbody td:first-child input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    cursor: pointer;
    margin: 0;
}

/* ==========================================================
   STICKY HEADER — item 4
   ========================================================== */
@media (min-width: 992px) {
  .table-container .table-responsive { overflow: visible; }
}
.table-container thead th,
.bootstrap-table thead th,
.table thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: var(--gray-50, #fafafa) !important;
  box-shadow: inset 0 -1px 0 var(--gray-300, #e0e0e0);
}

/* Cores oficiais dos Fornecedores */
.bg-xbz { 
    background-color: #003B6F !important; 
    color: #ffffff !important; 
}
.bg-spot { 
    background-color: #35A670 !important; 
    color: #ffffff !important; 
}
.bg-asia { 
    background-color: #c0392b !important; 
    color: #ffffff !important; 
}