/* ============================================================
   CUSTOM PROPERTIES (Design Tokens)
   ============================================================ */
:root {
  /* Paleta principal */
  --hue-primary: 250;
  --bs-info: #6f42c1;
  --bs-info-rgb: 111, 66, 193;

  /* Cores neutras */
  --neutral-50: hsl(220, 20%, 98%);
  --neutral-100: hsl(220, 15%, 95%);
  --neutral-200: hsl(220, 10%, 90%);
  --neutral-800: hsl(220, 15%, 20%);
  --neutral-900: hsl(220, 15%, 10%);

  /* Bordas arredondadas */
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.25rem;

  /* Transições */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Tipografia fluida */
  --font-size-base: clamp(0.875rem, 0.8rem + 0.25vw, 1rem);
}

/* Tema escuro */
html[data-bs-theme="dark"] {
  --neutral-50: hsl(220, 15%, 12%);
  --neutral-100: hsl(220, 15%, 15%);
  --neutral-200: hsl(220, 10%, 25%);
  --neutral-800: hsl(220, 15%, 90%);
  --neutral-900: hsl(220, 15%, 95%);
}

/* ============================================================
   RESET & TIPOGRAFIA (mobile-first)
   ============================================================ */
*,
::after,
::before {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: var(--font-size-base);
  line-height: 1.6;
  opacity: 1;
  margin: 0;
  background-color: var(--neutral-50);
  color: var(--neutral-800);
  -webkit-font-smoothing: antialiased;
}

a {
  cursor: pointer;
  text-decoration: none;
  font-family: 'Open Sans', sans-serif;
  transition: color var(--transition-fast);
}

li {
  display: list-item;
  text-align: -webkit-match-parent;
  unicode-bidi: isolate;
}

h4 {
  font-family: 'Open Sans', sans-serif;
  font-size: 1.275rem;
  color: var(--bs-emphasis-color);
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ============================================================
   SIDEBAR MODERNA - visual premium, mesma estrutura
   ============================================================ */
   
.wrapper {
  align-items: stretch;
  display: flex;
  width: 100%;
}

/* Container principal */
#sidebar {
  max-width: 264px;
  min-width: 264px;
  background: linear-gradient(180deg, #15171e 0%, #1d1f26 100%);
  transition: all 0.35s ease-in-out;
  border-right: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 1040;
  display: flex;
  flex-direction: column;
}

.main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  overflow: hidden;
  transition: all 0.35s ease-in-out;
  width: 100%;
}

/* Área do logotipo */
.sidebar-logo {
  padding: 1.5rem 1.25rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-logo a {
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.sidebar-logo a:hover {
  opacity: 0.9;
}

/* Navegação */
.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 1.25rem 0.75rem;
  flex: 1;
  overflow-y: auto;
}

/* Título de seção */
.sidebar-header {
  padding: 1.25rem 1.25rem 0.5rem;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.65rem;
  letter-spacing: 1.8px;
  color: rgba(191, 199, 217, 0.5);
  white-space: nowrap;
}

/* Links do menu */
a.sidebar-link {
  padding: 0.8rem 1rem;
  margin-bottom: 0.2rem;
  line-height: 20px;
  color: #a8b1c5;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 10px;
  position: relative;
  transition: all 0.25s ease;
}

/* Ícones dentro dos links (assume classes como .bi, .fa, .icon) */
a.sidebar-link i,
a.sidebar-link .icon {
  font-size: 1.15rem;
  width: 1.5rem;
  text-align: center;
  transition: transform 0.25s ease, color 0.25s ease;
}

/* Hover elegante */
a.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #ffffff;
  transform: translateX(2px);
}

a.sidebar-link:hover i,
a.sidebar-link:hover .icon {
  transform: scale(1.1);
  color: #ffffff;
}

/* Link ativo - destaque com barra lateral e fundo vidro */
a.active,
a.sidebar-link.active {
  color: #ffffff !important;
  background: rgba(79, 147, 255, 0.12);
  margin: 0 5px;
  border-radius: 10px;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(79, 147, 255, 0.25);
  position: relative;
}

/* Indicador lateral sutil no item ativo */
a.active::before,
a.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 24px;
  background: #4f93ff;
  border-radius: 0 4px 4px 0;
  box-shadow: 0 0 8px rgba(79, 147, 255, 0.5);
}

/* Seta de collapse mais suave */
.sidebar-link[data-bs-toggle="collapse"]::after {
  border: solid #a8b1c5;
  border-width: 0 0.1rem 0.1rem 0;
  content: "";
  display: inline-block;
  padding: 3px;
  position: absolute;
  right: 1.25rem;
  top: 1.35rem;
  transform: rotate(-135deg);
  transition: all 0.25s ease;
  opacity: 0.7;
}

