/* ============================================================
   ADN Flow — main.css
   Estilos globais: página anônima, card, formulários, botões
   ============================================================ */

/* ── Página anônima (login, esqueci senha) ── */
body.welcome-anonymous {
  background: var(--mm-bg);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.page-anonymous {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.container-tight {
  width: 100%;
  max-width: 480px;
}

/* Logo acima do card */
.adn-logo-link {
  display: inline-block;
  text-decoration: none;
  margin-bottom: 1.5rem;
}
.adn-logo-img {
  width: 110px;
  height: 110px;
  object-fit: cover;
  border-radius: 50%;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.3));
}

/* ── Card (equivalente ao .card.card-md do GLPI/Tabler) ── */
.card {
  background: var(--surface);
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,.1);
  box-shadow: 0 4px 24px rgba(0,0,0,.18);
  overflow: hidden;
}
/* header vazio é oculto — igual ao GLPI */
.card-header:empty { display: none; }
.card-header {
  background: var(--card-cap);
  border-bottom: 1px solid var(--border);
  padding: 10px 1rem;
  font-size: 13px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 8px; min-height: 40px;
}
.card-title {
  font-size: 18px; font-weight: 700; color: var(--text);
  letter-spacing: -0.3px; margin-bottom: 1.25rem;
}
.card-body { padding: 1.5rem 2rem 1.5rem; }

/* ── Formulário ── */
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; }

.form-label {
  display: block;
  font-size: 13px; font-weight: 600; color: var(--text);
  margin-bottom: 4px;
}
.form-control {
  display: block; width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border); border-radius: 4px;
  font-size: 13.5px; color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}
