/* ============================================
   DASHBOARD ADMIN
   ============================================ */

.admin-header {
  background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%);
  border-bottom: 2px solid rgba(255, 215, 0, 0.35);
  padding: 0.9rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

.admin-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.header-content {
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Botão hamburger – visível só em mobile */
.header-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: var(--border-radius-sm);
  transition: background 0.2s;
}
.header-menu-toggle:hover {
  background: rgba(255, 215, 0, 0.15);
  color: var(--primary);
}
.header-title {
  flex: 1;
  min-width: 0;
}

.header-logo {
  width: 165px;
  height: 60px;
}

.header-left h2 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-info {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

@media (max-width: 992px) {
  .header-menu-toggle {
    display: flex;
  }
  .header-left h2.header-title {
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
  }
  .header-content {
    padding: 0 1rem;
    gap: 0.5rem;
  }
  .header-right .user-info {
    display: none;
  }
  /* Botão sair sempre visível no mobile, área de toque maior */
  .header-right .btn-icon {
    min-width: 44px;
    min-height: 44px;
    padding: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* Header mobile: estilo tech, bordas douradas */
@media (max-width: 768px) {
  .admin-header {
    border-bottom: 1px solid var(--primary);
    box-shadow: 0 1px 0 rgba(255, 215, 0, 0.2);
  }
  .admin-header::before {
    height: 2px;
    background: linear-gradient(
      90deg,
      var(--primary),
      transparent,
      var(--primary)
    );
  }
  .header-logo {
    display: none;
  }
  .header-left h2.header-title {
    font-size: 1rem;
    max-width: 140px;
  }
}

/* ============================================
   NAVEGAÇÃO
   ============================================ */

.admin-nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0;
  overflow-x: auto;
}

.admin-nav {
  display: flex;
  gap: 0;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--bg-hover);
}

/* ============================================
   CONTEÚDO
   ============================================ */

/* .admin-content movido para sidebar.css - layout com sidebar */

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.content-header h3 {
  font-size: 1.75rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.content-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.content-header-flex {
  flex-wrap: wrap;
  align-items: center;
}

.content-header-flex .header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.content-header-flex .header-actions .filter-input {
  min-width: 200px;
  padding: 0.5rem 0.75rem;
}

/* ============================================
   PRODUTOS – ACORDEÃO POR CATEGORIA
   ============================================ */

.produtos-accordion-container {
  max-width: 900px;
}

.produtos-accordion-item {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  margin-bottom: 0.5rem;
  overflow: hidden;
  background: var(--bg-card);
}

.produtos-accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--bg-dark);
  border: none;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s;
}

.produtos-accordion-header:hover {
  background: var(--bg-hover);
}

.produtos-accordion-header.active {
  background: rgba(255, 215, 0, 0.12);
  border-bottom: 1px solid var(--border-color);
}

.produtos-accordion-title {
  flex: 1;
}

.produtos-accordion-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 400;
}

.produtos-accordion-icon {
  flex-shrink: 0;
  transition: transform 0.2s;
}

.produtos-accordion-header.active .produtos-accordion-icon {
  transform: rotate(180deg);
}

.produtos-accordion-body {
  padding: 1rem 1.25rem;
  background: var(--bg-card);
}

.produtos-accordion-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  padding: 0.75rem;
  border-radius: var(--border-radius-sm);
  background: rgba(255, 215, 0, 0.06);
  border: 1px solid rgba(255, 215, 0, 0.2);
}

/* Botão "Adicionar produto" — destaque visual (sobrescreve .btn-sm) */
.produtos-accordion-toolbar .btn-add-product,
.produtos-accordion-toolbar button.btn-add-product,
button.btn-add-product {
  font-weight: 700 !important;
  padding: 0.6rem 1.25rem !important;
  min-height: 40px;
  display: inline-flex !important;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #ffd700 0%, #d4a017 100%) !important;
  color: #1a1a1a !important;
  border: none !important;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(255, 215, 0, 0.45);
  cursor: pointer;
  font-size: 1rem !important;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}
.produtos-accordion-toolbar .btn-add-product:hover,
.produtos-accordion-toolbar button.btn-add-product:hover,
button.btn-add-product:hover {
  background: linear-gradient(135deg, #ffe44d 0%, #ffd700 100%) !important;
  color: #1a1a1a !important;
  box-shadow: 0 4px 16px rgba(255, 215, 0, 0.55);
  transform: translateY(-2px);
}
.produtos-accordion-toolbar .btn-add-product svg,
button.btn-add-product svg {
  flex-shrink: 0;
  stroke-width: 2.5;
  width: 18px;
  height: 18px;
}

.produtos-accordion-toolbar .btn-danger-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
}