.sidebar-link[data-bs-toggle="collapse"]:hover::after {
  border-color: #ffffff;
  opacity: 1;
}

.sidebar-link[data-bs-toggle="collapse"].collapsed::after {
  transform: rotate(45deg);
}

/* Sidebar recolhida - mantido igual */
#sidebar.collapsed {
  margin-left: -264px;
}

/* Comportamento mobile (original) */
@media (max-width: 767.98px) {
  .js-sidebar {
    margin-left: -264px;
  }

  #sidebar.collapsed {
    margin-left: 0;
  }

  .navbar,
  footer {
    width: 100vw;
  }
}

/* Scrollbar customizada na sidebar (caso tenha overflow) */
.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Rodapé da sidebar (se houver, opcional) */
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  color: #a8b1c5;
  font-size: 0.75rem;
}

/* ============================================================
   CONTEÚDO E CARDS MODERNOS
   ============================================================ */
.content {
  flex: 1;
  max-width: 100vw;
  width: 100vw;
  padding: 1.5rem;
}

@media (min-width:768px) {
  .content {
    max-width: auto;
    width: auto;
    padding: 2rem;
  }
}

.card {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  margin-bottom: 24px;
  border: none;
  border-radius: var(--radius-lg);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
  background-color: var(--bs-body-bg, white);
}

.card:hover {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--neutral-200);
  padding: 1rem 1.25rem;
  font-weight: 600;
}

.illustration {
  background-color: var(--bs-primary-bg-subtle);
  color: var(--bs-emphasis-color);
}

.illustration-img {
  max-width: 150px;
  width: 100%;
}

/* ============================================================
   THEME TOGGLE
   ============================================================ */
html[data-bs-theme="dark"] .theme-toggle .lightmode {
  display: none;
}

html[data-bs-theme="light"] .theme-toggle .darkmode {
  display: none;
}

/* ============================================================
   COMPONENTES UI
   ============================================================ */
.avatar {
  position: relative;
  display: inline-block;
}

.avatar .btn {
  position: absolute;
  bottom: 0;
  right: 5px;
  border-radius: 50%;
}

/* List group radio */
.list-group-radio .list-group-item {
  cursor: pointer;
  border-radius: .5rem;
  transition: background-color var(--transition-fast);
}

.list-group-radio .form-check-input {
  z-index: 2;
  margin-top: -.5em;
}

.list-group-radio .list-group-item:hover,
.list-group-radio .list-group-item:focus {
  background-color: var(--bs-secondary-bg);
}

.list-group-radio .form-check-input:checked + .list-group-item {
  background-color: var(--bs-body);
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 2px var(--bs-primary);
}

.list-group-radio .form-check-input[disabled] + .list-group-item,
.list-group-radio .form-check-input:disabled + .list-group-item {
  pointer-events: none;
  filter: none;
  opacity: .5;
}

/* #List1 modernizado */
#List1 .card-title {
  font-size: calc(1rem + 0.2vw);
}

#List1 .card-text {
  font-size: calc(0.9rem + 0.1vw);
}

#List1 .card-img-top {
  width: 100%;
  height: auto;
  max-height: 200px;
  object-fit: cover;
}

#List1 .card {
  border: none;
  transition: box-shadow 0.3s, transform 0.3s;
}

#List1 .card:hover {
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
  transform: translateY(-4px);
}

/* Upload area */
.upload-area {
  border: 2px dashed #dee2e6;
  cursor: pointer;
  transition: all 0.3s ease;
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  background: var(--neutral-50);
}

.upload-area:hover,
.upload-area.dragover {
  border-color: #0d6efd;
  background: rgba(13, 110, 253, 0.04);
  transform: scale(1.01);
}

/* Scrollbar fina */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-thumb {
  background: #adb5bd;
  border-radius: 10px;
}

/* ============================================================
   FORMULÁRIOS (com classes Bootstrap)
   ============================================================ */
.form-floating > .form-control,
.form-floating > .form-select {
  border-radius: var(--radius-md);
  border: 1px solid var(--neutral-200);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-floating > .form-control:focus,
.form-floating > .form-select:focus {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), 0.25);
}

.form-check-input:checked {
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
}

.form-check-input:focus {
  box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), 0.25);
}

/* Botões com efeito sutil */
.btn {
  border-radius: var(--radius-md);
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: all var(--transition-fast);
}

.btn:active {
  transform: scale(0.97);
}

/* ============================================================
   CHECKLIST MODERNA (UI/UX melhorado)
   ============================================================ */
.checklist-card {
  border: none;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
  transition: all 0.3s ease;
}