.form-control::placeholder { color: #adb5bd; }

/* Checkbox */
.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-check-input {
  width: 15px; height: 15px;
  border: 1.5px solid var(--border); border-radius: 3px;
  cursor: pointer; accent-color: var(--primary); flex-shrink: 0;
}
.form-check-label { font-size: 14px; color: var(--text); cursor: pointer; }

/* ── Botões ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border-radius: 4px;
  font-size: 13px; font-weight: 600;
  border: none; cursor: pointer;
  transition: filter .12s, background .12s;
  text-decoration: none; font-family: inherit;
}
.btn-primary { background: var(--primary); color: var(--primary-fg); }
.btn-primary:hover { filter: brightness(.92); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.w-100 { width: 100%; }
.form-footer { margin-top: 1rem; }

/* ── Alertas ── */
.alert { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 4px; font-size: 13px; margin-bottom: 1.25rem; }
.alert-danger  { background: rgba(239,68,68,.08);  border: 1px solid rgba(239,68,68,.25);  color: #b91c1c; }
.alert-success { background: rgba(34,197,94,.08);  border: 1px solid rgba(34,197,94,.25);  color: #15803d; }
.alert-warning { background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.25); color: #b45309; }

/* Rodapé na página anônima — sempre legível sobre o fundo da sidebar */
body.welcome-anonymous .text-muted { color: rgba(255,255,255,.65); }

/* ── Seletor de paleta (estilo botão GLPI entity selector) ── */
.palette-switcher {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 999;
  font-family: "Inter", sans-serif;
}
.palette-toggle {
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(0,0,0,.12);
  color: #1e293b;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px 5px 8px; border-radius: 4px;
  font-size: 12.5px; font-weight: 500; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
  transition: background .12s, box-shadow .12s;
  white-space: nowrap;
}
.palette-toggle:hover {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.palette-toggle svg { width:14px; height:14px; flex-shrink:0; color:#606f91; }
.palette-toggle .chevron { width:12px; height:12px; color:#606f91; margin-left:2px; }

.palette-dropdown {
  display: none;
  position: absolute; bottom: calc(100% + 4px); right: 0;
  background: #fff;
  border: 1px solid #dde1ea;
  border-radius: 4px;
  box-shadow: 0 4px 24px rgba(0,0,0,.14);
  min-width: 170px;
  overflow: hidden;
}
.palette-switcher.open .palette-dropdown { display: block; }

.palette-dropdown-header {
  padding: 6px 12px 5px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: #8a95ab;
  border-bottom: 1px solid #eaecf0;
}

.palette-option {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 7px 12px;
  background: none; border: none; cursor: pointer;
  font-size: 13px; color: #1e293b; text-align: left;
  transition: background .1s;
  font-family: inherit;
}
.palette-option:hover { background: #f5f7fb; }
.palette-option.active {
  font-weight: 600;
  background: #f0f4ff;
  color: #3730a3;
}
.palette-option.active .palette-swatch-check { display: block; }
.palette-swatch-check { display: none; margin-left: auto; color: #3730a3; }
.palette-swatch {
  width: 14px; height: 14px; border-radius: 3px;
  border: 1px solid rgba(0,0,0,.12); flex-shrink: 0;
}

/* ── Páginas autenticadas ── */
.page-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.3px;
}
.form-group { margin-bottom: 1rem; }

/* ── Botões extras ── */
.btn-danger-ghost {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(239,68,68,.3);
}
.btn-danger-ghost:hover { background: rgba(239,68,68,.08); }

/* ── Tabela de dados ── */
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table thead tr { background: var(--surface2); }
.data-table th {
  padding: 8px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface2); }
.data-table td a { color: var(--mm-bg); font-weight: 600; text-decoration: none; }
.data-table td a:hover { text-decoration: underline; }
.td-muted { color: var(--muted); }
.td-actions { text-align: right; white-space: nowrap; display: flex; gap: 4px; justify-content: flex-end; }
.td-empty { text-align: center; color: var(--muted); padding: 32px 16px !important; }

/* ── Badges de status ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-ok  { background: rgba(34,197,94,.15); color: #16a34a; }
.badge-off { background: rgba(156,163,175,.15); color: var(--muted); }
@media (prefers-color-scheme: dark) {
  .badge-ok  { background: rgba(34,197,94,.2);  color: #4ade80; }
  .badge-off { background: rgba(156,163,175,.15); color: var(--muted); }
}
:root[data-theme="dark"] .badge-ok  { background: rgba(34,197,94,.2);  color: #4ade80; }
:root[data-theme="dark"] .badge-off { background: rgba(156,163,175,.15); color: var(--muted); }
:root[data-theme="light"] .badge-ok  { background: rgba(34,197,94,.15); color: #16a34a; }
:root[data-theme="light"] .badge-off { background: rgba(156,163,175,.15); color: var(--muted); }

/* ── Utilitários ── */
.text-center { text-align: center; }
.text-muted  { color: var(--muted); }
.small       { font-size: 12px; }
.mt-3        { margin-top: .75rem; }
.mb-4        { margin-bottom: 1rem; }

/* ── Abas — equivalente ao nav-tabs do GLPI/Bootstrap ── */
.nav-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 0;
  padding: 0 1rem;
  background: var(--surface);
  flex-wrap: wrap;
}
.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .12s, border-color .12s;
}
.nav-tab:hover { color: var(--text); }
.nav-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.nav-tab svg { width: 14px; height: 14px; flex-shrink: 0; }

.tab-content { /* contêiner das abas */ }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Layout 2 colunas de formulário — igual ao col-6 do GLPI ── */
.fields-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1.5rem;
}
.fields-row.fields-row-full { grid-template-columns: 1fr; }
@media (max-width: 640px) {
  .fields-row { grid-template-columns: 1fr; }
}
.field-col { /* célula de campo — sem margin extra, usa gap do grid */ }

/* Título de seção dentro de formulário — igual ao largeTitle do GLPI */
.fields-section-title {
  grid-column: 1 / -1;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  padding: 12px 0 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

/* Card com abas — o card-header vira nav-tabs */
.card-with-tabs > .nav-tabs {
  border-radius: 4px 4px 0 0;
  border-bottom: 1px solid var(--border);
}
.card-with-tabs > .tab-content > .tab-pane.active {
  display: block;
}

/* ── Botão secundário ── */
.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }
