/* ══════════════════════════════════════════
   SISTEMA BIOMÉTRICO UMG - ESTILOS GLOBALES
   ══════════════════════════════════════════ */

:root {
  --umg-azul:     #003366;
  --umg-rojo:     #990000;
  --umg-dorado:   #cc9933;
  --sidebar-w:    260px;
  --sidebar-bg:   #0a1e35;
  --sidebar-hover:#132d4d;
  --sidebar-active:#1a3d6b;
  --topbar-h:     60px;
  --font-main:    'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  --radius:       8px;
  --shadow:       0 2px 12px rgba(0,0,0,.12);
}

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

body {
  font-family: var(--font-main);
  background: #f0f4f8;
  color: #2d3a4a;
  min-height: 100vh;
}

/* ── SIDEBAR ─────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow-y: auto;
  transition: transform .3s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  background: rgba(255,255,255,.06);
  border-bottom: 1px solid rgba(255,255,255,.08);
  text-decoration: none;
}

.sidebar-brand img {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid var(--umg-dorado);
  object-fit: cover;
  flex-shrink: 0;
}

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

.sidebar-brand-text .brand-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .5px;
}

.sidebar-brand-text .brand-sub {
  font-size: 10px;
  color: var(--umg-dorado);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-section {
  padding: 14px 20px 6px;
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,.35);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.sidebar-nav {
  list-style: none;
  padding: 4px 0;
  flex: 1;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: 13.5px;
  transition: all .2s;
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
  background: var(--sidebar-hover);
  color: #fff;
  border-left-color: var(--umg-dorado);
}

.sidebar-nav a.active {
  background: var(--sidebar-active);
  color: #fff;
  border-left-color: var(--umg-rojo);
  font-weight: 600;
}

.sidebar-nav .nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: 12px;
  color: rgba(255,255,255,.4);
  text-align: center;
}

/* ── TOPBAR ──────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  background: #fff;
  box-shadow: 0 1px 8px rgba(0,0,0,.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  z-index: 900;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--umg-azul);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.btn-topbar {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius);
  color: #5a6a7e;
  font-size: 16px;
  transition: background .2s;
}

.btn-topbar:hover { background: #f0f4f8; }

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: #f7f9fc;
  border-radius: 24px;
  font-size: 13px;
  color: #3a4a5c;
  cursor: pointer;
  border: 1px solid #e2e8f0;
}

.user-pill .user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--umg-azul);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

/* ── MAIN CONTENT ────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  padding-top: var(--topbar-h);
  min-height: 100vh;
}

.page-content {
  padding: 28px;
}

/* ── STATS CARDS ─────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  border-top: 4px solid var(--umg-azul);
  transition: transform .2s, box-shadow .2s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.14); }
.stat-card.red   { border-top-color: var(--umg-rojo); }
.stat-card.gold  { border-top-color: var(--umg-dorado); }
.stat-card.green { border-top-color: #2e7d32; }

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  background: #eef2f7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-card.red  .stat-icon { background: #fdecea; }
.stat-card.gold .stat-icon { background: #fff8e1; }
.stat-card.green .stat-icon { background: #e8f5e9; }

.stat-info .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--umg-azul);
  line-height: 1;
}

.stat-card.red  .stat-value { color: var(--umg-rojo); }
.stat-card.gold .stat-value { color: #9e6c00; }
.stat-card.green .stat-value { color: #2e7d32; }

.stat-info .stat-label {
  font-size: 12px;
  color: #7a8898;
  margin-top: 4px;
  font-weight: 500;
}

/* ── CARDS / PANELS ──────────────────────── */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 24px;
}

.card-header {
  padding: 16px 22px;
  border-bottom: 1px solid #edf0f5;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h5 {
  font-size: 15px;
  font-weight: 600;
  color: var(--umg-azul);
  margin: 0;
}

.card-body { padding: 22px; }

/* ── TABLES ──────────────────────────────── */
.table-wrapper { overflow-x: auto; }

