/* ============================================================
   DP Amorix — global.css
   Variáveis, reset, componentes base reutilizáveis
   Versão 1.0 — Maio 2026
   ============================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Variáveis globais ── */
:root {
  /* Backgrounds */
  --bg:    #0f1117;
  --bg2:   #161b22;
  --card:  #1c2128;

  /* Bordas */
  --brd:   rgba(255, 255, 255, 0.08);

  /* Textos */
  --txt:   #e6edf3;
  --txt2:  #8b949e;

  /* Cores de acento */
  --blue:   #4f7ef8;
  --green:  #3fb950;
  --red:    #f85149;
  --yellow: #d29922;
  --orange: #f0883e;

  /* Backgrounds de acento (10–15% opacidade) */
  --blue-bg:   rgba(79,  126, 248, 0.12);
  --green-bg:  rgba(63,  185, 80,  0.12);
  --red-bg:    rgba(248, 81,  73,  0.12);
  --yellow-bg: rgba(210, 153, 34,  0.12);
  --orange-bg: rgba(240, 136, 62,  0.12);

  /* Layout */
  --sidebar-w: 230px;
  --radius-card: 12px;
  --radius-btn:  8px;
  --radius-input: 8px;

  /* Sombras */
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);

  /* Transição padrão */
  --trans: 0.18s ease;
}

/* ── Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--txt);
  -webkit-font-smoothing: antialiased;
  overflow: hidden; /* menu lateral fixo */
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { list-style: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; display: block; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); }

/* ════════════════════════════════════════════════
   LAYOUT PRINCIPAL
   ════════════════════════════════════════════════ */

.app-shell {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--brd);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--brd);
}

.sidebar-logo .logo-icon {
  width: 34px;
  height: 34px;
  background: var(--blue);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-logo .logo-text {
  display: flex;
  flex-direction: column;
}

.sidebar-logo .logo-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--txt);
  line-height: 1.2;
}

.sidebar-logo .logo-sub {
  font-size: 10px;
  color: var(--txt2);
  font-weight: 400;
}

/* Menu nav */
.sidebar-nav {
  flex: 1;
  padding: 10px 0;
}

.nav-section {
  padding: 14px 14px 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--txt2);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  margin: 1px 6px;
  border-radius: 7px;
  color: var(--txt2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--trans), color var(--trans);
  white-space: nowrap;
}

.nav-item i {
  width: 16px;
  text-align: center;
  font-size: 13px;
  flex-shrink: 0;
}

.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--txt);
}

.nav-item.active {
  background: var(--blue-bg);
  color: var(--blue);
}

/* Rodapé do sidebar */
.sidebar-footer {
  border-top: 1px solid var(--brd);
  padding: 12px 10px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border-radius: 8px;
  transition: background var(--trans);
}

.user-info:hover { background: rgba(255,255,255,0.05); cursor: pointer; }

.user-avatar {
  width: 30px;
  height: 30px;
  background: var(--blue-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--blue);
  font-weight: 700;
  flex-shrink: 0;
}

.user-details { flex: 1; min-width: 0; }
.user-name { font-size: 12px; font-weight: 600; color: var(--txt); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 10px; color: var(--txt2); }

/* ── Main content ── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.page-frame {
  flex: 1;
  overflow-y: auto;
  padding: 28px 28px 40px;
}

/* ════════════════════════════════════════════════
   TELA DE LOGIN
   ════════════════════════════════════════════════ */

.login-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.login-box {
  width: 100%;
  max-width: 380px;
  background: var(--bg2);
  border: 1px solid var(--brd);
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: var(--shadow);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo .icon {
  width: 52px;
  height: 52px;
  background: var(--blue);
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 14px;
}

.login-logo h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--txt);
}

.login-logo p {
  font-size: 13px;
  color: var(--txt2);
  margin-top: 4px;
}

.login-error {
  background: var(--red-bg);
  border: 1px solid rgba(248,81,73,0.25);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--red);
  margin-bottom: 16px;
  display: none;
}
.login-error.show { display: block; }

/* ════════════════════════════════════════════════
   COMPONENTES — CARDS
   ════════════════════════════════════════════════ */

.card {
  background: var(--bg2);
  border: 1px solid var(--brd);
  border-radius: var(--radius-card);
  padding: 20px 22px;
}

.card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--txt);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.card-title i {
  color: var(--blue);
  font-size: 14px;
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg2);
  border: 1px solid var(--brd);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color var(--trans);
}