.checklist-card .card-header {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.checklist-item {
  border: none;
  border-left: 5px solid transparent;
  margin-bottom: 2px;
  transition: all 0.3s ease;
  background-color: white;
}

.checklist-item:hover {
  background-color: #f8f9fa;
  transform: translateX(3px);
}

.checklist-item.status-ok {
  border-left-color: #198754;
}

.checklist-item.status-pendente {
  border-left-color: #dc3545;
  background-color: #fff5f5;
}

.status-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* Botões de status unificados */
.btn-status {
  border-radius: 30px;
  font-weight: 500;
  font-size: 0.85rem;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  border: 2px solid transparent;
  background-color: white;
}

.btn-status:focus {
  box-shadow: 0 0 0 0.25rem rgba(13,110,253,0.15);
}

.btn-status-ok {
  border-color: #198754;
  color: #198754;
}

.btn-status-ok:hover,
.btn-status-ok.active {
  background-color: #198754;
  color: white;
  box-shadow: 0 4px 12px rgba(25,135,84,0.3);
}

.btn-status-pendente {
  border-color: #dc3545;
  color: #dc3545;
}

.btn-status-pendente:hover,
.btn-status-pendente.active {
  background-color: #dc3545;
  color: white;
  box-shadow: 0 4px 12px rgba(220,53,69,0.3);
}

/* Radio button escondido e estados checados */
.btn-check.status-radio {
  position: absolute;
  clip: rect(0,0,0,0);
  pointer-events: none;
}

.btn-check.status-radio:checked + .btn-status-ok {
  background-color: #198754;
  color: white;
  box-shadow: 0 4px 12px rgba(25,135,84,0.3);
}

.btn-check.status-radio:checked + .btn-status-pendente {
  background-color: #dc3545;
  color: white;
  box-shadow: 0 4px 12px rgba(220,53,69,0.3);
}

/* Pendência descrição */
.pendencia-descricao {
  margin-top: 1rem;
  transition: max-height 0.4s ease;
  overflow: hidden;
  max-height: 0;
}

.pendencia-descricao.show {
  max-height: 200px;
  margin-bottom: 0.5rem;
}

.pendencia-descricao textarea {
  border-radius: 10px;
  border: 1px solid #e0e0e0;
  padding: 0.75rem;
  font-size: 0.9rem;
  transition: border-color 0.2s;
  resize: vertical;
  min-height: 70px;
  background: #fff;
  box-shadow: inset 0 1px 4px rgba(0,0,0,0.02);
}

.pendencia-descricao textarea:focus {
  border-color: #dc3545;
  box-shadow: 0 0 0 0.2rem rgba(220,53,69,0.1);
}

.badge-regiao {
  background-color: rgba(255,255,255,0.7);
  backdrop-filter: blur(5px);
  padding: 0.5rem 1rem;
  border-radius: 30px;
  font-weight: 500;
  color: #495057;
}

/* Ícone animado */
.status-icon {
  transition: all 0.3s ease;
}

/* ============================================================
   DATATABLES ESTILIZADOS
   ============================================================ */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
  margin-bottom: 1rem;
}

.dataTables_wrapper .dataTables_filter input {
  border-radius: var(--radius-md);
  border: 1px solid var(--neutral-200);
  padding: 0.5rem 1rem;
  margin-left: 0.5rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: var(--radius-sm) !important;
  margin: 0 2px;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--neutral-200);
  background: white;
  color: var(--neutral-800) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--bs-primary) !important;
  border-color: var(--bs-primary) !important;
  color: white !important;
  font-weight: 600;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--neutral-100) !important;
  border-color: var(--neutral-200) !important;
}

table.dataTable {
  border-collapse: separate;
  border-spacing: 0;
  width: 100% !important;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}

table.dataTable thead th {
  background: var(--neutral-100);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  padding: 1rem;
  border-bottom: 2px solid var(--neutral-200);
}

table.dataTable tbody td {
  padding: 0.85rem 1rem;
  vertical-align: middle;
}

table.dataTable tbody tr:hover {
  background-color: rgba(var(--bs-primary-rgb), 0.03);
}

/* ============================================================
   MODAL COM TOQUE MODERNO
   ============================================================ */
.modal-content {
  border: none;
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* ============================================================
   SUPORTE A TEMA ESCURO
   ============================================================ */
html[data-bs-theme="dark"] .card {
  background-color: hsl(220, 15%, 15%);
  border: 1px solid hsl(220, 10%, 20%);
}

html[data-bs-theme="dark"] .form-control,
html[data-bs-theme="dark"] .form-select {
  background-color: hsl(220, 15%, 18%);
  border-color: hsl(220, 10%, 25%);
  color: white;
}

html[data-bs-theme="dark"] .checklist-item {
  background-color: var(--bs-dark-bg-subtle);
}

html[data-bs-theme="dark"] .btn-status {
  background-color: transparent;
}