/* ══════════════════════════════════════════
   layout.css — Estructura principal de la app
   ══════════════════════════════════════════ */

/* ── App wrapper ── */
#app {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: rgba(10, 10, 20, 0.9);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  transition: transform var(--transition-slow);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.logo-icon {
  font-size: 1.5rem;
  color: var(--primary);
  line-height: 1;
}

.logo-text {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

/* ── Navegación sidebar ── */
.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 450;
  transition: all var(--transition);
  position: relative;
}

.nav-item:hover {
  background: var(--surface-hover);
  color: var(--text-light);
}

.nav-item.activo {
  background: var(--primary-dim);
  color: var(--primary);
  font-weight: 500;
}

.nav-item.activo::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}

.nav-icon {
  font-size: 1.1rem;
  width: 1.5rem;
  text-align: center;
  flex-shrink: 0;
}

/* ── Footer sidebar ── */
.sidebar-footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.usuario-info {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex: 1;
  min-width: 0;
}

.usuario-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-dim);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  flex-shrink: 0;
  text-transform: uppercase;
}

.usuario-datos {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.usuario-nombre {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.usuario-email {
  font-size: 0.7rem;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-logout {
  padding: 0.375rem;
  border-radius: var(--radius-xs);
  color: var(--text-faint);
  font-size: 1rem;
  transition: all var(--transition);
  flex-shrink: 0;
}

.btn-logout:hover {
  background: var(--danger-dim);
  color: var(--danger);
}

/* ── CONTENIDO PRINCIPAL ── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── TOPBAR ── */
.topbar {
  height: var(--topbar-height);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 var(--layout-gutter);
  position: sticky;
  top: 0;
  background: rgba(10, 10, 20, 0.8);
  backdrop-filter: blur(16px);
  z-index: 50;
}

.topbar-titulo {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.btn-menu-movil {
  display: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  padding: 0.25rem;
}

/* ── VISTAS ── */
.vista {
  padding: var(--layout-gutter);
  flex: 1;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── RESPONSIVE: móvil ── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.abierto {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .btn-menu-movil {
    display: block;
  }

  .vista {
    padding: 1rem;
  }

  .topbar {
    padding: 0 1rem;
  }
}