table.umg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table.umg-table th {
  background: var(--umg-azul);
  color: #fff;
  padding: 11px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

table.umg-table td {
  padding: 11px 14px;
  border-bottom: 1px solid #edf0f5;
  vertical-align: middle;
}

table.umg-table tr:hover td { background: #f7f9fc; }

/* ── BUTTONS ─────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all .2s;
}

.btn-primary   { background: var(--umg-azul); color: #fff; }
.btn-primary:hover { background: #004a8d; }
.btn-danger    { background: var(--umg-rojo); color: #fff; }
.btn-danger:hover { background: #bb0000; }
.btn-success   { background: #2e7d32; color: #fff; }
.btn-success:hover { background: #1b5e20; }
.btn-warning   { background: var(--umg-dorado); color: #fff; }
.btn-warning:hover { background: #b8872e; }
.btn-outline   { background: transparent; border: 1.5px solid var(--umg-azul); color: var(--umg-azul); }
.btn-outline:hover { background: var(--umg-azul); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 9px; font-size: 11px; }

/* ── FORMULARIOS ─────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #3a4a5c;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid #d1d9e6;
  border-radius: var(--radius);
  font-size: 13.5px;
  color: #2d3a4a;
  background: #fff;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}

.form-control:focus {
  border-color: var(--umg-azul);
  box-shadow: 0 0 0 3px rgba(0,51,102,.1);
}

select.form-control { cursor: pointer; }

/* ── BADGES / ESTADOS ────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.badge-success  { background: #e8f5e9; color: #2e7d32; }
.badge-danger   { background: #fdecea; color: #c62828; }
.badge-warning  { background: #fff8e1; color: #f57f17; }
.badge-info     { background: #e3f2fd; color: #1565c0; }
.badge-secondary { background: #eceff1; color: #546e7a; }

/* ── ÁRBOL DE ASISTENCIA ─────────────────── */
.attendance-tree {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.attendance-node {
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
  transition: transform .15s;
}

.attendance-node:hover { transform: scale(1.02); }

.attendance-node.presente {
  background: #e8f5e9;
  border: 2px solid #4caf50;
}

.attendance-node.ausente {
  background: #fdecea;
  border: 2px solid #ef5350;
}

.attendance-node img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.attendance-node .node-info { flex: 1; min-width: 0; }
.attendance-node .node-name { font-size: 13px; font-weight: 600; color: #1a2a3a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attendance-node .node-email { font-size: 11px; color: #5a6a7a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attendance-node .node-hora  { font-size: 11px; color: #7a8898; margin-top: 2px; }

.node-status {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.presente .node-status  { background: #4caf50; color: #fff; }
.ausente  .node-status  { background: #ef5350; color: #fff; }

/* ── LOGIN PAGE ──────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  background: linear-gradient(135deg, var(--umg-azul) 0%, #0a4080 60%, #001a33 100%);
}

.login-art {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: #fff;
}

.login-art img {
  width: 130px;
  margin-bottom: 22px;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,.4));
}

.login-art h1 {
  font-size: 26px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
}

.login-art p {
  font-size: 14px;
  opacity: .75;
  text-align: center;
  max-width: 300px;
  line-height: 1.6;
}

.login-form-panel {
  width: 420px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 50px 44px;
  flex-shrink: 0;
}

.login-form-inner { width: 100%; }
.login-form-inner h2 { font-size: 22px; font-weight: 700; color: var(--umg-azul); margin-bottom: 6px; }
.login-form-inner p  { font-size: 13px; color: #7a8898; margin-bottom: 30px; }

.alert {
  padding: 11px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 18px;
}
.alert-danger  { background: #fdecea; color: #c62828; border-left: 4px solid #ef5350; }
.alert-success { background: #e8f5e9; color: #2e7d32; border-left: 4px solid #4caf50; }
.alert-warning { background: #fff8e1; color: #f57f17; border-left: 4px solid #ffb300; }

/* ── PAGE HEADER ─────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--umg-azul);
}

.page-header .breadcrumb {
  font-size: 12px;
  color: #7a8898;
  margin-top: 3px;
}

/* ── FOTO PERFIL ─────────────────────────── */
.avatar-lg {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--umg-azul);
}

.avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #d1d9e6;
}

.avatar-placeholder {
  background: #eef2f7;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7a8898;
  font-size: 22px;
}

/* ── WEBCAM ──────────────────────────────── */
.webcam-box {
  background: #1a2a3a;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  display: inline-block;
}

.webcam-box video,
.webcam-box canvas {
  display: block;
  max-width: 100%;
}

.webcam-overlay {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 12px;
}

/* ── SEARCH BAR ──────────────────────────── */
.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.search-bar .form-control { max-width: 320px; }

/* ── ÁRBOL JERÁRQUICO ────────────────────── */
.tree-node {
  padding: 10px 16px;
  background: #fff;
  border-radius: var(--radius);
  border-left: 4px solid var(--umg-azul);
  margin-bottom: 8px;
  box-shadow: 0 1px 6px rgba(0,0,0,.07);
  cursor: pointer;
  transition: all .2s;
}

.tree-node:hover { box-shadow: 0 3px 12px rgba(0,0,0,.13); transform: translateX(3px); }
.tree-node.nivel-1 { margin-left: 0; }
.tree-node.nivel-2 { margin-left: 28px; border-left-color: var(--umg-dorado); }
.tree-node.nivel-3 { margin-left: 56px; border-left-color: #4caf50; }

/* ── RESPONSIVE ──────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .topbar { left: 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .login-art { display: none; }
  .login-form-panel { width: 100%; }
}