.produtos-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.produtos-list-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border-color);
}

.produtos-list-item:last-child {
  border-bottom: none;
}

.produtos-list-nome {
  flex: 1;
  font-weight: 500;
}

.produtos-list-unidade {
  font-size: 0.85rem;
  color: var(--text-muted);
  min-width: 3rem;
}

.produtos-list-actions {
  display: flex;
  gap: 0.25rem;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}

.btn-icon-sm {
  padding: 0.35rem 0.5rem;
  font-size: 1rem;
  min-width: 32px;
}

.btn-danger-sm:hover {
  color: var(--danger);
  background: rgba(220, 53, 69, 0.15);
}

.modal-content-sm {
  max-width: 420px;
}

/* Modal de confirmação de exclusão */
.modal-confirm-danger .modal-header {
  border-bottom-color: rgba(220, 53, 69, 0.3);
}
.modal-confirm-danger .modal-header h3 {
  color: var(--danger, #dc3545);
}
.modal-confirm-msg {
  margin: 0;
  line-height: 1.5;
  color: var(--text-muted);
}
.modal-confirm-danger .btn-danger {
  min-width: 140px;
}

/* ============================================
   CARDS DE PRODUTOS/CATEGORIAS
   ============================================ */

.produto-card,
.categoria-card {
  position: relative;
}

.card-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  padding: 0.25rem 0.75rem;
  background: var(--primary);
  color: var(--bg-dark);
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-inativa {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.15rem 0.5rem;
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
}

.card-meta {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.card-meta span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* ============================================
   RESPONSIVIDADE
   ============================================ */

@media (max-width: 768px) {
  .header-content {
    gap: 1rem;
  }

  .content-header {
    flex-direction: column;
  }

  .admin-nav {
    padding: 0 1rem;
  }

  .nav-tab {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
  }
}

/* ============================================
   RESPONSIVIDADE TOTAL (320px → 4K)
   Cole no FINAL do CSS
   ============================================ */

/* 2) Altura e padding do header fluido */
.admin-header {
  padding: clamp(0.6rem, 1.5vw, 0.9rem) 0;
}

.header-left h2 {
  font-size: clamp(0.95rem, 1.6vw, 1.35rem);
  line-height: 1.1;
}

/* 4) Header-right não estoura */
.header-right {
  gap: clamp(0.5rem, 1.2vw, 1rem);
}

/* 5) Título não quebra layout e respeita telas pequenas */
.header-title,
.header-left h2.header-title {
  min-width: 0;
  max-width: clamp(140px, 40vw, 520px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 6) Nav tabs: melhor scroll em mobile e não "quebra" */
.admin-nav {
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
}
.admin-nav::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.nav-tab {
  padding: clamp(0.7rem, 1.3vw, 1rem) clamp(0.9rem, 1.8vw, 1.5rem);
  font-size: clamp(0.85rem, 1.2vw, 0.95rem);
}

/* 7) Conteúdo: títulos e margens fluidos */
.content-header {
  margin-bottom: clamp(1rem, 3vw, 2rem);
  gap: clamp(0.75rem, 2vw, 1rem);
}

.content-header h3 {
  font-size: clamp(1.2rem, 2.5vw, 1.75rem);
}

.content-header p {
  font-size: clamp(0.9rem, 1.3vw, 0.95rem);
}

/* 8) Accordion container não trava e encaixa em telas pequenas */
.produtos-accordion-container {
  width: 100%;
  max-width: 100%;
}

/* 9) Toolbar: em telas pequenas vira “stack” e fica utilizável */
.produtos-accordion-toolbar {
  padding: clamp(0.6rem, 1.5vw, 0.75rem);
  gap: clamp(0.45rem, 1.2vw, 0.6rem);
}

/* Inputs e botões ficam 100% quando necessário */
.content-header-flex .header-actions .filter-input {
  width: min(320px, 100%);
  min-width: 0;
}

/* 10) Itens da lista: no mobile quebra em linhas sem esmagar */
.produtos-list-item {
  flex-wrap: wrap;
  gap: 0.5rem;
}

.produtos-list-unidade {
  min-width: auto;
}

/* 11) Botões: área de toque sempre boa */
.btn-sm,
.btn-icon-sm,
.header-menu-toggle,
.header-right .btn-icon {
  min-height: 44px;
}

/* 12) Ajuste fino para telas MUITO pequenas (320–360px) */
@media (max-width: 360px) {
  .header-left {
    gap: 0.5rem;
  }

  .header-left h2.header-title {
    max-width: 120px;
  }

  .nav-tab {
    padding: 0.65rem 0.85rem;
  }

  .produtos-accordion-header {
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
  }

  .produtos-accordion-body {
    padding: 0.85rem 1rem;
  }
}
