/* =====================================================
   Painel Encurtador — layout AdminLTE-like + modo escuro
   ===================================================== */

:root {
  --sidebar-w: 240px;
  --sidebar-bg: #1e2836;
  --sidebar-fg: #c2c7d0;
  --sidebar-active: #1e6cf0;
  --topbar-bg: #ffffff;
  --content-bg: #f4f6f9;
  --card-bg: #ffffff;
  --texto: #212529;
}

[data-theme="dark"] {
  --topbar-bg: #1c2430;
  --content-bg: #131a23;
  --card-bg: #1c2430;
  --texto: #dee2e6;
  color-scheme: dark;
}

body { background: var(--content-bg); color: var(--texto); }

[data-theme="dark"] .card,
[data-theme="dark"] .dropdown-menu,
[data-theme="dark"] .modal-content { background: var(--card-bg); color: var(--texto); }
[data-theme="dark"] .card-header,
[data-theme="dark"] .card-footer { background: rgba(255,255,255,.03); border-color: rgba(255,255,255,.08); }
[data-theme="dark"] .card { border-color: rgba(255,255,255,.08); }
[data-theme="dark"] .table { color: var(--texto); --bs-table-bg: transparent; --bs-table-color: var(--texto); }
[data-theme="dark"] .table-hover > tbody > tr:hover > * { background: rgba(255,255,255,.04); color: var(--texto); }
[data-theme="dark"] .table th, [data-theme="dark"] .table td { border-color: rgba(255,255,255,.08); }
[data-theme="dark"] .form-control, [data-theme="dark"] .form-select, [data-theme="dark"] .input-group-text {
  background: #131a23; color: var(--texto); border-color: rgba(255,255,255,.15);
}
[data-theme="dark"] .form-control::placeholder { color: #6c757d; }
[data-theme="dark"] .text-muted { color: #8b94a0 !important; }
[data-theme="dark"] .btn-outline-secondary { color: #aab2bd; border-color: #4a5563; }
[data-theme="dark"] .btn-outline-secondary:hover { background: #2a3546; color: #fff; }
[data-theme="dark"] .list-group-item { background: transparent; color: var(--texto); border-color: rgba(255,255,255,.08); }
[data-theme="dark"] .bg-body-secondary { background: #131a23 !important; color: var(--texto); }
[data-theme="dark"] .page-link { background: var(--card-bg); border-color: rgba(255,255,255,.15); color: var(--texto); }
[data-theme="dark"] .alert-warning { background: #3a2f14; color: #ffd97a; border-color: #6b5518; }

/* ---------- estrutura ---------- */
.wrapper { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); background: var(--sidebar-bg); color: var(--sidebar-fg);
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 1040;
  transition: margin-left .25s; overflow-y: auto;
}
.sidebar.recolhida { margin-left: calc(var(--sidebar-w) * -1); }

.sidebar-brand {
  display: flex; align-items: center; gap: 8px; padding: 18px 20px;
  font-size: 20px; font-weight: 700; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand .brand-logo { max-height: 36px; max-width: 180px; }

.sidebar-menu { list-style: none; padding: 12px 8px; margin: 0; }
.sidebar-menu a {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 2px;
  color: var(--sidebar-fg); text-decoration: none; border-radius: 8px; font-size: 14.5px;
}
.sidebar-menu a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-menu a.active { background: var(--sidebar-active); color: #fff; }
.sidebar-menu i { font-size: 17px; width: 20px; text-align: center; }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; transition: margin-left .25s; }
.main.expandida { margin-left: 0; }

.topbar {
  display: flex; align-items: center; background: var(--topbar-bg);
  padding: 10px 20px; box-shadow: 0 1px 4px rgba(0,0,0,.08); position: sticky; top: 0; z-index: 1030;
}
.btn-icon { border: 0; background: transparent; font-size: 20px; color: inherit; }
.btn-icon:hover { opacity: .7; }
.avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }

.content { flex: 1; padding: 24px; }
.footer { padding: 12px 24px; font-size: 13px; color: #8b94a0; text-align: center; }

/* ---------- cards de estatística ---------- */
.stat-card { border: 0; border-left: 4px solid #1e6cf0; }
.stat-card .card-body { position: relative; }
.stat-icon { position: absolute; right: 16px; top: 12px; font-size: 32px; opacity: .18; }
.stat-value { font-size: 26px; font-weight: 800; line-height: 1.2; }
.stat-label { font-size: 13px; color: #8b94a0; }
.stat-primary   { border-left-color: #1e6cf0; }
.stat-success   { border-left-color: #22a06b; }
.stat-warning   { border-left-color: #e8a013; }
.stat-info      { border-left-color: #17a2b8; }
.stat-secondary { border-left-color: #6c757d; }

.top-item { padding: 6px 10px; }
.top-item .progress { background: rgba(128,128,128,.15); }

/* ---------- login ---------- */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e3a5f 0%, #0d1b2a 100%); padding: 16px;
}
.auth-card { width: 100%; max-width: 400px; border: 0; border-radius: 12px; }
[data-theme="dark"] .auth-card { background: #1c2430; color: #dee2e6; }

/* ---------- responsivo ---------- */
@media (max-width: 991px) {
  .sidebar { margin-left: calc(var(--sidebar-w) * -1); }
  .sidebar.aberta { margin-left: 0; box-shadow: 4px 0 24px rgba(0,0,0,.4); }
  .main { margin-left: 0; }
}