.kpi-card:hover { border-color: rgba(255,255,255,0.15); }

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--txt2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--txt);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.kpi-sub {
  font-size: 11px;
  color: var(--txt2);
}

.kpi-card.blue  .kpi-value { color: var(--blue); }
.kpi-card.green .kpi-value { color: var(--green); }
.kpi-card.red   .kpi-value { color: var(--red); }
.kpi-card.yellow .kpi-value { color: var(--yellow); }

/* ════════════════════════════════════════════════
   COMPONENTES — BOTÕES
   ════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-btn);
  font-size: 13px;
  font-weight: 600;
  border: none;
  transition: all var(--trans);
  white-space: nowrap;
  line-height: 1;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
}
.btn-primary:hover { background: #3a68e0; }

.btn-success {
  background: var(--green);
  color: #fff;
}
.btn-success:hover { background: #32a244; }

.btn-danger {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid rgba(248,81,73,0.25);
}
.btn-danger:hover { background: rgba(248,81,73,0.2); }

.btn-ghost {
  background: rgba(255,255,255,0.05);
  color: var(--txt2);
  border: 1px solid var(--brd);
}
.btn-ghost:hover { background: rgba(255,255,255,0.09); color: var(--txt); }

.btn-sm {
  padding: 5px 11px;
  font-size: 12px;
}

.btn-icon {
  padding: 7px 9px;
  background: rgba(255,255,255,0.05);
  color: var(--txt2);
  border: 1px solid var(--brd);
  border-radius: var(--radius-btn);
  transition: all var(--trans);
}
.btn-icon:hover { background: rgba(255,255,255,0.09); color: var(--txt); }

/* ════════════════════════════════════════════════
   COMPONENTES — FORMULÁRIOS
   ════════════════════════════════════════════════ */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--txt2);
}

.form-control {
  background: var(--card);
  border: 1px solid var(--brd);
  border-radius: var(--radius-input);
  color: var(--txt);
  padding: 9px 12px;
  font-size: 13px;
  transition: border-color var(--trans);
  width: 100%;
  outline: none;
}

.form-control:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(79,126,248,0.15);
}

.form-control::placeholder { color: var(--txt2); opacity: 0.6; }

select.form-control { cursor: pointer; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

/* ════════════════════════════════════════════════
   COMPONENTES — TABELAS
   ════════════════════════════════════════════════ */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-card);
  border: 1px solid var(--brd);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  background: var(--card);
  padding: 11px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--txt2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  border-bottom: 1px solid var(--brd);
}

thead th.right { text-align: right; }
thead th.center { text-align: center; }

tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background var(--trans);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.03); }

tbody td {
  padding: 11px 14px;
  font-size: 13px;
  color: var(--txt);
  vertical-align: middle;
}

tbody td.right { text-align: right; font-variant-numeric: tabular-nums; }
tbody td.center { text-align: center; }
tbody td.muted { color: var(--txt2); }

/* Totalizador */
tfoot td {
  padding: 11px 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--txt);
  border-top: 1px solid var(--brd);
  background: var(--card);
}

tfoot td.right { text-align: right; font-variant-numeric: tabular-nums; }

/* Toolbar da tabela */
.table-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-box i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--txt2);
  font-size: 12px;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  background: var(--card);
  border: 1px solid var(--brd);
  border-radius: var(--radius-input);
  color: var(--txt);
  font-size: 13px;
  outline: none;
  transition: border-color var(--trans);
}

.search-box input:focus { border-color: var(--blue); }
.search-box input::placeholder { color: var(--txt2); }

/* ════════════════════════════════════════════════
   COMPONENTES — BADGES
   ════════════════════════════════════════════════ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-green  { background: var(--green-bg);  color: var(--green); }
.badge-red    { background: var(--red-bg);    color: var(--red); }
.badge-blue   { background: var(--blue-bg);   color: var(--blue); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge-orange { background: var(--orange-bg); color: var(--orange); }
.badge-gray   { background: rgba(139,148,158,0.12); color: var(--txt2); }

/* ════════════════════════════════════════════════
   COMPONENTES — SKELETON LOADING
   ════════════════════════════════════════════════ */

