/* ============================================================
   Gestão de Equipamentos — Bots & Kids / Semear Talentos / Grande Sábio
   Layout adaptado da app "Gestão CAF" (mesma estrutura de sidebar/topbar).
   ============================================================ */

:root {
  --sidebar-width: 220px;
  --topbar-height: 56px;
  --gs-blue: #1565c0;
  --gs-blue-light: #42a5f5;
  --gs-yellow: #ef6c00;
  --bg: #f5f6fa;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --text: #1a202c;
  --text-muted: #718096;
  --sidebar-bg: #102a43;
  --sidebar-text: #cfe3f7;
  --sidebar-active: #1565c0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

/* ---- SIDEBAR ---- */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width 0.2s ease, transform 0.25s ease;
  overflow: hidden;
}

.sidebar-logo {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.logo-text {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--gs-blue-light);
  letter-spacing: 0.3px;
}

.logo-sub {
  font-size: 11px;
  color: var(--sidebar-text);
  opacity: 0.6;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.sidebar-nav {
  padding: 12px 8px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  margin-bottom: 2px;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover { background: rgba(255,255,255,0.07); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.nav-item i { width: 18px; text-align: center; font-size: 14px; }

/* ---- SIDEBAR — utilizador / sair ---- */
.sidebar-user {
  padding: 12px 8px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--sidebar-text);
  padding: 4px 8px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user-info > i { font-size: 20px; opacity: 0.8; flex-shrink: 0; }
.sidebar-user-texto {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.sidebar-user-texto .sidebar-user-nome {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 11px;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  opacity: 0.85;
  padding: 10px 12px;
  margin-top: 4px;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}
.sidebar-logout:hover { color: #fff; opacity: 1; }

/* ---- MAIN ---- */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.25s;
}

/* ---- TOPBAR ---- */
.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 99;
}

.btn-menu {
  background: none; border: none; cursor: pointer;
  font-size: 18px; color: var(--text-muted); padding: 4px 8px;
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
  flex: 1;
}

/* ---- PAGE CONTENT ---- */
.page-content {
  padding: 24px;
  flex: 1;
}

/* ---- STAT CARDS ---- */
.stat-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07);
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-icon.bg-primary { background: #1976d2 !important; }
.stat-icon.bg-success { background: var(--gs-blue) !important; }
.stat-icon.bg-warning { background: var(--gs-yellow) !important; }
.stat-icon.bg-info    { background: #0288d1 !important; }
.stat-icon.bg-danger  { background: #c62828 !important; }

.stat-value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ---- CARDS ---- */
.card-stat {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* ---- CABEÇALHOS em maiúsculas: títulos de página e cabeçalhos de tabela ---- */
.topbar-title,
.page-content h1,
.page-content h2,
.page-content h3,
.page-content h4,
.page-content h5,
.page-content h6,
table thead th {
  text-transform: uppercase;
  letter-spacing: .03em;
}

/* ---- Cabeçalho da tabela fixo ao fazer scroll (fica visível abaixo da topbar) ---- */
table.table thead th {
  position: sticky;
  top: var(--topbar-height);
  background: #fff;
  z-index: 5;
}

/* ---- Cabeçalhos de tabela ordenáveis ---- */
table.table thead th[style*="cursor: pointer"]:hover { background: rgba(0,0,0,0.04); }
table.table thead th.th-asc::after { content: " \25B2"; font-size: .7em; }
table.table thead th.th-desc::after { content: " \25BC"; font-size: .7em; }

.badge-estado { font-size: .8rem; }
.table-hover tbody tr { cursor: pointer; }
footer { color: var(--text-muted); font-size: .85rem; }

/* ---- Responsivo — sidebar como drawer em mobile/tablet ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 199;
}
.sidebar.minimized { width: 56px; }
.main-content.minimized { margin-left: 56px; }
.sidebar.minimized .logo-text,
.sidebar.minimized .logo-sub,
.sidebar.minimized .nav-item span,
.sidebar.minimized .sidebar-logout span,
.sidebar.minimized .sidebar-user-texto {
  display: none;
}
.sidebar.minimized .sidebar-logo { padding: 20px 8px 16px; align-items: center; }
.sidebar.minimized .nav-item,
.sidebar.minimized .sidebar-logout { justify-content: center; padding: 10px 0; }
.sidebar.minimized .sidebar-user-info { justify-content: center; padding: 4px 0 10px; }

@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 200;
    transition: transform 0.25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.visible { display: block; }
  .main-content { margin-left: 0 !important; }
  .topbar { padding: 0 12px; gap: 10px; }
  .topbar-title { font-size: 15px; }
  .page-content { padding: 14px; }
}