.skel {
  height: 16px;
  background: linear-gradient(90deg, var(--bg2) 25%, var(--card) 50%, var(--bg2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
}

.skel-text { height: 14px; }
.skel-title { height: 20px; width: 60%; }
.skel-circle { width: 36px; height: 36px; border-radius: 50%; }
.skel-btn { height: 34px; width: 100px; }

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skel-row td { padding: 12px 14px; }

/* ════════════════════════════════════════════════
   COMPONENTES — TOAST
   ════════════════════════════════════════════════ */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--card);
  border: 1px solid var(--brd);
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--txt);
  display: flex;
  align-items: center;
  gap: 9px;
  box-shadow: var(--shadow);
  z-index: 9999;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: 340px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.toast.ok   { border-left: 3px solid var(--green); }
.toast.ok i { color: var(--green); }
.toast.err  { border-left: 3px solid var(--red); }
.toast.err i { color: var(--red); }
.toast.inf  { border-left: 3px solid var(--blue); }
.toast.inf i { color: var(--blue); }
.toast.warn { border-left: 3px solid var(--yellow); }
.toast.warn i { color: var(--yellow); }

/* ════════════════════════════════════════════════
   COMPONENTES — MODAL
   ════════════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg2);
  border: 1px solid var(--brd);
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  transform: scale(0.96) translateY(10px);
  transition: transform 0.2s ease;
}

.modal-overlay.open .modal { transform: scale(1) translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--brd);
}

.modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--txt);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-title i { color: var(--blue); }

.modal-close {
  background: none;
  border: none;
  color: var(--txt2);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: color var(--trans), background var(--trans);
}

.modal-close:hover { color: var(--txt); background: rgba(255,255,255,0.07); }

.modal-body { padding: 22px; }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--brd);
}

/* ════════════════════════════════════════════════
   COMPONENTES — PAGE HEADER
   ════════════════════════════════════════════════ */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header-left { display: flex; flex-direction: column; gap: 3px; }

.page-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--txt);
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-title i { color: var(--blue); font-size: 18px; }

.page-subtitle {
  font-size: 13px;
  color: var(--txt2);
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ════════════════════════════════════════════════
   COMPONENTES — EMPTY STATE
   ════════════════════════════════════════════════ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 12px;
  color: var(--txt2);
}

.empty-state i {
  font-size: 40px;
  opacity: 0.3;
}

.empty-state p {
  font-size: 14px;
  font-weight: 500;
}

/* ════════════════════════════════════════════════
   COMPONENTES — ALERT / BANNER
   ════════════════════════════════════════════════ */

.alert {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}

.alert i { margin-top: 1px; flex-shrink: 0; }
.alert-danger  { background: var(--red-bg);    border: 1px solid rgba(248,81,73,0.2);  color: var(--red); }
.alert-warning { background: var(--yellow-bg); border: 1px solid rgba(210,153,34,0.2); color: var(--yellow); }
.alert-info    { background: var(--blue-bg);   border: 1px solid rgba(79,126,248,0.2); color: var(--blue); }
.alert-success { background: var(--green-bg);  border: 1px solid rgba(63,185,80,0.2);  color: var(--green); }

/* ════════════════════════════════════════════════
   COMPONENTES — TABS
   ════════════════════════════════════════════════ */

.tabs {
  display: flex;
  border-bottom: 1px solid var(--brd);
  gap: 0;
  margin-bottom: 20px;
}

.tab-btn {
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--txt2);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: all var(--trans);
  white-space: nowrap;
}

.tab-btn:hover { color: var(--txt); }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ════════════════════════════════════════════════
   UTILITÁRIOS
   ════════════════════════════════════════════════ */

.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-yellow { color: var(--yellow); }
.text-blue   { color: var(--blue); }
.text-muted  { color: var(--txt2); }

.font-mono { font-variant-numeric: tabular-nums; }
.font-bold  { font-weight: 700; }
.font-sm    { font-size: 12px; }

.flex        { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8       { gap: 8px; }
.gap-12      { gap: 12px; }

.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.w-full  { width: 100%; }
.hidden  { display: none !important; }

/* ════════════════════════════════════════════════
   RESPONSIVO — Mobile
   ════════════════════════════════════════════════ */

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    position: fixed;
    left: -230px;
    top: 0;
    height: 100vh;
    width: 230px;
    transition: left 0.25s ease;
    z-index: 200;
  }

  .sidebar.open {
    left: 0;
    box-shadow: 4px 0 20px rgba(0,0,0,0.5);
  }

  .page-frame { padding: 16px; }

  .kpi-grid { grid-template-columns: repeat(2, 1fr); }

  .table-toolbar { flex-direction: column; align-items: stretch; }

  .page-header { flex-direction: column; align-items: flex-start; }
}
